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