33 #ifndef _MEM_BLOCK_HPP_ 34 #define _MEM_BLOCK_HPP_ 62 inline block (
size_t dim,
void *ptr);
82 static const size_t SIZE = S;
85 inline char *get_ptr (
void);
86 inline const char *get_read_ptr ()
const;
102 using alloc_func = std::function<void (block &b, size_t size)>;
131 const block &get_block ()
const;
133 char *get_ptr ()
const;
134 size_t get_size ()
const;
136 void reserve (
size_t size);
140 void allocate (
block &b,
size_t size);
141 void deallocate (
block &b);
169 inline void extend_by (
size_t additional_bytes);
170 inline void extend_to (
size_t total_bytes);
171 inline void freemem ();
173 inline char *get_ptr ();
174 inline const char *get_read_ptr ()
const;
176 inline std::size_t get_size ()
const;
178 inline char *release_ptr ();
197 inline void extend_by (
size_t additional_bytes);
198 inline void extend_to (
size_t total_bytes);
200 inline char *get_ptr ();
201 inline const char *get_read_ptr ()
const;
219 template <
typename T>
223 std::uintptr_t pt = (std::uintptr_t) ptr;
310 b.m_block.ptr =
NULL;
329 b.m_block.ptr =
NULL;
426 if (total_bytes <=
m_stack.SIZE)
449 #endif // _MEM_BLOCK_HPP_ void extend_by(size_t additional_bytes)
const block_allocator CSTYLE_BLOCK_ALLOCATOR
block_allocator m_allocator
void extend_to(size_t total_bytes)
std::function< void(block &b)> dealloc_func
const char * get_read_ptr() const
const block_allocator STANDARD_BLOCK_ALLOCATOR
std::size_t get_size() const
extensible_block m_ext_block
const block_allocator & m_base_allocator
extensible_block & operator=(extensible_block &&b)
std::function< void(block &b, size_t size)> alloc_func
const char * get_read_ptr() const
void extend_by(size_t additional_bytes)
const block_allocator * m_allocator
block & operator=(block &&b)
const size_t DEFAULT_ALIGNMENT
void extend_to(size_t total_bytes)
const block_allocator EXPONENTIAL_STANDARD_BLOCK_ALLOCATOR
const char * get_read_ptr() const