TypeHandle
from panda3d.core import TypeHandle
- class TypeHandle
Bases:
DTOOL_SUPER_BASE
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.
Inheritance diagram
- MCArray = 1
- MCDeletedChainActive = 2
- MCDeletedChainInactive = 3
- MCLimit = 4
- MCSingleton = 0
- MC_array = 1
- MC_deleted_chain_active = 2
- MC_deleted_chain_inactive = 3
- MC_limit = 4
- MC_singleton = 0
- __init__(*args, **kwargs)
- child_classes
- compareTo()
C++ Interface: compare_to(TypeHandle self, const TypeHandle other)
- /**
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.
*/
- compare_to()
C++ Interface: compare_to(TypeHandle self, const TypeHandle other)
- /**
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.
*/
- decMemoryUsage()
C++ Interface: dec_memory_usage(const TypeHandle self, int memory_class, int size)
- /**
Subtracts the indicated amount from the record for the total allocated
memory for objects of this type.
*/
- dec_memory_usage()
C++ Interface: dec_memory_usage(const TypeHandle self, int memory_class, int size)
- /**
Subtracts the indicated amount from the record for the total allocated
memory for objects of this type.
*/
- getChildClass()
C++ Interface: get_child_class(TypeHandle self, int index)
- /**
Returns the nth child class of this type. The index should be in the range
0 <= index < get_num_child_classes().
*/
- getHash()
C++ Interface: get_hash(TypeHandle self)
- /**
Returns a hash code suitable for phash_map.
*/
- getIndex()
C++ Interface: get_index(TypeHandle self)
- /**
Returns the integer index associated with this TypeHandle. Each different
TypeHandle will have a different index. However, you probably shouldn’t be
using this method; you should just treat the TypeHandles as opaque classes.
This is provided for the convenience of non-C++ scripting languages to
build a hashtable of TypeHandles.
*/
- getMemoryUsage()
C++ Interface: get_memory_usage(TypeHandle self, int memory_class)
- /**
Returns the total allocated memory used by objects of this type, for the
indicated memory class. This is only updated if track-memory-usage is set
true in your Config.prc file.
*/
- getName()
C++ Interface: get_name(TypeHandle self, TypedObject object)
- /**
Returns the name of the type.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- getNumChildClasses()
C++ Interface: get_num_child_classes(TypeHandle self, TypedObject object)
- /**
Returns the number of child classes that this type is known to have. This
may then be used to index into get_child_class().
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- getNumParentClasses()
C++ Interface: get_num_parent_classes(TypeHandle self, TypedObject object)
- /**
Returns the number of parent classes that this type is known to have. This
may then be used to index into get_parent_class(). The result will be 0 if
this class does not inherit from any other classes, 1 if normal, single
inheritance is in effect, or greater than one if multiple inheritance is in
effect.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- getParentClass()
C++ Interface: get_parent_class(TypeHandle self, int index)
- /**
Returns the nth parent class of this type. The index should be in the
range 0 <= index < get_num_parent_classes().
*/
- getParentTowards()
C++ Interface: get_parent_towards(TypeHandle self, TypeHandle ancestor, TypedObject object)
- /**
Returns the parent class that is in a direct line of inheritance to the
indicated ancestor class. This is useful in the presence of multiple
inheritance to try to determine what properties an unknown type may have.
The return value is TypeHandle::none() if the type does not inherit from
the ancestor. If ancestor is the same as this type, the return value is
this type.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- get_child_class()
C++ Interface: get_child_class(TypeHandle self, int index)
- /**
Returns the nth child class of this type. The index should be in the range
0 <= index < get_num_child_classes().
*/
- get_hash()
C++ Interface: get_hash(TypeHandle self)
- /**
Returns a hash code suitable for phash_map.
*/
- get_index()
C++ Interface: get_index(TypeHandle self)
- /**
Returns the integer index associated with this TypeHandle. Each different
TypeHandle will have a different index. However, you probably shouldn’t be
using this method; you should just treat the TypeHandles as opaque classes.
This is provided for the convenience of non-C++ scripting languages to
build a hashtable of TypeHandles.
*/
- get_memory_usage()
C++ Interface: get_memory_usage(TypeHandle self, int memory_class)
- /**
Returns the total allocated memory used by objects of this type, for the
indicated memory class. This is only updated if track-memory-usage is set
true in your Config.prc file.
*/
- get_name()
C++ Interface: get_name(TypeHandle self, TypedObject object)
- /**
Returns the name of the type.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- get_num_child_classes()
C++ Interface: get_num_child_classes(TypeHandle self, TypedObject object)
- /**
Returns the number of child classes that this type is known to have. This
may then be used to index into get_child_class().
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- get_num_parent_classes()
C++ Interface: get_num_parent_classes(TypeHandle self, TypedObject object)
- /**
Returns the number of parent classes that this type is known to have. This
may then be used to index into get_parent_class(). The result will be 0 if
this class does not inherit from any other classes, 1 if normal, single
inheritance is in effect, or greater than one if multiple inheritance is in
effect.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- get_parent_class()
C++ Interface: get_parent_class(TypeHandle self, int index)
- /**
Returns the nth parent class of this type. The index should be in the
range 0 <= index < get_num_parent_classes().
*/
- get_parent_towards()
C++ Interface: get_parent_towards(TypeHandle self, TypeHandle ancestor, TypedObject object)
- /**
Returns the parent class that is in a direct line of inheritance to the
indicated ancestor class. This is useful in the presence of multiple
inheritance to try to determine what properties an unknown type may have.
The return value is TypeHandle::none() if the type does not inherit from
the ancestor. If ancestor is the same as this type, the return value is
this type.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- incMemoryUsage()
C++ Interface: inc_memory_usage(const TypeHandle self, int memory_class, int size)
- /**
Adds the indicated amount to the record for the total allocated memory for
objects of this type.
*/
- inc_memory_usage()
C++ Interface: inc_memory_usage(const TypeHandle self, int memory_class, int size)
- /**
Adds the indicated amount to the record for the total allocated memory for
objects of this type.
*/
- index
- isDerivedFrom()
C++ Interface: is_derived_from(TypeHandle self, TypeHandle parent, TypedObject object)
- /**
Returns true if this type is derived from the indicated type, false
otherwise.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- is_derived_from()
C++ Interface: is_derived_from(TypeHandle self, TypeHandle parent, TypedObject object)
- /**
Returns true if this type is derived from the indicated type, false
otherwise.
The “object” pointer is an optional pointer to the TypedObject class that
owns this TypeHandle. It is only used in case the TypeHandle is
inadvertantly undefined.
*/
- make()
C++ Interface: make(type classobj)
- name
- none()
C++ Interface: none()
- parent_classes