# TypeHandle

from pandac.PandaModules import TypeHandle

Class : TypeHandle
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.

## Inheritance:

TypeHandle:

## Methods of TypeHandle:

compareTo
decMemoryUsage
getBestParentFromSet
getChildClass
getHash
getIndex
getMemoryUsage
getName
getNumChildClasses
getNumParentClasses
getParentClass
getParentTowards
incMemoryUsage
isDerivedFrom
none
operator !=
operator <
operator <=
operator ==
operator >
operator >=
output

## Constants in TypeHandle:

MCSingleton | (MemoryClass)
MCArray | (MemoryClass)
MCDeletedChainActive | (MemoryClass)
MCDeletedChainInactive | (MemoryClass)
MCLimit | (MemoryClass)

compareTo int TypeHandle::compare_to(TypeHandle const &other) const; Description: 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 void TypeHandle::dec_memory_usage(TypeHandle::MemoryClass memory_class, int size); Undocumented function.

getBestParentFromSet int TypeHandle::get_best_parent_from_Set(set< int > const &legal_vals) const; Description: Return the Index of the BEst fit Classs from a set

getChildClass TypeHandle TypeHandle::get_child_class(int index) const; Description: Returns the nth child class of this type. The index should be in the range 0 <= index < get_num_child_classes().

getHash unsigned int TypeHandle::get_hash(void) const; Description: Returns a hash code suitable for phash_map.

getIndex int TypeHandle::get_index(void) const; Description: 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 int TypeHandle::get_memory_usage(TypeHandle::MemoryClass memory_class) const; Undocumented function.

getName string TypeHandle::get_name(TypedObject *object = ((TypedObject *)((void *)(0)))) const; Description: 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 int TypeHandle::get_num_child_classes(TypedObject *object = ((TypedObject *)((void *)(0)))) const; Description: 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 int TypeHandle::get_num_parent_classes(TypedObject *object = ((TypedObject *)((void *)(0)))) const; Description: 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 TypeHandle TypeHandle::get_parent_class(int index) const; Description: Returns the nth parent class of this type. The index should be in the range 0 <= index < get_num_parent_classes().

getParentTowards TypeHandle TypeHandle::get_parent_towards(TypeHandle ancestor, TypedObject *object = ((TypedObject *)((void *)(0)))) const; Description: 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 void TypeHandle::inc_memory_usage(TypeHandle::MemoryClass memory_class, int size); Undocumented function.

isDerivedFrom bool TypeHandle::is_derived_from(TypeHandle parent, TypedObject *object = ((TypedObject *)((void *)(0)))) const; Description: 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.

none static TypeHandle TypeHandle::none(void); Description: Returns a special zero-valued TypeHandle that is used to indicate no type.

operator != bool TypeHandle::operator !=(TypeHandle const &other) const; Description:

operator < bool TypeHandle::operator <(TypeHandle const &other) const; Description:

operator <= bool TypeHandle::operator <=(TypeHandle const &other) const; Description:

operator == bool TypeHandle::operator ==(TypeHandle const &other) const; Description:

operator > bool TypeHandle::operator >(TypeHandle const &other) const; Description:

operator >= bool TypeHandle::operator >=(TypeHandle const &other) const; Description:

output void TypeHandle::output(ostream &out) const; Description: