|
|
|
TypeHandle is the identifier used to differentiate C++ class types.
More...
#include "typeHandle.h"
List of all members.
Public Types |
| enum | MemoryClass {
MC_singleton,
MC_array,
MC_deleted_chain_active,
MC_deleted_chain_inactive,
MC_limit
} |
Public Member Functions |
| | TypeHandle () |
| | The default constructor must do nothing, because we can't guarantee ordering of static initializers.
|
|
| TypeHandle (const TypeHandle ©) |
| int | compare_to (const TypeHandle &other) const |
| | Sorts TypeHandles arbitrarily (according to <, >, etc.).
|
|
void | dec_memory_usage (MemoryClass, int) |
| int | get_best_parent_from_Set (const std::set< int > &legal_vals) const |
| | Return the Index of the BEst fit Classs from a set.
|
| TypeHandle | get_child_class (int index) const |
| | Returns the nth child class of this type.
|
| size_t | get_hash () const |
| | Returns a hash code suitable for phash_map.
|
| int | get_index () const |
| | Returns the integer index associated with this TypeHandle.
|
|
int | get_memory_usage (MemoryClass) const |
| string | get_name (TypedObject *object=(TypedObject *) NULL) const |
| | Returns the name of the type.
|
| int | get_num_child_classes (TypedObject *object=(TypedObject *) NULL) const |
| | Returns the number of child classes that this type is known to have.
|
| int | get_num_parent_classes (TypedObject *object=(TypedObject *) NULL) const |
| | Returns the number of parent classes that this type is known to have.
|
| TypeHandle | get_parent_class (int index) const |
| | Returns the nth parent class of this type.
|
| TypeHandle | get_parent_towards (TypeHandle ancestor, TypedObject *object=(TypedObject *) NULL) const |
| | Returns the parent class that is in a direct line of inheritance to the indicated ancestor class.
|
|
void | inc_memory_usage (MemoryClass, int) |
| bool | is_derived_from (TypeHandle parent, TypedObject *object=(TypedObject *) NULL) const |
| | Returns true if this type is derived from the indicated type, false otherwise.
|
|
bool | operator!= (const TypeHandle &other) const |
|
bool | operator< (const TypeHandle &other) const |
|
bool | operator<= (const TypeHandle &other) const |
|
bool | operator== (const TypeHandle &other) const |
|
bool | operator> (const TypeHandle &other) const |
|
bool | operator>= (const TypeHandle &other) const |
|
void | output (ostream &out) const |
Static Public Member Functions |
| static TypeHandle | none () |
| | Returns a special zero-valued TypeHandle that is used to indicate no type.
|
Friends |
|
class | TypeRegistry |
Detailed Description
TypeHandle is the identifier used to differentiate C++ class types.
Any C++ classes that inherit from some base class, and must be differentiated at run time, should store a static TypeHandle object that can be queried through a static member function named get_class_type(). Most of the time, it is also desirable to inherit from TypedObject, which provides some virtual functions to return the TypeHandle for a particular instance.
At its essence, a TypeHandle is simply a unique identifier that is assigned by the TypeRegistry. The TypeRegistry stores a tree of TypeHandles, so that ancestry of a particular type may be queried, and the type name may be retrieved for run-time display.
Definition at line 90 of file typeHandle.h.
Constructor & Destructor Documentation
The default constructor must do nothing, because we can't guarantee ordering of static initializers.
If the constructor tried to initialize its value, it might happen after the value had already been set previously by another static initializer!
Definition at line 26 of file typeHandle.I.
Member Function Documentation
Sorts TypeHandles arbitrarily (according to <, >, etc.).
Returns a number less than 0 if this type sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent.
Definition at line 107 of file typeHandle.I.
Returns a hash code suitable for phash_map.
Definition at line 117 of file typeHandle.I.
Returns a special zero-valued TypeHandle that is used to indicate no type.
Definition at line 274 of file typeHandle.I.
Referenced by FindApproxPath::add_component(), FactoryBase::add_preferred(), SimpleHashMap< Key, Value, Compare >::clear(), FactoryBase::find_registered_type(), TypeRegistry::find_type(), TypeRegistry::find_type_by_id(), get_name(), AttribNodeRegistry::get_node_type(), TypeRegistryNode::get_parent_towards(), CycleData::get_parent_type(), FactoryBase::get_preferred(), RenderAttribRegistry::get_slot_type(), FactoryBase::get_type(), TypeRegistry::get_typehandle(), AnimGroup::get_value_type(), PartGroup::get_value_type(), FactoryBase::make_instance(), FactoryBase::make_instance_more_general(), BamReader::read_handle(), WeakPointerToBase< T >::reassign(), NodePointerToBase< T >::reassign(), FactoryBase::register_factory(), TypeRegistry::register_type(), and NodePath::set_collide_mask().
The documentation for this class was generated from the following files:
| | |