It override the behavior if size() More...
It override the behavior if size()
On normal memory like HeapMemory if you try to use resize to shrink the memory, nothing happen and size() return the old size. In case of BMemory<HeapMemory> if you try to shrink still the memory is not shrinked, but size() return the shrinked size. This gives a "feeling" of shrinkage. The real internal size can be retrieved with msize(). When we use resize to increase the memory size the behaviour remain the same as normal HeapMemory.
Definition at line 46 of file BHeapMemory.hpp.
#include <BHeapMemory.hpp>
Public Member Functions | |
BMemory (const BMemory< Memory > &mem) | |
Copy the Heap memory. | |
BMemory (BMemory< Memory > &&mem) noexcept | |
Copy the Heap memory. | |
BMemory () | |
Constructor, we choose a default alignment of 32 for avx. | |
virtual | ~BMemory () noexcept |
Destructor. | |
virtual bool | allocate (size_t sz) |
allocate the memory | |
virtual bool | resize (size_t sz) |
Resize the allocated memory. | |
virtual size_t | size () const |
Resize the buffer size. | |
size_t | msize () |
Return the memory size. | |
BMemory & | operator= (const BMemory< Memory > &mem) |
Copy the memory. | |
BMemory & | operator= (BMemory< Memory > &&mem) |
Copy the memory. | |
void | destroy () |
Destroy the internal memory. | |
void | swap (BMemory< Memory > &mem) |
swap the two memory object | |
Private Attributes | |
size_t | buf_sz |
size of the memory | |
Constructor, we choose a default alignment of 32 for avx.
Definition at line 74 of file BHeapMemory.hpp.
Destructor.
Definition at line 79 of file BHeapMemory.hpp.
|
inlinevirtual |
allocate the memory
Resize the allocated memory, if request is smaller than the allocated memory is not resized
sz | size |
Definition at line 92 of file BHeapMemory.hpp.
|
inline |
Destroy the internal memory.
Definition at line 177 of file BHeapMemory.hpp.
|
inline |
Return the memory size.
Definition at line 138 of file BHeapMemory.hpp.
|
inline |
Copy the memory.
mem | memory to copy |
Definition at line 165 of file BHeapMemory.hpp.
|
inline |
Copy the memory.
mem | memory to copy |
Definition at line 150 of file BHeapMemory.hpp.
|
inlinevirtual |
Resize the allocated memory.
Resize the allocated memory, if request is smaller than the allocated memory is not resized
sz | size |
Definition at line 111 of file BHeapMemory.hpp.
|
inlinevirtual |
swap the two memory object
mem | Memory to swap with |
Definition at line 188 of file BHeapMemory.hpp.
|
private |
size of the memory
Definition at line 49 of file BHeapMemory.hpp.