Panda3D

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