forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypedObject.I
More file actions
68 lines (62 loc) · 1.7 KB
/
typedObject.I
File metadata and controls
68 lines (62 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file typedObject.I
* @author drose
* @date 2001-05-11
*/
/**
* Returns the internal index number associated with this object's TypeHandle,
* a unique number for each different type. This is equivalent to
* get_type().get_index().
*/
INLINE int TypedObject::
get_type_index() const {
return get_type().get_index();
}
/**
* Returns true if the current object is or derives from the indicated type.
*/
INLINE bool TypedObject::
is_of_type(TypeHandle handle) const {
// Shortcut for the common case where the type matches exactly.
TypeHandle my_type = get_type();
return handle == my_type || my_type.is_derived_from(handle, (TypedObject *)this);
}
/**
* Returns true if the current object is the indicated type exactly.
*/
INLINE bool TypedObject::
is_exact_type(TypeHandle handle) const {
#ifndef NDEBUG
// Call get_name() to force the type to look itself up if necessary.
get_type().get_name((TypedObject *)this);
#endif
return get_type() == handle;
}
/**
*
*/
INLINE int TypedObject::
get_best_parent_from_Set(const std::set<int> &inset) const {
return get_type().get_best_parent_from_Set(inset);
}
/**
* Returns the object, upcast (if necessary) to a TypedObject pointer.
*/
INLINE TypedObject *TypedObject::
as_typed_object() {
return this;
}
/**
* Returns the object, upcast (if necessary) to a TypedObject pointer.
*/
INLINE const TypedObject *TypedObject::
as_typed_object() const {
return this;
}