Fabcoin Core
0.16.2
P2P Digital Currency
|
Static secure memory block with cleanup. More...
#include <secblock.h>
Public Member Functions | |
CRYPTOPP_INHERIT_ALLOCATOR_TYPES | FixedSizeAllocatorWithCleanup () |
Constructs a FixedSizeAllocatorWithCleanup. More... | |
pointer | allocate (size_type size) |
Allocates a block of memory. More... | |
pointer | allocate (size_type size, const void *hint) |
Allocates a block of memory. More... | |
void | deallocate (void *ptr, size_type size) |
Deallocates a block of memory. More... | |
pointer | reallocate (pointer oldPtr, size_type oldSize, size_type newSize, bool preserve) |
Reallocates a block of memory. More... | |
CRYPTOPP_CONSTEXPR size_type | max_size () const |
Public Member Functions inherited from AllocatorBase< T > | |
pointer | address (reference r) const |
const_pointer | address (const_reference r) const |
void | construct (pointer p, const T &val) |
void | destroy (pointer p) |
CRYPTOPP_CONSTEXPR size_type | max_size () const |
Returns the maximum number of elements the allocator can provide. More... | |
Private Member Functions | |
T * | GetAlignedArray () |
Private Attributes | |
CRYPTOPP_ALIGN_DATA(8) T m_array[(CRYPTOPP_BOOL_ALIGN16 &&T_Align16)?S+8/sizeof(T) A | m_fallbackAllocator |
bool | m_allocated |
Additional Inherited Members | |
Public Types inherited from AllocatorBase< T > | |
typedef T | value_type |
typedef size_t | size_type |
typedef std::ptrdiff_t | difference_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T & | reference |
typedef const T & | const_reference |
Static Protected Member Functions inherited from AllocatorBase< T > | |
static void | CheckSize (size_t size) |
Verifies the allocator can satisfy a request based on size. More... | |
Static secure memory block with cleanup.
T | class or type |
S | fixed-size of the stack-based memory block, in elements |
A | AllocatorBase derived class for allocation and cleanup |
FixedSizeAllocatorWithCleanup provides a fixed-size, stack- based allocation at compile time. The class can grow its memory block at runtime if a suitable allocator is available. If size grows beyond S and a suitable allocator is available, then the statically allocated array is obsoleted.
Definition at line 301 of file secblock.h.
|
inline |
Constructs a FixedSizeAllocatorWithCleanup.
Definition at line 307 of file secblock.h.
|
inline |
Allocates a block of memory.
size | size of the memory block, in elements |
FixedSizeAllocatorWithCleanup provides a fixed-size, stack-based allocation at compile time. If size is less than or equal to S
, then a pointer to the static array is returned.
The class can grow its memory block at runtime if a suitable allocator is available. If size grows beyond S and a suitable allocator is available, then the statically allocated array is obsoleted. If a suitable allocator is not available, as with a NullAllocator, then the function returns NULL and a runtime error eventually occurs.
Definition at line 321 of file secblock.h.
|
inline |
Allocates a block of memory.
size | size of the memory block, in elements |
hint | an unused hint |
FixedSizeAllocatorWithCleanup provides a fixed-size, stack- based allocation at compile time. If size is less than or equal to S, then a pointer to the static array is returned.
The class can grow its memory block at runtime if a suitable allocator is available. If size grows beyond S and a suitable allocator is available, then the statically allocated array is obsoleted. If a suitable allocator is not available, as with a NullAllocator, then the function returns NULL and a runtime error eventually occurs.
Definition at line 347 of file secblock.h.
|
inline |
Deallocates a block of memory.
ptr | a pointer to the memory block to deallocate |
size | size of the memory block, in elements |
The memory block is wiped or zeroized before deallocation. If the statically allocated memory block is active, then no additional actions are taken after the wipe.
If a dynamic memory block is active, then the pointer and size are passed to the allocator for deallocation.
Definition at line 366 of file secblock.h.
|
inlineprivate |
Definition at line 424 of file secblock.h.
|
inline |
Definition at line 416 of file secblock.h.
|
inline |
Reallocates a block of memory.
oldPtr | the previous allocation |
oldSize | the size of the previous allocation |
newSize | the new, requested size |
preserve | flag that indicates if the old allocation should be preserved |
FixedSizeAllocatorWithCleanup provides a fixed-size, stack- based allocation at compile time. If size is less than or equal to S, then a pointer to the static array is returned.
The class can grow its memory block at runtime if a suitable allocator is available. If size grows beyond S and a suitable allocator is available, then the statically allocated array is obsoleted. If a suitable allocator is not available, as with a NullAllocator, then the function returns NULL and a runtime error eventually occurs.
Definition at line 396 of file secblock.h.
|
private |
Definition at line 429 of file secblock.h.
|
private |
Definition at line 425 of file secblock.h.