Cortex
10.0.0-a4
|
#include <ClassData.h>
Public Types | |
typedef ClassTypeT | ClassType |
typedef DataTypeT | DataType |
typedef DataDeletePolicyT | DataDeletePolicy |
Public Member Functions | |
virtual | ~ClassData () |
Exercises DataDeletePolicy on all held data. | |
DataType & | create (const ClassType *classOwner) |
Create some uninitialized data for the given class. | |
DataType & | create (const ClassType *classOwner, const DataType &d) |
Create some data with initial value as specified for the given class. | |
const DataType & | operator[] (const ClassType *classOwner) const |
DataType & | operator[] (const ClassType *classOwner) |
void | erase (const ClassType *classOwner) |
Protected Types | |
typedef std::map< const ClassType *, DataType > | ClassDataMap |
Protected Attributes | |
ClassDataMap | m_classDataMap |
A simple class to allow, for example, extra data to be added to a class for use in cases where simply adding member data would break the library's binary compatibility. Template with the type of the class that data is being added to, the type of the data being added, and policy for deleting that data when the class is destructed. The latter allows use of dynamically-allocated data and arrays.
It the responsibility of the client of this class to implement all creation, deletion, and copy semantics.
Example, which effectively adds an extra member of type "int" to class "A" :
void IECore::ClassData< ClassTypeT, DataTypeT, DataDeletePolicyT >::erase | ( | const ClassType * | classOwner | ) |
Exercise DataDeletePolicy on the classOwner's data, and remove it. If the data has not yet been created the behaviour is undefined.
const DataType& IECore::ClassData< ClassTypeT, DataTypeT, DataDeletePolicyT >::operator[] | ( | const ClassType * | classOwner | ) | const |
Const access to the data associated with the class. If the data has not yet been created the behaviour is undefined.
DataType& IECore::ClassData< ClassTypeT, DataTypeT, DataDeletePolicyT >::operator[] | ( | const ClassType * | classOwner | ) |
Read/write access to the data associated with the class. If the data has not yet been created the behaviour is undefined.