81class EXPCL_DTOOL_DTOOLBASE TypeHandle final {
83 TypeHandle()
noexcept =
default;
88 MC_deleted_chain_active,
89 MC_deleted_chain_inactive,
100 EXTENSION(
static TypeHandle make(PyTypeObject *classobj));
102 INLINE
bool operator == (
const TypeHandle &other)
const;
103 INLINE
bool operator != (
const TypeHandle &other)
const;
104 INLINE
bool operator < (
const TypeHandle &other)
const;
105 INLINE
bool operator <= (
const TypeHandle &other)
const;
106 INLINE
bool operator > (
const TypeHandle &other)
const;
107 INLINE
bool operator >= (
const TypeHandle &other)
const;
108 INLINE
int compare_to(
const TypeHandle &other)
const;
131 INLINE
void output(std::ostream &out)
const;
132 constexpr static TypeHandle none() {
return TypeHandle(0); }
133 INLINE
operator bool ()
const;
142 PyObject *get_python_type()
const;
145 void *
allocate_array(
size_t size) RETURNS_ALIGNED(MEMORY_HOOK_ALIGNMENT);
146 void *
reallocate_array(
void *ptr,
size_t size) RETURNS_ALIGNED(MEMORY_HOOK_ALIGNMENT);
149 constexpr static TypeHandle from_index(
int index) {
return TypeHandle(index); }
161INLINE std::ostream &operator << (std::ostream &out,
TypeHandle type) {
166EXPCL_DTOOL_DTOOLBASE std::ostream &operator << (std::ostream &out, TypeHandle::MemoryClass mem_class);
TypeHandle is the identifier used to differentiate C++ class types.
size_t get_hash() const
Returns a hash code suitable for phash_map.
get_num_child_classes
Returns the number of child classes that this type is known to have.
void dec_memory_usage(MemoryClass memory_class, size_t size)
Subtracts the indicated amount from the record for the total allocated memory for objects of this typ...
get_parent_class
Returns the nth parent class of this type.
size_t get_memory_usage(MemoryClass memory_class) const
Returns the total allocated memory used by objects of this type, for the indicated memory class.
get_child_class
Returns the nth child class of this type.
get_name
Returns the name of the type.
get_index
Returns the integer index associated with this TypeHandle.
void deallocate_array(void *ptr)
Deallocates memory, subtracting it from the total amount of memory allocated for this type.
bool is_derived_from(TypeHandle parent, TypedObject *object=nullptr) const
Returns true if this type is derived from the indicated type, false otherwise.
get_num_parent_classes
Returns the number of parent classes that this type is known to have.
int get_best_parent_from_Set(const std::set< int > &legal_vals) const
Return the Index of the BEst fit Classs from a set.
void * reallocate_array(void *ptr, size_t size)
Reallocates memory, adjusting the total amount of memory allocated for this type.
void inc_memory_usage(MemoryClass memory_class, size_t size)
Adds the indicated amount to the record for the total allocated memory for objects of this type.
TypeHandle get_parent_towards(TypeHandle ancestor, TypedObject *object=nullptr) const
Returns the parent class that is in a direct line of inheritance to the indicated ancestor class.
int compare_to(const TypeHandle &other) const
Sorts TypeHandles arbitrarily (according to <, >, etc.).
void * allocate_array(size_t size)
Allocates memory, adding it to the total amount of memory allocated for this type.
The TypeRegistry class maintains all the assigned TypeHandles in a given system.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.