Crypto++
8.8
Free C++ class library of cryptographic schemes
|
Static secure memory block with cleanup. More...
Public Types | |
typedef AllocatorBase< T >::value_type | value_type |
typedef AllocatorBase< T >::size_type | size_type |
typedef AllocatorBase< T >::difference_type | difference_type |
typedef AllocatorBase< T >::pointer | pointer |
typedef AllocatorBase< T >::const_pointer | const_pointer |
typedef AllocatorBase< T >::reference | reference |
typedef AllocatorBase< T >::const_reference | const_reference |
![]() | |
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 |
Public Member Functions | |
FixedSizeAllocatorWithCleanup () | |
Constructs a FixedSizeAllocatorWithCleanup. | |
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... | |
size_type | max_size () const |
![]() | |
pointer | address (reference r) const |
const_pointer | address (const_reference r) const |
void | construct (pointer p, const T &val) |
void | destroy (pointer p) |
size_type | max_size () const |
Returns the maximum number of elements the allocator can provide. More... | |
template<typename V , typename... Args> | |
void | construct (V *ptr, Args &&... args) |
Constructs a new V using variadic arguments. More... | |
template<typename V > | |
void | destroy (V *ptr) |
Destroys an V constructed with variadic arguments. More... | |
Additional Inherited Members | |
![]() | |
static const size_type | ELEMS_MAX = ... |
Returns the maximum number of elements the allocator can provide. More... | |
Static secure memory block with cleanup.
T | class or type |
S | fixed-size of the stack-based memory block, in elements |
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 354 of file secblock.h.
|
inline |
Allocates a block of memory.
size | the count elements in the memory block |
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 374 of file secblock.h.
|
inline |
Allocates a block of memory.
size | the count elements in the memory block |
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 400 of file secblock.h.
|
inline |
Deallocates a block of memory.
ptr | a pointer to the memory block to deallocate |
size | the count elements in the memory block |
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 421 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 461 of file secblock.h.