21 #ifndef SELDON_FILE_ALLOCATOR_INLINE_CXX
23 #include "Allocator.hxx"
35 inline typename MallocAlloc<T>::pointer
36 MallocAlloc<T>::allocate(
size_t num,
void* h)
38 return static_cast<pointer
>( malloc(num *
sizeof(T)) );
42 inline void MallocAlloc<T>::deallocate(pointer data,
size_t num,
void* h)
48 inline void* MallocAlloc<T>::reallocate(pointer data,
size_t num,
void* h)
50 return realloc(
reinterpret_cast<void*
>(data), num *
sizeof(T));
54 inline void MallocAlloc<T>::memoryset(pointer data,
char c,
size_t num)
56 memset(
reinterpret_cast<void*
>(data), c, num);
61 MallocAlloc<T>::memorycpy(pointer datat, pointer datas,
size_t num)
63 memcpy(
reinterpret_cast<void*
>(datat),
reinterpret_cast<void*
>(datas),
74 inline typename CallocAlloc<T>::pointer
75 CallocAlloc<T>::allocate(
size_t num,
void* h)
77 return static_cast<pointer
>( calloc(num,
sizeof(T)) );
81 inline void CallocAlloc<T>::deallocate(pointer data,
size_t num,
void* h)
87 inline void* CallocAlloc<T>::reallocate(pointer data,
size_t num,
void* h)
89 return realloc(
reinterpret_cast<void*
>(data), num *
sizeof(T));
93 inline void CallocAlloc<T>::memoryset(pointer data,
char c,
size_t num)
95 memset(
reinterpret_cast<void*
>(data), c, num);
100 CallocAlloc<T>::memorycpy(pointer datat, pointer datas,
size_t num)
102 memcpy(
reinterpret_cast<void*
>(datat),
reinterpret_cast<void*
>(datas),
113 inline typename NewAlloc<T>::pointer
114 NewAlloc<T>::allocate(
size_t num,
void* h)
116 return static_cast<pointer
>(
new T[num]);
120 inline void NewAlloc<T>::deallocate(pointer data,
size_t num,
void* h)
126 inline void* NewAlloc<T>::reallocate(pointer data,
size_t num,
void* h)
135 inline void NewAlloc<T>::memoryset(pointer data,
char c,
size_t num)
137 memset(
reinterpret_cast<void*
>(data), c, num);
142 NewAlloc<T>::memorycpy(pointer datat, pointer datas,
size_t num)
144 for (
size_t i = 0; i < num; i++)
155 inline void NaNAlloc<T>::deallocate(pointer data,
size_t num,
void* h)
161 inline void NaNAlloc<T>::memoryset(pointer data,
char c,
size_t num)
163 memset(
reinterpret_cast<void*
>(data), c, num);
168 NaNAlloc<T>::memorycpy(pointer datat, pointer datas,
size_t num)
170 memcpy(
reinterpret_cast<void*
>(datat),
reinterpret_cast<void*
>(datas),
177 #define SELDON_FILE_ALLOCATOR_INLINE_CXX