#include <record.h>
Public Member Functions | |
const T * | getData () const |
Get the pointer to the struct. | |
T * | getData () |
Get the pointer to the struct. | |
operator const T * () const | |
Cast to the pointer of the struct. | |
operator const uint8_t * () const | |
Cast operator. | |
operator T * () | |
Cast to the pointer of the struct. | |
operator uint8_t * () | |
Cast operator. | |
const Record< T > & | operator= (const BDBuffer &bdb) throw (YAPETException) |
Assignment operator. | |
const Record< T > & | operator= (const T *r) throw (YAPETException) |
Assignment operator. | |
const Record< T > & | operator= (const T &r) throw (YAPETException) |
Assignment operator. | |
const Record< T > & | operator= (const Record< T > &r) throw (YAPETException) |
Assignment operator. | |
Record (const Record< T > &r) throw (YAPETException) | |
Record () throw (YAPETException) | |
Allocates memory to hold a struct of the type T . | |
Record (const T &d) throw (YAPETException) | |
Allocates memory. | |
uint32_t | size () const |
Get the size of the allocated memory. | |
virtual | ~Record () |
Private Member Functions | |
void | alloc_mem () throw (YAPETException) |
Allocate memory for the struct. | |
void | free_mem () |
Zero out and free memory. | |
Private Attributes | |
uint32_t | _size |
The size of the memory allocated. | |
T * | data |
Pointer to the struct. |
The template allocates enough memory on the heap for holding the struct of type T
.
It allows direct manipulation of the struct on the heap.
Definition at line 60 of file record.h.
YAPET::Record< T >::Record | ( | const T & | d | ) | throw (YAPETException) [inline] |
Allocates memory of the proper size and copies the content of the given struct d
.
d | reference to the struct from where the content is copied to the allocated memory. |
YAPET::Record< T >::Record | ( | ) | throw (YAPETException) [inline] |
Allocates memory to hold a struct of the type T
.
YAPET::Record< T >::Record | ( | const Record< T > & | r | ) | throw (YAPETException) [inline] |
virtual YAPET::Record< T >::~Record | ( | ) | [inline, virtual] |
void YAPET::Record< T >::alloc_mem | ( | ) | throw (YAPETException) [inline, private] |
Allocates the proper amount of memory for holding the struct and sets the _size
field.
Definition at line 82 of file record.h.
References YAPET::Record< T >::_size, and YAPET::Record< T >::data.
Referenced by YAPET::Record< T >::operator=().
void YAPET::Record< T >::free_mem | ( | ) | [inline, private] |
Zero'es the memory out and frees it.
Definition at line 95 of file record.h.
References YAPET::Record< T >::_size, and YAPET::Record< T >::data.
Referenced by YAPET::Record< T >::operator=().
const T* YAPET::Record< T >::getData | ( | ) | const [inline] |
Gets the pointer to the struct on the heap.
Definition at line 156 of file record.h.
References YAPET::Record< T >::data.
T* YAPET::Record< T >::getData | ( | ) | [inline] |
Gets the pointer to the struct on the heap.
Definition at line 148 of file record.h.
References YAPET::Record< T >::data.
YAPET::Record< T >::operator const T * | ( | ) | const [inline] |
Cast to the pointer of the struct on the heap.
Definition at line 173 of file record.h.
References YAPET::Record< T >::data.
YAPET::Record< T >::operator const uint8_t * | ( | ) | const [inline] |
Cast operator used by the openssl functions.
Definition at line 191 of file record.h.
References YAPET::Record< T >::data.
YAPET::Record< T >::operator T * | ( | ) | [inline] |
Cast to the pointer of the struct on the heap.
Definition at line 165 of file record.h.
References YAPET::Record< T >::data.
YAPET::Record< T >::operator uint8_t * | ( | ) | [inline] |
Cast operator used by the openssl functions.
Definition at line 182 of file record.h.
References YAPET::Record< T >::data.
const Record<T>& YAPET::Record< T >::operator= | ( | const BDBuffer & | bdb | ) | throw (YAPETException) [inline] |
Assigns a BDBuffer
. If the size of the BDBuffer
is smaller than the size of the struct, an exception is thrown.
Only as much bytes as fit into struct are copied from the BDBuffer
.
bdb | reference to a BDBuffer . |
this
. Definition at line 264 of file record.h.
References YAPET::Record< T >::_size, YAPET::Record< T >::alloc_mem(), YAPET::Record< T >::data, and YAPET::Record< T >::free_mem().
const Record<T>& YAPET::Record< T >::operator= | ( | const T * | r | ) | throw (YAPETException) [inline] |
Assigns a struct of type T
to this
.
r | pointer to a struct of type T . |
this
. Definition at line 242 of file record.h.
References YAPET::Record< T >::_size, YAPET::Record< T >::alloc_mem(), YAPET::Record< T >::data, and YAPET::Record< T >::free_mem().
const Record<T>& YAPET::Record< T >::operator= | ( | const T & | r | ) | throw (YAPETException) [inline] |
Assigns a struct of type T
to this
.
r | reference to a struct of type T . |
this
. Definition at line 224 of file record.h.
References YAPET::Record< T >::_size, YAPET::Record< T >::alloc_mem(), YAPET::Record< T >::data, and YAPET::Record< T >::free_mem().
const Record<T>& YAPET::Record< T >::operator= | ( | const Record< T > & | r | ) | throw (YAPETException) [inline] |
Assigns another Record
to this
.
r | reference to a Record . |
this
. Definition at line 202 of file record.h.
References YAPET::Record< T >::alloc_mem(), YAPET::Record< T >::data, and YAPET::Record< T >::free_mem().
uint32_t YAPET::Record< T >::size | ( | ) | const [inline] |
Get the size of the allocated memory.
Definition at line 139 of file record.h.
References YAPET::Record< T >::_size.
uint32_t YAPET::Record< T >::_size [private] |
The size of the memory allocated. Used to zero out the memory used by the struct.
Definition at line 68 of file record.h.
Referenced by YAPET::Record< T >::alloc_mem(), YAPET::Record< T >::free_mem(), YAPET::Record< T >::operator=(), and YAPET::Record< T >::size().
T* YAPET::Record< T >::data [private] |
Pointer to the struct on the heap.
Definition at line 74 of file record.h.
Referenced by YAPET::Record< T >::alloc_mem(), YAPET::Record< T >::free_mem(), YAPET::Record< T >::getData(), YAPET::Record< T >::operator const T *(), YAPET::Record< T >::operator const uint8_t *(), YAPET::Record< T >::operator T *(), YAPET::Record< T >::operator uint8_t *(), and YAPET::Record< T >::operator=().