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

panda/src/express/memoryUsagePointerCounts.I

Go to the documentation of this file.
00001 // Filename: memoryUsagePointerCounts.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: MemoryUsagePointerCounts::Constructor
00022 //       Access: Public
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE MemoryUsagePointerCounts::
00026 MemoryUsagePointerCounts() {
00027   _count = 0;
00028   _unknown_size_count = 0;
00029   _size = 0;
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: MemoryUsagePointerCounts::Copy Constructor
00034 //       Access: Public
00035 //  Description: 
00036 ////////////////////////////////////////////////////////////////////
00037 INLINE MemoryUsagePointerCounts::
00038 MemoryUsagePointerCounts(const MemoryUsagePointerCounts &copy) :
00039   _count(copy._count),
00040   _unknown_size_count(copy._unknown_size_count),
00041   _size(copy._size)
00042 {
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: MemoryUsagePointerCounts::Copy Assignment
00047 //       Access: Public
00048 //  Description: 
00049 ////////////////////////////////////////////////////////////////////
00050 INLINE void MemoryUsagePointerCounts::
00051 operator = (const MemoryUsagePointerCounts &copy) {
00052   _count = copy._count;
00053   _unknown_size_count = copy._unknown_size_count;
00054   _size = copy._size;
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //     Function: MemoryUsagePointerCounts::clear
00059 //       Access: Public
00060 //  Description: Resets the counter to empty.
00061 ////////////////////////////////////////////////////////////////////
00062 INLINE void MemoryUsagePointerCounts::
00063 clear() {
00064   _count = 0;
00065   _unknown_size_count = 0;
00066   _size = 0;
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: MemoryUsagePointerCounts::is_size_unknown
00071 //       Access: Public
00072 //  Description: Returns true if none of the pointers in the count
00073 //               have a known size, or false if at least one of them
00074 //               does.
00075 ////////////////////////////////////////////////////////////////////
00076 INLINE bool MemoryUsagePointerCounts::
00077 is_size_unknown() const {
00078   return _unknown_size_count == _count;
00079 }
00080 
00081 ////////////////////////////////////////////////////////////////////
00082 //     Function: MemoryUsagePointerCounts::get_size
00083 //       Access: Public
00084 //  Description: Returns the total allocated size of all pointers in
00085 //               the count whose size is known.
00086 ////////////////////////////////////////////////////////////////////
00087 INLINE size_t MemoryUsagePointerCounts::
00088 get_size() const {
00089   return _size;
00090 }
00091 
00092 ////////////////////////////////////////////////////////////////////
00093 //     Function: MemoryUsagePointerCounts::get_count
00094 //       Access: Public
00095 //  Description: Returns the total number of pointers in the count.
00096 ////////////////////////////////////////////////////////////////////
00097 INLINE int MemoryUsagePointerCounts::
00098 get_count() const {
00099   return _count;
00100 }
00101 
00102 ////////////////////////////////////////////////////////////////////
00103 //     Function: MemoryUsagePointerCounts::Ordering Operator
00104 //       Access: Public
00105 //  Description:
00106 ////////////////////////////////////////////////////////////////////
00107 INLINE bool MemoryUsagePointerCounts::
00108 operator < (const MemoryUsagePointerCounts &other) const {
00109   if (is_size_unknown() != other.is_size_unknown()) {
00110     return is_size_unknown() > other.is_size_unknown();
00111   }
00112 
00113   if (get_size() != other.get_size()) {
00114     return get_size() < other.get_size();
00115   }
00116 
00117   if (get_count() != other.get_count()) {
00118     return get_count() != other.get_count();
00119   }
00120 
00121   return false;
00122 }
00123 
00124 INLINE ostream &
00125 operator << (ostream &out, const MemoryUsagePointerCounts &c) {
00126   c.output(out);
00127   return out;
00128 }

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