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