16 #ifdef DO_MEMORY_USAGE 30 _static_type = TypeHandle::none();
31 _dynamic_type = TypeHandle::none();
43 if ((_flags & F_reconsider_dynamic_type) == 0) {
44 if (_dynamic_type == TypeHandle::none()) {
55 determine_dynamic_type();
59 update_type_handle(type, _dynamic_type);
61 if (type != _static_type) {
62 if (express_cat.is_spam()) {
64 <<
"Pointer " << get_void_ptr() <<
" has static type " 65 << _static_type <<
" and dynamic type " << _dynamic_type <<
"\n";
77 determine_dynamic_type() {
78 if ((_flags & F_reconsider_dynamic_type) != 0 &&
79 _static_type != TypeHandle::none()) {
82 if (_typed_ptr ==
nullptr) {
85 if (_static_type.is_derived_from(TypedReferenceCount::get_class_type())) {
90 if (_typed_ptr !=
nullptr) {
96 if (got_type == TypeHandle::none()) {
98 <<
"Found an unregistered type in a " << _static_type
100 <<
"Check derived types of " << _static_type
101 <<
" and make sure that all are being initialized.\n";
102 _dynamic_type = _static_type;
103 _flags &= ~F_reconsider_dynamic_type;
106 nassert_raise(
"Unregistered type");
112 update_type_handle(_dynamic_type, got_type);
126 if (refined == TypeHandle::none()) {
128 <<
"Attempt to update type of " << get_void_ptr()
129 <<
"(type is " << get_type()
130 <<
") to an undefined type!\n";
132 }
else if (destination == refined) {
138 }
else if (destination == TypeHandle::none() ||
141 if (express_cat.is_spam()) {
143 <<
"Updating " << get_void_ptr() <<
" from type " 144 << destination <<
" to type " << refined <<
"\n";
146 destination = refined;
150 express_cat.warning()
151 <<
"Pointer " << get_void_ptr() <<
" previously indicated as type " 152 << destination <<
" is now type " << refined <<
"!\n";
159 #endif // DO_MEMORY_USAGE This is a convenience class to specialize ConfigVariable as a boolean type.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
bool is_derived_from(TypeHandle parent, TypedObject *object=nullptr) const
Returns true if this type is derived from the indicated type, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.