Panda3D
 All Classes Functions Variables Enumerations
memoryInfo.h
1 // Filename: memoryInfo.h
2 // Created by: drose (04Jun01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MEMORYINFO_H
16 #define MEMORYINFO_H
17 
18 #include "pandabase.h"
19 
20 #ifdef DO_MEMORY_USAGE
21 
22 #include "typeHandle.h"
23 
24 class ReferenceCount;
25 class TypedObject;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : MemoryInfo
29 // Description : This is a supporting class for MemoryUsage. It
30 // records the detailed information for a particular
31 // pointer allocated by Panda code. This record is only
32 // kept if track-mem-usage is configured #t.
33 //
34 // It's not exported from the DLL, and it doesn't even
35 // exist if we're compiling NDEBUG.
36 ////////////////////////////////////////////////////////////////////
37 class MemoryInfo {
38 public:
39  MemoryInfo();
40 
41 public:
42  // Members to view the MemoryInfo structure.
43  TypeHandle get_type();
44 
45  INLINE void *get_void_ptr() const;
46  INLINE ReferenceCount *get_ref_ptr() const;
47  INLINE TypedObject *get_typed_ptr() const;
48 
49  INLINE bool is_size_known() const;
50  INLINE size_t get_size() const;
51 
52  INLINE double get_time() const;
53 
54 private:
55  // Members to set up the MemoryInfo structure.
56  void determine_dynamic_type();
57  bool update_type_handle(TypeHandle &destination, TypeHandle refined);
58 
59 private:
60  enum Flags {
61  F_size_known = 0x0001,
62  F_reconsider_dynamic_type = 0x0002,
63  };
64 
65  void *_void_ptr;
66  ReferenceCount *_ref_ptr;
67  TypedObject *_typed_ptr;
68  size_t _size;
69  TypeHandle _static_type;
70  TypeHandle _dynamic_type;
71  int _flags;
72 
73  double _time;
74  int _freeze_index;
75 
76  friend class MemoryUsage;
77 };
78 
79 #include "memoryInfo.I"
80 
81 #endif // DO_MEMORY_USAGE
82 
83 #endif
84 
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:98
A base class for all things that want to be reference-counted.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85