Base class for all objects that have private implementation (pimpl) back-end. More...
Public Types | |
typedef int | IdType |
Defines a type identifier. | |
Public Member Functions | |
ModelData_BaseObject () | |
Constructor. | |
IdType | TypeId () const |
Returns an object type id. | |
template<typename T > | |
bool | IsOfType () const |
Returns true if the object has a type T. | |
void | SetName (const Base_UTF16String &theName) |
Sets an object name. | |
Base_UTF16String | Name () const |
void | SetUuid (const Base_Uuid &theUuid) |
Base_Uuid | Uuid () const |
void | Nullify () |
Resets reference to implementation object. | |
bool | IsNull () const |
Returns true if the object is nullified. | |
operator bool () const | |
Casts the object to the bool type. | |
internal::ModelData_BaseObjectImpl * | Impl () const |
Return a handle to backend (reserved for internal use). | |
Protected Member Functions | |
ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl) | |
Constructor (reserved for internal use). | |
ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl, const Base_UTF16String &theName) | |
Constructor (reserved for internal use). | |
template<typename T > | |
T * | GetOrCreateImpl () |
Reserved for internal use. | |
Base class for all objects that have private implementation (pimpl) back-end.
ModelData_BaseObject is a root of a hierarchy where objects represent API.
Implementation objects (returned by Impl()) internally contains reference counter which is used to manage life span of the object.
Subclases of ModelData_BaseObject do not have own data fields. Data is stored inside the implementation object.
|
inline |
Constructor.
Creates a null object (see IsNull()).
bool cadex::ModelData_BaseObject::IsNull | ( | ) | const |
Returns true if the object is nullified.
|
inline |
Returns true if the object has a type T.
Helper method which uses static method T::GetTypeId() to compare with value returned by virtual method TypeId().
Base_UTF16String cadex::ModelData_BaseObject::Name | ( | ) | const |
Returns an object name. Returns empty string if the object has no name (by default).
void cadex::ModelData_BaseObject::Nullify | ( | ) |
Resets reference to implementation object.
Decrements reference counter and destroys the object if the counter reaches zero.
|
inline |
void cadex::ModelData_BaseObject::SetName | ( | const Base_UTF16String & | theName | ) |
void cadex::ModelData_BaseObject::SetUuid | ( | const Base_Uuid & | theUuid | ) |
ModelData_BaseObject::IdType cadex::ModelData_BaseObject::TypeId | ( | ) | const |
Returns an object type id.
Type id can be used for faster type check (comparing to dynamic_cast), for instance: