Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/memoryInfo.h

Go to the documentation of this file.
00001 // Filename: memoryInfo.h
00002 // Created by:  drose (04Jun01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef MEMORYINFO_H
00020 #define MEMORYINFO_H
00021 
00022 #include "pandabase.h"
00023 
00024 #ifdef DO_MEMORY_USAGE
00025 
00026 #include "typeHandle.h"
00027 
00028 class ReferenceCount;
00029 class TypedObject;
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : MemoryInfo
00033 // Description : This is a supporting class for MemoryUsage.  It
00034 //               records the detailed information for a particular
00035 //               pointer allocated by Panda code.  This record is only
00036 //               kept if track-mem-usage is configured #t.
00037 //
00038 //               It's not exported from the DLL, and it doesn't even
00039 //               exist if we're compiling NDEBUG.
00040 ////////////////////////////////////////////////////////////////////
00041 class MemoryInfo {
00042 public:
00043   MemoryInfo();
00044 
00045 public:
00046   // Members to view the MemoryInfo structure.
00047   TypeHandle get_type();
00048 
00049   INLINE void *get_void_ptr() const;
00050   INLINE ReferenceCount *get_ref_ptr() const;
00051   INLINE TypedObject *get_typed_ptr() const;
00052 
00053   INLINE bool is_size_known() const;
00054   INLINE size_t get_size() const;
00055 
00056   INLINE double get_time() const;
00057 
00058 public:
00059   // Members to set up the MemoryInfo structure.
00060   void determine_dynamic_type();
00061   void update_type_handle(TypeHandle &destination, TypeHandle refined);
00062 
00063 private:
00064   enum Flags {
00065     F_got_ref                 = 0x0001,
00066     F_got_void                = 0x0002,
00067     F_size_known              = 0x0004,
00068     F_reconsider_dynamic_type = 0x0008,
00069   };
00070   
00071   void *_void_ptr;
00072   ReferenceCount *_ref_ptr;
00073   TypedObject *_typed_ptr;
00074   size_t _size;
00075   TypeHandle _static_type;
00076   TypeHandle _dynamic_type;
00077   int _flags;
00078   
00079   double _time;
00080   int _freeze_index;
00081 
00082   friend class MemoryUsage;
00083 };
00084 
00085 #include "memoryInfo.I"
00086 
00087 #endif  // DO_MEMORY_USAGE
00088 
00089 #endif
00090 

Generated on Fri May 2 00:38:24 2003 for Panda by doxygen1.3