00001 // Filename: pset.h 00002 // Created by: drose (05Jun01) 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 PSET_H 00020 #define PSET_H 00021 00022 #include "dtoolbase.h" 00023 #include "pallocator.h" 00024 00025 #include <set> 00026 00027 #ifdef NO_STYLE_ALLOCATOR 00028 // If we're not using custom allocators, just use the standard class 00029 // definition. 00030 #define pset set 00031 #define pmultiset multiset 00032 #else 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : pset 00036 // Description : This is our own Panda specialization on the default 00037 // STL set. Its main purpose is to call the hooks 00038 // for MemoryUsage to properly track STL-allocated 00039 // memory. 00040 //////////////////////////////////////////////////////////////////// 00041 template<class Key, class Compare = less<Key> > 00042 class pset : public set<Key, Compare, pallocator<Key> > { 00043 public: 00044 pset() : set<Key, Compare, pallocator<Key> >() { } 00045 pset(const pset<Key, Compare> ©) : set<Key, Compare, pallocator<Key> >(copy) { } 00046 pset(const Compare &comp) : set<Key, Compare, pallocator<Key> >(comp) { } 00047 }; 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Class : pmultiset 00051 // Description : This is our own Panda specialization on the default 00052 // STL multiset. Its main purpose is to call the hooks 00053 // for MemoryUsage to properly track STL-allocated 00054 // memory. 00055 //////////////////////////////////////////////////////////////////// 00056 template<class Key, class Compare = less<Key> > 00057 class pmultiset : public multiset<Key, Compare, pallocator<Key> > { 00058 public: 00059 pmultiset() : multiset<Key, Compare, pallocator<Key> >() { } 00060 pmultiset(const pmultiset<Key, Compare> ©) : multiset<Key, Compare, pallocator<Key> >(copy) { } 00061 pmultiset(const Compare &comp) : multiset<Key, Compare, pallocator<Key> >(comp) { } 00062 }; 00063 00064 #endif // NO_STYLE_ALLOCATOR 00065 #endif