00001 // Filename: memoryInfo.I 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: MemoryInfo::get_void_ptr 00022 // Access: Public 00023 // Description: Returns the data pointer as a void pointer. This 00024 // should always be non-NULL. 00025 //////////////////////////////////////////////////////////////////// 00026 void *MemoryInfo::get_void_ptr() const { 00027 return _void_ptr; 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: MemoryInfo::get_ref_ptr 00032 // Access: Public 00033 // Description: Returns the data pointer as a ReferenceCount pointer. 00034 // This may be NULL if the data pointer does not 00035 // represent a ReferenceCount object. 00036 //////////////////////////////////////////////////////////////////// 00037 ReferenceCount *MemoryInfo::get_ref_ptr() const { 00038 return _ref_ptr; 00039 } 00040 00041 //////////////////////////////////////////////////////////////////// 00042 // Function: MemoryInfo::get_typed_ptr 00043 // Access: Public 00044 // Description: Returns the data pointer as a TypedObject pointer. 00045 // This may be NULL if the data pointer does not 00046 // represent a pointer to a TypedObject. 00047 //////////////////////////////////////////////////////////////////// 00048 TypedObject *MemoryInfo::get_typed_ptr() const { 00049 return _typed_ptr; 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: MemoryInfo::is_size_known 00054 // Access: Public 00055 // Description: Returns true if the size of the memory block 00056 // referenced by this pointer is known. Most pointers' 00057 // sizes should be known, but some may not be. 00058 //////////////////////////////////////////////////////////////////// 00059 bool MemoryInfo::is_size_known() const { 00060 return (_flags & F_size_known) != 0; 00061 } 00062 00063 //////////////////////////////////////////////////////////////////// 00064 // Function: MemoryInfo::get_size 00065 // Access: Public 00066 // Description: Returns the size in bytes of the memory block 00067 // referenced by this pointer, if it is known. Returns 00068 // zero if the size is not known. 00069 //////////////////////////////////////////////////////////////////// 00070 size_t MemoryInfo::get_size() const { 00071 return _size; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: MemoryInfo::get_time 00076 // Access: Public 00077 // Description: Returns the time in seconds (based on the 00078 // GlobalClock) at which the pointer was allocated. 00079 //////////////////////////////////////////////////////////////////// 00080 double MemoryInfo::get_time() const { 00081 return _time; 00082 } 00083