17INLINE
bool TypeHandle::
19 return (_index == other._index);
25INLINE
bool TypeHandle::
27 return (_index != other._index);
33INLINE
bool TypeHandle::
35 return (_index < other._index);
41INLINE
bool TypeHandle::
43 return (_index <= other._index);
49INLINE
bool TypeHandle::
51 return (_index > other._index);
57INLINE
bool TypeHandle::
59 return (_index >= other._index);
69 return _index - other._index;
77 return (
size_t)_index;
89 if ((*
this) == TypeHandle::none()) {
189INLINE
void TypeHandle::
190output(std::ostream &out)
const {
198operator bool ()
const {
199 return (_index != 0);
206constexpr TypeHandle::
207TypeHandle(
int index) : _index(index) {
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.
get_parent_class
Returns the nth parent class of this type.
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.
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.
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.).
TypeHandle get_parent_class(TypeHandle child, int index) const
Returns the nth parent class of this type.
TypeHandle get_child_class(TypeHandle child, int index) const
Returns the nth child class of this type.
bool is_derived_from(TypeHandle child, TypeHandle base, TypedObject *child_object)
Returns true if the first type is derived from the second type, false otherwise.
static TypeRegistry * ptr()
Returns the pointer to the global TypeRegistry object.
int get_num_child_classes(TypeHandle child, TypedObject *child_object) const
Returns the number of child classes that the indicated type is known to have.
std::string get_name(TypeHandle type, TypedObject *object) const
Returns the name of the indicated type.
TypeHandle get_parent_towards(TypeHandle child, TypeHandle base, TypedObject *child_object)
Returns the parent of the indicated child class that is in a direct line of inheritance to the indica...
int get_num_parent_classes(TypeHandle child, TypedObject *child_object) const
Returns the number of parent classes that the indicated type is known to have.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...