Base class for inspectable attributes. More...
#include <OBTAbstractAttribute.h>
Public Member Functions | |
virtual | ~AbstractAttribute () |
destructor | |
const char * | getName () const |
get the inspectable attribute name | |
virtual bool | isReadOnly () const =0 |
test if the attribute can be set | |
virtual const RTTI & | getOwnerRTTI () const =0 |
returns RTTI info associated with the owner of the attribute | |
virtual const RTTI & | getRTTI () const |
Returns RTTI info associated with this class instance. | |
Static Public Member Functions | |
static const RTTI & | getClassRTTI () |
Returns RTTI info associated with this class type. | |
Protected Member Functions | |
AbstractAttribute (const char *name) | |
constructor | |
Static Private Member Functions | |
static void | initRTTI () |
Initialize RTTI information for this class. | |
static void | destroyRTTI () |
Called on application exit to destroy _rtti. | |
Private Attributes | |
std::string | _name |
Attribute name. | |
Static Private Attributes | |
static RTTI * | _rtti |
RTTI information. |
Base class for inspectable attributes.
This class specifies the interface for all inspectable attributes. Note that you cannot set the value of an inspectable attribute if you reference it through the AbstractAttribute class without upcasting it to a proper type.
Definition at line 20 of file OBTAbstractAttribute.h.
AbstractAttribute::~AbstractAttribute | ( | ) | [virtual] |
AbstractAttribute::AbstractAttribute | ( | const char * | name | ) | [protected] |
constructor
name | name of this attribute. |
Definition at line 13 of file OBTAbstractAttribute.cpp.
References _rtti, and initRTTI().
00014 : 00015 _name( name ) 00016 { 00017 // On the contrary to all other classes supporting RTTI, this class stores RTTI 00018 // information as a pointer. This is to avoid a dependency cycle, since RTTI.h 00019 // includes AbstractAttribute.h 00020 if ( _rtti == NULL ) 00021 { 00022 // creating the first instance, initialize the RTTI. 00023 initRTTI() ; 00024 } 00025 }
void AbstractAttribute::destroyRTTI | ( | ) | [static, private] |
Called on application exit to destroy _rtti.
Definition at line 51 of file OBTAbstractAttribute.cpp.
References _rtti.
Referenced by initRTTI().
00052 { 00053 delete _rtti ; 00054 }
const RTTI & AbstractAttribute::getClassRTTI | ( | ) | [static] |
Returns RTTI info associated with this class type.
Reimplemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< TOwner, short, 1933918052 >, OBT::PrimitiveAttribute< TOwner, unsigned short, 2009635584 >, OBT::PrimitiveAttribute< TOwner, unsigned int, 1543155168 >, OBT::PrimitiveAttribute< TOwner, unsigned long, 3266407847 >, OBT::PrimitiveAttribute< TOwner, bool, 1991421614 >, OBT::PrimitiveAttribute< TOwner, const char *, 1135290523 >, OBT::PrimitiveAttribute< TOwner, int, 2240172011 >, OBT::PrimitiveAttribute< TOwner, long, 1468120404 >, OBT::PrimitiveAttribute< TOwner, float, 1498253751 >, and OBT::PrimitiveAttribute< TOwner, double, 1608088171 >.
Definition at line 60 of file OBTAbstractAttribute.cpp.
References _rtti, and initRTTI().
const char * OBT::AbstractAttribute::getName | ( | ) | const [inline] |
get the inspectable attribute name
Definition at line 93 of file OBTAbstractAttribute.h.
References _name.
00094 { 00095 return _name.c_str() ; 00096 }
virtual const RTTI& OBT::AbstractAttribute::getOwnerRTTI | ( | ) | const [pure virtual] |
returns RTTI info associated with the owner of the attribute
Implemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< TOwner, short, 1933918052 >, OBT::PrimitiveAttribute< TOwner, unsigned short, 2009635584 >, OBT::PrimitiveAttribute< TOwner, unsigned int, 1543155168 >, OBT::PrimitiveAttribute< TOwner, unsigned long, 3266407847 >, OBT::PrimitiveAttribute< TOwner, bool, 1991421614 >, OBT::PrimitiveAttribute< TOwner, const char *, 1135290523 >, OBT::PrimitiveAttribute< TOwner, int, 2240172011 >, OBT::PrimitiveAttribute< TOwner, long, 1468120404 >, OBT::PrimitiveAttribute< TOwner, float, 1498253751 >, and OBT::PrimitiveAttribute< TOwner, double, 1608088171 >.
const RTTI & AbstractAttribute::getRTTI | ( | ) | const [virtual] |
Returns RTTI info associated with this class instance.
Reimplemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< TOwner, short, 1933918052 >, OBT::PrimitiveAttribute< TOwner, unsigned short, 2009635584 >, OBT::PrimitiveAttribute< TOwner, unsigned int, 1543155168 >, OBT::PrimitiveAttribute< TOwner, unsigned long, 3266407847 >, OBT::PrimitiveAttribute< TOwner, bool, 1991421614 >, OBT::PrimitiveAttribute< TOwner, const char *, 1135290523 >, OBT::PrimitiveAttribute< TOwner, int, 2240172011 >, OBT::PrimitiveAttribute< TOwner, long, 1468120404 >, OBT::PrimitiveAttribute< TOwner, float, 1498253751 >, and OBT::PrimitiveAttribute< TOwner, double, 1608088171 >.
Definition at line 75 of file OBTAbstractAttribute.cpp.
References _rtti.
00076 { 00077 return *_rtti ; 00078 }
void AbstractAttribute::initRTTI | ( | ) | [static, private] |
Initialize RTTI information for this class.
Called on creation of the first instance, or on the first call to the static member method getClassRTTI if no instance has been created yet.
Definition at line 38 of file OBTAbstractAttribute.cpp.
References _rtti, destroyRTTI(), and OBT_DBG_ASSERT.
Referenced by AbstractAttribute(), and getClassRTTI().
00039 { 00040 OBT_DBG_ASSERT( _rtti == NULL ) ; 00041 _rtti = new RTTI( 2353935542, typeid( AbstractAttribute ).name(), NULL, 0 ) ; 00042 // _rtti must be destroyed on application exit. 00043 std::atexit( destroyRTTI ) ; 00044 }
virtual bool OBT::AbstractAttribute::isReadOnly | ( | ) | const [pure virtual] |
test if the attribute can be set
Implemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< TOwner, short, 1933918052 >, OBT::PrimitiveAttribute< TOwner, unsigned short, 2009635584 >, OBT::PrimitiveAttribute< TOwner, unsigned int, 1543155168 >, OBT::PrimitiveAttribute< TOwner, unsigned long, 3266407847 >, OBT::PrimitiveAttribute< TOwner, bool, 1991421614 >, OBT::PrimitiveAttribute< TOwner, const char *, 1135290523 >, OBT::PrimitiveAttribute< TOwner, int, 2240172011 >, OBT::PrimitiveAttribute< TOwner, long, 1468120404 >, OBT::PrimitiveAttribute< TOwner, float, 1498253751 >, and OBT::PrimitiveAttribute< TOwner, double, 1608088171 >.
std::string OBT::AbstractAttribute::_name [private] |
RTTI * AbstractAttribute::_rtti [static, private] |
RTTI information.
Reimplemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::PrimitiveAttribute< TOwner, short, 1933918052 >, OBT::PrimitiveAttribute< TOwner, unsigned short, 2009635584 >, OBT::PrimitiveAttribute< TOwner, unsigned int, 1543155168 >, OBT::PrimitiveAttribute< TOwner, unsigned long, 3266407847 >, OBT::PrimitiveAttribute< TOwner, bool, 1991421614 >, OBT::PrimitiveAttribute< TOwner, const char *, 1135290523 >, OBT::PrimitiveAttribute< TOwner, int, 2240172011 >, OBT::PrimitiveAttribute< TOwner, long, 1468120404 >, OBT::PrimitiveAttribute< TOwner, float, 1498253751 >, and OBT::PrimitiveAttribute< TOwner, double, 1608088171 >.
Definition at line 83 of file OBTAbstractAttribute.h.
Referenced by AbstractAttribute(), destroyRTTI(), getClassRTTI(), getRTTI(), and initRTTI().