CAD Exchanger SDK
cadex::ModelData_BaseObject Class Reference

Base class for all objects that have private implementation (pimpl) back-end. More...

Inheritance diagram for cadex::ModelData_BaseObject:
cadex::ModelData_Appearance cadex::ModelData_Layer cadex::ModelData_PMICamera cadex::ModelData_PMIGraphicalElement cadex::ModelData_PMIPlane cadex::ModelData_PMISavedView cadex::ModelData_PMITable cadex::ModelData_PolyShape cadex::ModelData_PropertyTable cadex::ModelData_Representation cadex::ModelData_SceneGraphElement

Public Types

typedef int IdType
 Defines a type identifier.
 

Public Member Functions

 ModelData_BaseObject ()
 Constructor. More...
 
IdType TypeId () const
 Returns an object type id. More...
 
template<typename T >
bool IsOfType () const
 Returns true if the object has a type T. More...
 
void SetName (const Base_UTF16String &theName)
 Sets an object name. More...
 
Base_UTF16String Name () const
 Returns an object name. More...
 
void Nullify ()
 Resets reference to implementation object. More...
 
bool IsNull () const
 Returns true if the object is nullified. More...
 
 operator bool () const
 Casts the object to the bool type. More...
 
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ModelData_BaseObject()

cadex::ModelData_BaseObject::ModelData_BaseObject ( )
inline

Constructor.

Creates a null object (see IsNull()).

Member Function Documentation

◆ IsNull()

bool cadex::ModelData_BaseObject::IsNull ( ) const

Returns true if the object is nullified.

See also
Nullify().

◆ IsOfType()

template<typename T >
bool cadex::ModelData_BaseObject::IsOfType ( ) const
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().

◆ Name()

Base_UTF16String cadex::ModelData_BaseObject::Name ( ) const

Returns an object name.

Returns empty string if the object has no name (by default).

See also
SetName().
Examples:
modelexplorer/main.cxx.

◆ Nullify()

void cadex::ModelData_BaseObject::Nullify ( )

Resets reference to implementation object.

Decrements reference counter and destroys the object if the counter reaches zero.

◆ operator bool()

cadex::ModelData_BaseObject::operator bool ( ) const
inline

Casts the object to the bool type.

Returns IsNull().

◆ SetName()

void cadex::ModelData_BaseObject::SetName ( const Base_UTF16String theName)

Sets an object name.

Accepts a string as a unicode string.

See also
Name().

◆ TypeId()

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:

ModelData_Representation a
Examples:
meshing/main.cxx, and modelexplorer/main.cxx.