Rhino C++ API
8.14
|
used for runtime class identification More...
#include <opennurbs_object.h>
Public Member Functions | |
ON_ClassId (const char *sClassName, const char *sBaseClassName, class ON_Object *(*create)(), const char *sUUID) | |
~ON_ClassId () | |
const ON_ClassId * | BaseClass () const |
const char * | BaseClassName () const |
unsigned int | ClassIdVersion () const |
const char * | ClassName () const |
ON_Object * | Create () const |
bool | IsDerivedFrom (const ON_ClassId *potential_parent) const |
int | Mark () const |
ON_UUID | Uuid () const |
Static Public Member Functions | |
static const ON_ClassId * | ClassId (const char *sClassName) |
static const ON_ClassId * | ClassId (ON_UUID class_uuid) |
static int | CurrentMark () |
static void | Dump (ON_TextLog &dump) |
static int | IncrementMark () |
static const ON_ClassId * | LastClassId () |
static int | Purge (int mark) |
static bool | PurgeAfter (const ON_ClassId *pClassId) |
used for runtime class identification
Description: OpenNURBS classes derived from ON_Object use ON_ClassId to store run-time type information
The ON_OBJECT_DECLARE and ON_OBJECT_IMPLEMENT macros generate the code that creates and initializes the ON_ClassId for each class.
The ON_Object::IsKindOf() and ON_Object::Cast() functions use this run-time type information.
ON_ClassId::ON_ClassId | ( | const char * | sClassName, |
const char * | sBaseClassName, | ||
class ON_Object *(*)() | create, | ||
const char * | sUUID | ||
) |
Description: This constructor is called to initialize each class id. The call is generated by the ON_OBJECT_IMPLEMENT macro.
Parameters: sClassName - [in] name of the class (like ON_Geometry) sBaseClassName - [in] name of baseclass (like ON_Object) create - [in] function to create a new object(like CreateNewON_Geometry()) sUUID - [in] UUID in registry format from Windows guidgen.exe
ON_ClassId::~ON_ClassId | ( | ) |
const ON_ClassId* ON_ClassId::BaseClass | ( | ) | const |
Returns: base class id
const char* ON_ClassId::BaseClassName | ( | ) | const |
Returns: base class name
|
static |
Description: Gets a class's ON_ClassId from the class's name. Parameters: sClassName - [in] name of class Returns: Pointer to the class's ON_ClassId. Example: const ON_ClassId* brep_id = ON_CLassId::ClassId("ON_Brep");
|
static |
Description: Gets a class's ON_ClassId from the class's uuid. Parameters: class_uuid - [in] uuid for the class Returns: Pointer to the class's ON_ClassId. Example: ON_UUID brep_uuid = ON_UuidFromString("60B5DBC5-E660-11d3-BFE4-0010830122F0"); const ON_ClassId* brep_id = ON_ClassId::ClassId(brep_uuid);
unsigned int ON_ClassId::ClassIdVersion | ( | ) | const |
const char* ON_ClassId::ClassName | ( | ) | const |
Returns: class name
ON_Object* ON_ClassId::Create | ( | ) | const |
Description: Use the default constructor to create an instance of the class on the heap. Returns: Null or a pointer to an instance of the class created using new and the class's default constructor.
|
static |
|
static |
Description: Dumps the ON_ClassId list Parameters: dump - [in] destination for the text dump.
|
static |
Description: Each class derived from ON_Object has a corresponding ON_ClassId stored in a linked list and the class is marked with an integer value. ON_ClassId::IncrementMark() increments the value used to mark new classes and returns the new marking value. Returns: Value that will be used to mark all future ON_ClassIds.
bool ON_ClassId::IsDerivedFrom | ( | const ON_ClassId * | potential_parent | ) | const |
Description: Determine if the class associated with this ON_ClassId is derived from another class. Parameters: potential_parent - [in] Class to test as parent. Returns: true if this is derived from potential_parent.
|
static |
int ON_ClassId::Mark | ( | ) | const |
Description: Opennurbs classes have a mark value of 0. Core Rhino classes have a mark value of 1. Rhino plug-in classes have a mark value of > 1. Returns: Class mark value
|
static |
Description: Each class derived from ON_Object has a corresponding ON_ClassId stored in a linked list. If a class definition is going to disappear (which happens when the derived object definition is in a DLL that uses openNURBS as a DLL and the DLL containing the derived object's definition is unloaded), then the class's ON_ClassId needs to be removed from the class list. ON_ClassId::Purge( mark ) removes all ON_ClassIds with a a prescribed mark and returns the number of classes that were purged.
Parameters: mark - [in] All ON_ClassIds with this mark will be purged. Returns: Number of classes that were purged. Example: ///< Call ON_ClassId::IncrementMark() BEFORE loading MY.DLL. int my_dll_classid_mark = ON_ClassId::IncrementMark(); load MY.DLL with classes derived from ON_Object ... ///< Call ON_ClassId::Purge() BEFORE unloading MY.DLL. ON_ClassId::Purge( my_dll_classid_mark ); unload MY.DLL
|
static |
ON_UUID ON_ClassId::Uuid | ( | ) | const |
Returns: class uuid