LILAC
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
mempool Class Reference

This provides a class to assisst with memory management. More...

#include <mempool.hpp>

Public Member Functions

template<class... Tl>
void create (size_t dim, Tl *restr *...args)
 Creates memory pool with alignment of 32 bytes.
template<class... Tl>
void create (size_t mal, size_t dim, Tl *restr *...args)
 Creates memory pool with specified alignment.
template<class... Tl>
void add (size_t mal, size_t dim, Tl *restr *...args)
template<class... Tl>
void add (size_t dim, Tl *restr *...args)
void set_dim (size_t num, size_t mal=32)
 Resets the dimension and alignment of the pool.
void clear ()
 Clears the memory pool and deallocates the memory.
 mempool ()
 ~mempool ()

Private Member Functions

template<class... Tl>
void make_this (size_t mal, size_t dim, Tl *restr *...args)
template<class... Tl>
void make_this (size_t dim, Tl *restr *...args)

Static Private Member Functions

static void _create (size_t al, char *v, char *en, std::list< size_t > sizes, std::list< size_t > vsizes, std::list< char * > &ptrl)

Private Attributes

char * izard
size_t total_bytes
std::list< size_t > csizes
std::list< size_t > vsizes
std::list< void ** > cptrs

Detailed Description

This provides a class to assisst with memory management.

This class helps with allocating memory for use in computations. It creates a list of pointers that are all aligned to a specified value and are near each other in memory

Definition at line 80 of file mempool.hpp.

Constructor & Destructor Documentation

mempool::mempool ( )

Definition at line 92 of file mempool.cpp.

mempool::~mempool ( )

Definition at line 94 of file mempool.cpp.

Member Function Documentation

void mempool::_create ( size_t  al,
char *  v,
char *  en,
std::list< size_t >  sizes,
std::list< size_t >  vsizes,
std::list< char * > &  ptrl 
)
staticprivate

Definition at line 57 of file mempool.cpp.

Here is the caller graph for this function:

template<class... Tl>
void mempool::add ( size_t  mal,
size_t  dim,
Tl *restr *...  args 
)

Adds new pointers to the memory pool, with an alignment of 32 bytes

Adds new pointers to the existing memory pool, with a dimension of dim. This can be different than the previous dimensions, and will not affect previously entered pointers

Note
pointers that were directly passes to the pool will still be valid, but others pointing to that memory will be invalidated as the memory is likely in a different position
Parameters
malThe alignment in bytes
dimThe dimension of each pointer
argsThe addresses of the pointers

Definition at line 203 of file mempool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class... Tl>
void mempool::add ( size_t  dim,
Tl *restr *...  args 
)
inline

Definition at line 127 of file mempool.hpp.

Here is the call graph for this function:

void mempool::clear ( )

Clears the memory pool and deallocates the memory.

Definition at line 81 of file mempool.cpp.

Here is the caller graph for this function:

template<class... Tl>
void mempool::create ( size_t  dim,
Tl *restr *...  args 
)
inline

Creates memory pool with alignment of 32 bytes.

Creates a memory pool with an alignment of 32 bytes, and sets each pointer to its respective position.

Parameters
dimthe length of each pointer
argsthe address of each pointer

Definition at line 105 of file mempool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class... Tl>
void mempool::create ( size_t  mal,
size_t  dim,
Tl *restr *...  args 
)
inline

Creates memory pool with specified alignment.

Creates a memory pool with specified alignment, and sets each pointer to its respective position.

Parameters
dimthe length of each pointer
argsthe address of each pointer
malThe alignment in bytes

Definition at line 117 of file mempool.hpp.

Here is the call graph for this function:

template<class... Tl>
void mempool::make_this ( size_t  mal,
size_t  dim,
Tl *restr *...  args 
)
private

Performs the creation of the memory pool, with alignment mal, length dim, and types Tl...

Parameters
malThe alignment in bytes
dimthe dimension of the pointers
argsthe addresses of each pointer

Definition at line 153 of file mempool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class... Tl>
void mempool::make_this ( size_t  dim,
Tl *restr *...  args 
)
inlineprivate

Definition at line 93 of file mempool.hpp.

Here is the call graph for this function:

void mempool::set_dim ( size_t  num,
size_t  mal = 32 
)

Resets the dimension and alignment of the pool.

Sets the dimension and alignment of each pointer in the memory pool

Parameters
numNew dimension of the memory pool
malAlignment of the pointers

Definition at line 19 of file mempool.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::list<void**> mempool::cptrs
private

Definition at line 89 of file mempool.hpp.

std::list<size_t> mempool::csizes
private

Definition at line 88 of file mempool.hpp.

char* mempool::izard
private

Charizard is the third evolution of flame pokemon charmander. Very powerful and difficult to tame. Also known for it's ability to store the raw memory used in memory pools

Definition at line 86 of file mempool.hpp.

size_t mempool::total_bytes
private

Definition at line 87 of file mempool.hpp.

std::list<size_t> mempool::vsizes
private

Definition at line 88 of file mempool.hpp.


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