Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Member Functions
pcl::poisson::Allocator< T > Class Template Reference

This templated class assists in memory allocation and is well suited for instances when it is known that the sequence of memory allocations is performed in a stack-based manner, so that memory allocated last is released first. More...

#include <pcl/surface/3rdparty/poisson4/allocator.h>

+ Inheritance diagram for pcl::poisson::Allocator< T >:

Public Member Functions

 Allocator (void)
 
 ~Allocator (void)
 
void reset (void)
 This method is the allocators destructor. More...
 
AllocatorState getState (void) const
 This method returns the memory state of the allocator. More...
 
void rollBack (void)
 This method rolls back the allocator so that it makes all of the memory previously allocated available for re-allocation. More...
 
void rollBack (const AllocatorState &state)
 This method rolls back the allocator to the previous memory state and makes all of the memory previously allocated available for re-allocation. More...
 
void set (int blockSize)
 This method initiallizes the constructor and the blockSize variable specifies the the number of objects that should be pre-allocated at a time. More...
 
T * newElements (int elements=1)
 This method returns a pointer to an array of elements objects. More...
 

Detailed Description

template<class T>
class pcl::poisson::Allocator< T >

This templated class assists in memory allocation and is well suited for instances when it is known that the sequence of memory allocations is performed in a stack-based manner, so that memory allocated last is released first.

It also preallocates memory in chunks so that multiple requests for small chunks of memory do not require separate system calls to the memory manager. The allocator is templated off of the class of objects that we would like it to allocate, ensuring that appropriate constructors and destructors are called as necessary.

Definition at line 50 of file allocator.h.

Constructor & Destructor Documentation

◆ Allocator()

template<class T >
pcl::poisson::Allocator< T >::Allocator ( void  )
inline

Definition at line 55 of file allocator.h.

◆ ~Allocator()

template<class T >
pcl::poisson::Allocator< T >::~Allocator ( void  )
inline

Definition at line 58 of file allocator.h.

References pcl::poisson::Allocator< T >::reset().

Member Function Documentation

◆ getState()

template<class T >
AllocatorState pcl::poisson::Allocator< T >::getState ( void  ) const
inline

This method returns the memory state of the allocator.

Definition at line 70 of file allocator.h.

◆ newElements()

template<class T >
T* pcl::poisson::Allocator< T >::newElements ( int  elements = 1)
inline

This method returns a pointer to an array of elements objects.

If there is left over pre-allocated memory, this method simply returns a pointer to the next free piece of memory, otherwise it pre-allocates more memory. Note that if the number of objects requested is larger than the value blockSize with which the allocator was initialized, the request for memory will fail.

Definition at line 142 of file allocator.h.

◆ reset()

template<class T >
void pcl::poisson::Allocator< T >::reset ( void  )
inline

This method is the allocators destructor.

It frees up any of the memory that it has allocated.

Definition at line 64 of file allocator.h.

Referenced by pcl::poisson::Allocator< T >::set(), and pcl::poisson::Allocator< T >::~Allocator().

◆ rollBack() [1/2]

template<class T >
void pcl::poisson::Allocator< T >::rollBack ( const AllocatorState state)
inline

This method rolls back the allocator to the previous memory state and makes all of the memory previously allocated available for re-allocation.

Note that it does it not call the constructor again, so after this method has been called, assumptions about the state of the values in memory are no longer valid.

Definition at line 98 of file allocator.h.

References pcl::poisson::AllocatorState::index, and pcl::poisson::AllocatorState::remains.

◆ rollBack() [2/2]

template<class T >
void pcl::poisson::Allocator< T >::rollBack ( void  )
inline

This method rolls back the allocator so that it makes all of the memory previously allocated available for re-allocation.

Note that it does it not call the constructor again, so after this method has been called, assumptions about the state of the values in memory are no longer valid.

Definition at line 82 of file allocator.h.

◆ set()

template<class T >
void pcl::poisson::Allocator< T >::set ( int  blockSize)
inline

This method initiallizes the constructor and the blockSize variable specifies the the number of objects that should be pre-allocated at a time.

Definition at line 130 of file allocator.h.

References pcl::poisson::Allocator< T >::reset().


The documentation for this class was generated from the following file: