OpenNURBS classes derived from ON_Object use ON_ClassId to store run-time type information
More...
#include <opennurbs_object.h>
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::ON_ClassId |
( |
const char * |
sClassName, |
|
|
const char * |
sBaseClassName, |
|
|
class ON_Object *(*)() |
create, |
|
|
const char * |
sUUID |
|
) |
| |
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::~ON_ClassId |
( |
| ) |
|
◆ BaseClass()
◆ BaseClassName()
const char* ON_ClassId::BaseClassName |
( |
| ) |
const |
◆ ClassId() [1/2]
static const ON_ClassId* ON_ClassId::ClassId |
( |
const char * |
sClassName | ) |
|
|
static |
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.
const ON_ClassId* brep_id = ON_CLassId::ClassId(
"ON_Brep");
◆ ClassId() [2/2]
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.
ON_UUID brep_uuid = ON_UuidFromString(
"60B5DBC5-E660-11d3-BFE4-0010830122F0");
◆ ClassIdVersion()
unsigned int ON_ClassId::ClassIdVersion |
( |
| ) |
const |
◆ ClassName()
const char* ON_ClassId::ClassName |
( |
| ) |
const |
◆ Create()
- Returns
- Null or a pointer to an instance of the class created using new and the class's default constructor.
◆ CurrentMark()
static int ON_ClassId::CurrentMark |
( |
| ) |
|
|
static |
◆ Dump()
Dumps the ON_ClassId list
- Parameters
-
dump | [in] destination for the text dump. |
◆ IncrementMark()
static int ON_ClassId::IncrementMark |
( |
| ) |
|
|
static |
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.
◆ IsDerivedFrom()
bool ON_ClassId::IsDerivedFrom |
( |
const ON_ClassId * |
potential_parent | ) |
const |
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.
◆ LastClassId()
static const ON_ClassId* ON_ClassId::LastClassId |
( |
| ) |
|
|
static |
◆ Mark()
int ON_ClassId::Mark |
( |
| ) |
const |
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
◆ Purge()
static int ON_ClassId::Purge |
( |
int |
mark | ) |
|
|
static |
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.
load MY.DLL with classes derived from
ON_Object...
ON_ClassId::Purge( my_dll_classid_mark );
unload MY.DLL
◆ PurgeAfter()
static bool ON_ClassId::PurgeAfter |
( |
const ON_ClassId * |
pClassId | ) |
|
|
static |
◆ Uuid()