OBT::AbstractAttribute Class Reference

#include <OBTAbstractAttribute.h>

Inheritance diagram for OBT::AbstractAttribute:

Inheritance graph
[legend]
Collaboration diagram for OBT::AbstractAttribute:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~AbstractAttribute ()
const char * getName () const
virtual bool isReadOnly () const =0
virtual const RTTIgetOwnerRTTI () const =0
virtual const RTTIgetRTTI () const

Static Public Member Functions

static const RTTIgetClassRTTI ()

Protected Member Functions

 AbstractAttribute (const char *name)

Static Private Member Functions

static void initRTTI ()
static void destroyRTTI ()

Private Attributes

std::string _name
 Attribute name.

Static Private Attributes

static RTTI_rtti
 RTTI information.


Detailed Description

Base class for inspectable attributes
Author:
Michaël Rouillé <michael.rouille@gmail.com> 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.


Constructor & Destructor Documentation

AbstractAttribute::~AbstractAttribute (  )  [virtual]

destructor

Definition at line 30 of file OBTAbstractAttribute.cpp.

00031 {
00032 }

AbstractAttribute::AbstractAttribute ( const char *  name  )  [protected]

constructor

Parameters:
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 }


Member Function Documentation

const char * OBT::AbstractAttribute::getName (  )  const [inline]

get the inspectable attribute name

Returns:
the name of the inspectable attribute

Definition at line 93 of file OBTAbstractAttribute.h.

References _name.

00094         {
00095                 return _name.c_str() ;
00096         }

virtual bool OBT::AbstractAttribute::isReadOnly (  )  const [pure virtual]

test if the attribute can be set

Returns:
false if the setValue method can be called on the attribute, true otherwise

Implemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< const TOwner, char *, 1135290523 >, 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, int, 2240172011 >, OBT::PrimitiveAttribute< TOwner, long, 1468120404 >, OBT::PrimitiveAttribute< TOwner, float, 1498253751 >, and OBT::PrimitiveAttribute< TOwner, double, 1608088171 >.

virtual const RTTI& OBT::AbstractAttribute::getOwnerRTTI (  )  const [pure virtual]

returns RTTI info associated with the owner of the attribute

Returns:
RTTI info associated with the owner of the attribute

Implemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< const TOwner, char *, 1135290523 >, 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, 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

Returns:
RTTI info associated with this class instance

Reimplemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< const TOwner, char *, 1135290523 >, 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, 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 }

const RTTI & AbstractAttribute::getClassRTTI (  )  [static]

Returns RTTI info associated with this class type

Returns:
RTTI info associated with this class type

Reimplemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::TypedAttribute< TOwner, TAttribute >, OBT::PrimitiveAttribute< const TOwner, char *, 1135290523 >, 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, 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().

00061 {
00062         if ( _rtti == NULL )
00063         {
00064                 // First call to getClassRTTI and no instance has been created yet :
00065                 // initialize RTTI.
00066                 initRTTI() ;
00067         }
00068         return *_rtti ;
00069 }

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 }

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 }


Member Data Documentation

RTTI * AbstractAttribute::_rtti [static, private]

RTTI information.

Reimplemented in OBT::PrimitiveAttribute< TOwner, TAttribute, typeID >, OBT::PrimitiveAttribute< const TOwner, char *, 1135290523 >, 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, 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().

std::string OBT::AbstractAttribute::_name [private]

Attribute name.

Definition at line 86 of file OBTAbstractAttribute.h.

Referenced by getName().


Generated on Wed Oct 1 11:34:17 2008 for OBT by  doxygen 1.5.3