46 template<
typename datatype>
inline datatype*
ptr(
int offset = 0) {
47 return static_cast<datatype*
>(
alignAddr) + offset;
50 template<
typename datatype>
inline const datatype*
ptr(
int offset = 0)
const {
51 return static_cast<const datatype*
>(
alignAddr) + offset;
54 template<
typename datatype>
inline datatype&
at(
int offset) {
55 return *(
static_cast<datatype*
>(
alignAddr) + offset);
58 template<
typename datatype>
inline const datatype&
at(
int offset)
const {
59 return *(
static_cast<datatype*
>(
alignAddr) + offset);
62 inline unsigned char operator[](
int offset)
const {
return at<unsigned char>(offset); }
64 inline operator bool()
const {
return rawAddr !=
nullptr; }
79 static uint64_t
total();
void free()
Frees the allocated memory.
const void * operator()() const
unsigned char operator[](int offset) const
datatype * ptr(int offset=0)
static uint64_t available()
Returns the size of available (free) operating memory in bytes.
AlignedMemory & operator=(AlignedMemory &&)
const datatype & at(int offset) const
datatype & at(int offset)
static const size_t DEFAULT_ALIGNMENT
default number of bytes to align the address
const datatype * ptr(int offset=0) const
static uint64_t total()
Returns the size of total operating memory in bytes.
AlignedMemory(const AlignedMemory &)=delete