15 #include "memoryUsagePointers.h"
17 #ifdef DO_MEMORY_USAGE
19 #include "config_express.h"
20 #include "referenceCount.h"
21 #include "typedReferenceCount.h"
29 MemoryUsagePointers() {
38 ~MemoryUsagePointers() {
46 int MemoryUsagePointers::
47 get_num_pointers()
const {
48 return _entries.size();
57 get_pointer(
int n)
const {
58 nassertr(n >= 0 && n < get_num_pointers(), NULL);
59 return _entries[n]._ref_ptr;
71 get_typed_pointer(
int n)
const {
72 nassertr(n >= 0 && n < get_num_pointers(), NULL);
109 get_type(
int n)
const {
111 return _entries[n]._type;
120 string MemoryUsagePointers::
121 get_type_name(
int n)
const {
122 nassertr(n >= 0 && n < get_num_pointers(),
"");
134 double MemoryUsagePointers::
135 get_age(
int n)
const {
136 nassertr(n >= 0 && n < get_num_pointers(), 0.0);
137 return _entries[n]._age;
145 void MemoryUsagePointers::
155 void MemoryUsagePointers::
156 output(ostream &out)
const {
157 out << _entries.size() <<
" pointers.";
166 void MemoryUsagePointers::
173 _entries.push_back(Entry(ref_ptr, typed_ptr, type, age));
178 #endif // DO_MEMORY_USAGE
bool is_derived_from(TypeHandle parent, TypedObject *object=(TypedObject *) NULL) const
Returns true if this type is derived from the indicated type, false otherwise.
static TypeHandle none()
Returns a special zero-valued TypeHandle that is used to indicate no type.
string get_name(TypedObject *object=(TypedObject *) NULL) const
Returns the name of the type.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
A base class for all things that want to be reference-counted.
TypeHandle is the identifier used to differentiate C++ class types.
int get_ref_count() const
Returns the current reference count.