Panda3D

pdeque.h

00001 // Filename: pdeque.h
00002 // Created by:  drose (05Jun01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PDEQUE_H
00016 #define PDEQUE_H
00017 
00018 #include "dtoolbase.h"
00019 #include "pallocator.h"
00020 #include "register_type.h"
00021 #include <deque>
00022 
00023 #ifndef USE_STL_ALLOCATOR
00024 // If we're not using custom allocators, just use the standard class
00025 // definition.
00026 #define pdeque deque 
00027 
00028 #else
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //       Class : pdeque
00032 // Description : This is our own Panda specialization on the default
00033 //               STL deque.  Its main purpose is to call the hooks
00034 //               for MemoryUsage to properly track STL-allocated
00035 //               memory.
00036 ////////////////////////////////////////////////////////////////////
00037 template<class Type>
00038 class pdeque : public deque<Type, pallocator_array<Type> > {
00039 public:
00040   typedef pallocator_array<Type> allocator;
00041   typedef TYPENAME deque<Type, allocator>::size_type size_type;
00042   pdeque(TypeHandle type_handle = pdeque_type_handle) : deque<Type, pallocator_array<Type> >(allocator(type_handle)) { }
00043   pdeque(const pdeque<Type> &copy) : deque<Type, pallocator_array<Type> >(copy) { }
00044   pdeque(size_type n, TypeHandle type_handle = pdeque_type_handle) : deque<Type, pallocator_array<Type> >(n, Type(), allocator(type_handle)) { }
00045   pdeque(size_type n, const Type &value, TypeHandle type_handle = pdeque_type_handle) : deque<Type, pallocator_array<Type> >(n, value, allocator(type_handle)) { }
00046 };
00047 
00048 #endif  // USE_STL_ALLOCATOR
00049 #endif
 All Classes Functions Variables Enumerations