ATLAS Offline Software
Loading...
Searching...
No Matches
Property Class Reference

Support class for PropertyMgr. More...

#include <Property.h>

Inheritance diagram for Property:
Collaboration diagram for Property:

Public Types

enum  Type {
  UNKNOWNTYPE , BOOL , INT , FLOAT ,
  DOUBLE , STRING , INTVECTOR , FLOATVECTOR ,
  STRINGVECTOR , TOOLHANDLE , TOOLHANDLEARRAY
}
 Property type enumeration. More...
typedef std::vector< int > IntVector
 Convenience type declaration for an integer vector.
typedef std::vector< float > FloatVector
 Convenience type declaration for a float vector.
typedef std::vector< std::string > StringVector
 Convenience type declaration for a string vector.

Public Member Functions

 Property ()
 Default constructor.
 Property (Type type)
 Constructor with a type.
virtual ~Property ()
 Destructor.
bool isValid () const
 Return if this is a valid property.
Type type () const
 Return the type index.
const std::string & typeName () const
 Return the type name.
virtual int setFrom (const Property &rhs)
virtual StatusCode getString (std::string &result) const
 get the property as a string
virtual StatusCode getCastString (std::string &result) const
 get the property as a string I can pas to setString
virtual StatusCode setString (const std::string &value)
 set the property from a string

Static Public Member Functions

static const std::string & name (Type type)
 Function returning a user-readable name for a property type.

Private Attributes

Type m_type
 The type of the property.

Detailed Description

Support class for PropertyMgr.

Base class for all property types that can be set on a tool.

Author
David Adams dlada.nosp@m.ms@b.nosp@m.nl.go.nosp@m.v
Revision
802972
Date
2017-04-15 20:13:17 +0200 (Sat, 15 Apr 2017)

Definition at line 23 of file Property.h.

Member Typedef Documentation

◆ FloatVector

typedef std::vector< float > Property::FloatVector

Convenience type declaration for a float vector.

Definition at line 44 of file Property.h.

◆ IntVector

typedef std::vector< int > Property::IntVector

Convenience type declaration for an integer vector.

Definition at line 42 of file Property.h.

◆ StringVector

typedef std::vector< std::string > Property::StringVector

Convenience type declaration for a string vector.

Definition at line 46 of file Property.h.

Member Enumeration Documentation

◆ Type

Property type enumeration.

Enumerator
UNKNOWNTYPE 
BOOL 
INT 
FLOAT 
DOUBLE 
STRING 
INTVECTOR 
FLOATVECTOR 
STRINGVECTOR 
TOOLHANDLE 
TOOLHANDLEARRAY 

Definition at line 27 of file Property.h.

27 {
29 BOOL,
30 INT,
31 FLOAT,
32 DOUBLE,
33 STRING,
39 }; // enum Type
@ FLOATVECTOR
Definition Property.h:35
@ INTVECTOR
Definition Property.h:34
@ TOOLHANDLEARRAY
Definition Property.h:38
@ UNKNOWNTYPE
Definition Property.h:28
@ TOOLHANDLE
Definition Property.h:37
@ STRINGVECTOR
Definition Property.h:36

Constructor & Destructor Documentation

◆ Property() [1/2]

Property::Property ( )

Default constructor.

Definition at line 43 of file Property.cxx.

44 : m_type( UNKNOWNTYPE ) {
45
46}
Type m_type
The type of the property.
Definition Property.h:106

◆ Property() [2/2]

Property::Property ( Type type)

Constructor with a type.

Definition at line 48 of file Property.cxx.

49 : m_type( type ) {
50
51}
Type type() const
Return the type index.
Definition Property.cxx:58

◆ ~Property()

virtual Property::~Property ( )
inlinevirtual

Destructor.

Definition at line 56 of file Property.h.

56{}

Member Function Documentation

◆ getCastString()

StatusCode Property::getCastString ( std::string & result) const
virtual

get the property as a string I can pas to setString

the main difference to getString is that this will not quote strings, i.e. it will assume strings are already properly quoted if they need to be and won't be otherwise. otherwise there will be an issue when setting non-strings from strings the user provided

Guarantee
strong
Failures
no string conversion available

Reimplemented in TProperty< T >.

Definition at line 81 of file Property.cxx.

81 {
82 std::cout << "Property::getCastString: method not implemented" << std::endl;
83 return StatusCode::FAILURE;
84}

◆ getString()

StatusCode Property::getString ( std::string & result) const
virtual

get the property as a string

Guarantee
strong
Failures
no string conversion available

Reimplemented in TProperty< T >.

Definition at line 76 of file Property.cxx.

76 {
77 std::cout << "Property::getString: method not implemented" << std::endl;
78 return StatusCode::FAILURE;
79}

◆ isValid()

bool Property::isValid ( ) const

Return if this is a valid property.

Must have a known type.

Definition at line 53 of file Property.cxx.

53 {
54
55 return ( m_type != UNKNOWNTYPE );
56}

◆ name()

const std::string & Property::name ( Type type)
static

Function returning a user-readable name for a property type.

Definition at line 21 of file Property.cxx.

21 {
22
23 switch( type ) {
24 DECLARE_TYPE( UNKNOWNTYPE, "unknown" );
25 DECLARE_TYPE( BOOL, "bool" );
26 DECLARE_TYPE( INT, "int" );
27 DECLARE_TYPE( FLOAT, "float" );
28 DECLARE_TYPE( DOUBLE, "double" );
29 DECLARE_TYPE( STRING, "string" );
30 DECLARE_TYPE( INTVECTOR, "vector<int>" );
31 DECLARE_TYPE( FLOATVECTOR, "vector<float>" );
32 DECLARE_TYPE( STRINGVECTOR, "vector<string>" );
33 DECLARE_TYPE( TOOLHANDLE, "ToolHandle" );
34 DECLARE_TYPE( TOOLHANDLEARRAY, "ToolHandleArray" );
35 default:
36 break;
37 }
38
39 static const std::string dummy( "<error>" );
40 return dummy;
41}
#define DECLARE_TYPE(TYPE, NAME)
Macro used in implementing the type->name translation function.
Definition Property.cxx:13

◆ setFrom()

int Property::setFrom ( const Property & rhs)
virtual

Reimplemented in TProperty< T >, TProperty< T >, and TProperty< T >.

Definition at line 68 of file Property.cxx.

68 {
69
70 std::cout << "Property::setFrom: Property not set!" << std::endl;
71 return -1;
72}

◆ setString()

StatusCode Property::setString ( const std::string & value)
virtual

set the property from a string

Guarantee
basic
Failures
no string conversion available
format errors

Reimplemented in TProperty< T >.

Definition at line 86 of file Property.cxx.

86 {
87 std::cout << "Property::setString: method not implemented" << std::endl;
88 return StatusCode::FAILURE;
89}

◆ type()

Property::Type Property::type ( ) const

Return the type index.

Definition at line 58 of file Property.cxx.

58 {
59
60 return m_type;
61}

◆ typeName()

const std::string & Property::typeName ( ) const

Return the type name.

Definition at line 63 of file Property.cxx.

63 {
64
65 return name( m_type );
66}
static const std::string & name(Type type)
Function returning a user-readable name for a property type.
Definition Property.cxx:21

Member Data Documentation

◆ m_type

Type Property::m_type
private

The type of the property.

Definition at line 106 of file Property.h.


The documentation for this class was generated from the following files: