52 #ifndef __PCL_Allocator_h
53 #define __PCL_Allocator_h
58 #include <pcl/Diagnostics.h>
130 template <
class T,
class A>
165 PCL_PRECONDITION( n+extra > 0 )
166 return (T*)this->AllocateBlock( n*
sizeof( T )+extra );
179 PCL_PRECONDITION( p !=
nullptr )
180 this->DeallocateBlock( (
void*)p );
190 return A::MaxSize()/
sizeof( T );
208 return A::BlockSize( n*
sizeof( T ) )/
sizeof( T );
229 return A::ReallocatedBlockSize( currentLength*
sizeof( T ), newLength*
sizeof( T ) )/
sizeof( T );
247 template <
class T,
class A>
inline void Construct( T* p, A& a )
249 PCL_PRECONDITION( p !=
nullptr )
250 new( (
void*)p, a )T();
260 template <
class T,
class T1,
class A>
inline void Construct( T* p,
const T1& v, A& a )
262 PCL_PRECONDITION( p !=
nullptr )
263 new( (
void*)p, a )T( v );
267 # pragma warning( push )
268 # pragma warning( disable : 4100 )
277 template <
class T>
inline void Destroy( T* p )
279 PCL_PRECONDITION( p !=
nullptr )
289 template <
class T>
inline void Destroy( T* p, T* q )
291 PCL_PRECONDITION( p !=
nullptr && q !=
nullptr )
297 # pragma warning( pop )
300 inline void Destroy(
void* ) {}
301 inline void Destroy(
void*,
void* ) {}
303 inline void Destroy(
bool* ) {}
304 inline void Destroy(
bool*,
bool* ) {}
306 inline void Destroy(
signed char* ) {}
307 inline void Destroy(
signed char*,
signed char* ) {}
309 inline void Destroy(
unsigned char* ) {}
310 inline void Destroy(
unsigned char*,
unsigned char* ) {}
312 inline void Destroy(
wchar_t* ) {}
313 inline void Destroy(
wchar_t*,
wchar_t* ) {}
315 inline void Destroy( char16_t* ) {}
316 inline void Destroy( char16_t*, char16_t* ) {}
318 inline void Destroy( char32_t* ) {}
319 inline void Destroy( char32_t*, char32_t* ) {}
321 inline void Destroy(
signed int* ) {}
322 inline void Destroy(
signed int*,
signed int* ) {}
324 inline void Destroy(
unsigned int* ) {}
325 inline void Destroy(
unsigned int*,
unsigned int* ) {}
327 inline void Destroy(
signed short* ) {}
328 inline void Destroy(
signed short*,
signed short* ) {}
330 inline void Destroy(
unsigned short* ) {}
331 inline void Destroy(
unsigned short*,
unsigned short* ) {}
333 inline void Destroy(
signed long* ) {}
334 inline void Destroy(
signed long*,
signed long* ) {}
336 inline void Destroy(
unsigned long* ) {}
337 inline void Destroy(
unsigned long*,
unsigned long* ) {}
339 inline void Destroy(
signed long long* ) {}
340 inline void Destroy(
signed long long*,
signed long long* ) {}
342 inline void Destroy(
unsigned long long* ) {}
343 inline void Destroy(
unsigned long long*,
unsigned long long* ) {}
345 inline void Destroy(
float* ) {}
346 inline void Destroy(
float*,
float* ) {}
348 inline void Destroy(
double* ) {}
349 inline void Destroy(
double*,
double* ) {}
351 inline void Destroy(
long double* ) {}
352 inline void Destroy(
long double*,
long double* ) {}
354 inline void Destroy(
void** ) {}
355 inline void Destroy(
void**,
void** ) {}
357 inline void Destroy(
bool** ) {}
358 inline void Destroy(
bool**,
bool** ) {}
360 inline void Destroy(
signed char** ) {}
361 inline void Destroy(
signed char**,
signed char** ) {}
363 inline void Destroy(
unsigned char** ) {}
364 inline void Destroy(
unsigned char**,
unsigned char** ) {}
366 inline void Destroy(
wchar_t** ) {}
367 inline void Destroy(
wchar_t**,
wchar_t** ) {}
369 inline void Destroy(
signed int** ) {}
370 inline void Destroy(
signed int**,
signed int** ) {}
372 inline void Destroy(
unsigned int** ) {}
373 inline void Destroy(
unsigned int**,
unsigned int** ) {}
375 inline void Destroy(
signed short** ) {}
376 inline void Destroy(
signed short**,
signed short** ) {}
378 inline void Destroy(
unsigned short** ) {}
379 inline void Destroy(
unsigned short**,
unsigned short** ) {}
381 inline void Destroy(
signed long** ) {}
382 inline void Destroy(
signed long**,
signed long** ) {}
384 inline void Destroy(
unsigned long** ) {}
385 inline void Destroy(
unsigned long**,
unsigned long** ) {}
387 inline void Destroy(
signed long long** ) {}
388 inline void Destroy(
signed long long**,
signed long long** ) {}
390 inline void Destroy(
unsigned long long** ) {}
391 inline void Destroy(
unsigned long long**,
unsigned long long** ) {}
393 inline void Destroy(
float** ) {}
394 inline void Destroy(
float**,
float** ) {}
396 inline void Destroy(
double** ) {}
397 inline void Destroy(
double**,
double** ) {}
399 inline void Destroy(
long double** ) {}
400 inline void Destroy(
long double**,
long double** ) {}
Provides memory allocation for PCL containers.
size_type MaxLength() const
Allocator(const Allocator< T, A > &)=default
size_type ReallocatedLength(size_type currentLength, size_type newLength) const
size_type PagedLength(size_type n) const
void Construct(T *p, A &a)