00001 // Filename: pvector.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 PVECTOR_H 00020 #define PVECTOR_H 00021 00022 #include <vector> 00023 00024 #include "dtoolbase.h" 00025 #include "pallocator.h" 00026 00027 #ifdef NO_STYLE_ALLOCATOR 00028 // If we're not using custom allocators, just use the standard class 00029 // definition. 00030 #define pvector vector 00031 00032 #else 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : pvector 00036 // Description : This is our own Panda specialization on the default 00037 // STL vector. Its main purpose is to call the hooks 00038 // for MemoryUsage to properly track STL-allocated 00039 // memory. 00040 //////////////////////////////////////////////////////////////////// 00041 template<class Type> 00042 class pvector : public vector<Type, pallocator<Type> > { 00043 public: 00044 typedef TYPENAME vector<Type, pallocator<Type> >::size_type size_type; 00045 00046 pvector() : vector<Type, pallocator<Type> >() { } 00047 pvector(const pvector<Type> ©) : vector<Type, pallocator<Type> >(copy) { } 00048 pvector(size_type n) : vector<Type, pallocator<Type> >(n) { } 00049 pvector(size_type n, const Type &value) : vector<Type, pallocator<Type> >(n, value) { } 00050 pvector(const Type *begin, const Type *end) : vector<Type, pallocator<Type> >(begin, end) { } 00051 }; 00052 00053 #endif // NO_STYLE_ALLOCATOR 00054 #endif 00055