Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
nanoflann::PooledAllocator Class Reference

Detailed Description

Definition at line 457 of file nanoflann.hpp.

#include <mrpt/otherlibs/nanoflann/nanoflann.hpp>

Public Member Functions

 PooledAllocator (const size_t blocksize_=BLOCKSIZE)
 Default constructor. More...
 
 ~PooledAllocator ()
 Destructor. More...
 
void free_all ()
 Frees all allocated memory chunks. More...
 
void * malloc (const size_t req_size)
 Returns a pointer to a piece of new memory of the given size in bytes allocated from the pool. More...
 
template<typename T >
T * allocate (const size_t count=1)
 Allocates (using this pool) a generic type T. More...
 

Public Attributes

size_t usedMemory
 
size_t wastedMemory
 

Private Member Functions

void internal_init ()
 

Private Attributes

size_t remaining
 
void * base
 
void * loc
 
size_t blocksize
 

Constructor & Destructor Documentation

nanoflann::PooledAllocator::PooledAllocator ( const size_t  blocksize_ = BLOCKSIZE)
inline

Default constructor.

Initializes a new pool.

Definition at line 485 of file nanoflann.hpp.

nanoflann::PooledAllocator::~PooledAllocator ( )
inline

Destructor.

Frees all the memory allocated in this pool.

Definition at line 492 of file nanoflann.hpp.

Member Function Documentation

template<typename T >
T* nanoflann::PooledAllocator::allocate ( const size_t  count = 1)
inline

Allocates (using this pool) a generic type T.

Params: count = number of instances to allocate. Returns: pointer (of type T*) to memory buffer

Definition at line 564 of file nanoflann.hpp.

References nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::count.

Referenced by nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::divideTree(), and nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::load_tree().

void nanoflann::PooledAllocator::free_all ( )
inline

Frees all allocated memory chunks.

Definition at line 497 of file nanoflann.hpp.

Referenced by nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::freeIndex().

void nanoflann::PooledAllocator::internal_init ( )
inlineprivate

Definition at line 470 of file nanoflann.hpp.

void* nanoflann::PooledAllocator::malloc ( const size_t  req_size)
inline

Returns a pointer to a piece of new memory of the given size in bytes allocated from the pool.

Definition at line 511 of file nanoflann.hpp.

References nanoflann::BLOCKSIZE, mrpt::system::os::fprintf(), and nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::size().

Member Data Documentation

void* nanoflann::PooledAllocator::base
private

Definition at line 466 of file nanoflann.hpp.

size_t nanoflann::PooledAllocator::blocksize
private

Definition at line 468 of file nanoflann.hpp.

void* nanoflann::PooledAllocator::loc
private

Definition at line 467 of file nanoflann.hpp.

size_t nanoflann::PooledAllocator::remaining
private

Definition at line 465 of file nanoflann.hpp.

size_t nanoflann::PooledAllocator::usedMemory
size_t nanoflann::PooledAllocator::wastedMemory



Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN: at Sun Aug 14 23:58:29 UTC 2016