Template Class Malloc

Class Documentation

template<typename T>
class Mechatronix::Malloc

Allocate memory

Public Functions

explicit Malloc(string const&)

malloc object constructor

~Malloc()

malloc object destructor

void allocate(size_t n, char const *who)

allocate memory for n objects

void reallocate(size_t n, char const *who)

allocate memory for n objects

void hard_free(void)

free allocated memory

free memory

inline void free(void)

free memory

inline size_t size(void) const

number of objects allocated

inline T *operator()(size_t sz)

get the pointer of the preallocated elements. Update the internal pointer for reflect the use of sz elements. If no room for sz elements is available an error is issued.

T *realloc(size_t n, char const *who)

allocate and return pointer

T *malloc(size_t n, char const *who)

allocate and return pointer

inline T *begin()

return pointer the the begin on memory allocated

inline T *end()

return pointer to past to the last position of memory allocated

inline bool is_empty() const

check if memory is completely used

void must_be_empty() const

issue an error if memory is not completely used