00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PALLOCATOR_H
00016 #define PALLOCATOR_H
00017
00018 #include <memory>
00019 #include "dtoolbase.h"
00020 #include "memoryHook.h"
00021 #include "deletedChain.h"
00022 #include "typeHandle.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef USE_STL_ALLOCATOR
00041
00042
00043
00044 #define pallocator_single allocator
00045 #define pallocator_array allocator
00046
00047 #else
00048
00049 template<class Type>
00050 class pallocator_single : public allocator<Type> {
00051 public:
00052
00053
00054 typedef TYPENAME allocator<Type>::pointer pointer;
00055 typedef TYPENAME allocator<Type>::reference reference;
00056 typedef TYPENAME allocator<Type>::const_pointer const_pointer;
00057 typedef TYPENAME allocator<Type>::const_reference const_reference;
00058 typedef TYPENAME allocator<Type>::size_type size_type;
00059
00060 INLINE pallocator_single(TypeHandle type_handle) throw();
00061
00062
00063 template<class U>
00064 INLINE pallocator_single(const pallocator_single<U> ©) throw() :
00065 _type_handle(copy._type_handle) { }
00066
00067 INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
00068 INLINE void deallocate(pointer p, size_type n);
00069
00070 template<class U> struct rebind {
00071 typedef pallocator_single<U> other;
00072 };
00073
00074 TypeHandle _type_handle;
00075 };
00076
00077 template<class Type>
00078 class pallocator_array : public allocator<Type> {
00079 public:
00080
00081
00082 typedef TYPENAME allocator<Type>::pointer pointer;
00083 typedef TYPENAME allocator<Type>::reference reference;
00084 typedef TYPENAME allocator<Type>::const_pointer const_pointer;
00085 typedef TYPENAME allocator<Type>::const_reference const_reference;
00086 typedef TYPENAME allocator<Type>::size_type size_type;
00087
00088 INLINE pallocator_array(TypeHandle type_handle = TypeHandle::none()) throw();
00089
00090
00091 template<class U>
00092 INLINE pallocator_array(const pallocator_array<U> ©) throw() :
00093 _type_handle(copy._type_handle) { }
00094
00095 INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
00096 INLINE void deallocate(pointer p, size_type n);
00097
00098 template<class U> struct rebind {
00099 typedef pallocator_array<U> other;
00100 };
00101
00102 TypeHandle _type_handle;
00103 };
00104
00105 #include "pallocator.T"
00106
00107 #endif // USE_STL_ALLOCATOR
00108
00109 #endif
00110