SwatDB
|
#include <data.h>
Public Member Functions | |
Data ()=delete | |
Disable base constructor. | |
Data (const Data &other)=delete | |
Disable copy constructor. | |
Data & | operator= (const Data &other)=delete |
Disable copy assignment constructor. | |
Data (std::uint32_t size, const char *other_data) | |
Constructor with given char array and size. More... | |
Data (std::uint32_t size, std::uint32_t capacity) | |
Constructor with given size and capacity. More... | |
Data (std::uint32_t capacity) | |
Constructor with given capacity. More... | |
~Data () | |
Destructor. More... | |
char * | getData () |
Getter for data char array. More... | |
std::uint32_t | getSize () |
Getter for size. More... | |
void | setSize (std::uint32_t new_size) |
Setter for size. More... | |
std::uint32_t | getCapacity () |
Getter for capacity. More... | |
Private Attributes | |
char * | data |
std::uint32_t | size |
std::uint32_t | capacity |
SwatDB Data Class. Data a is class that allows storing and moving data of specified size in a more convenient way. A lot of times used as a serialized object that could be given structure by storing it as data member of another object with appropriate methods.
Data::Data | ( | std::uint32_t | size, |
const char * | other_data | ||
) |
Constructor with given char array and size.
Data::Data | ( | std::uint32_t | size, |
std::uint32_t | capacity | ||
) |
Constructor with given size and capacity.
InvalidSizeData | If size is greater than capacity. |
Data::Data | ( | std::uint32_t | capacity | ) |
Constructor with given capacity.
Data::~Data | ( | ) |
std::uint32_t Data::getCapacity | ( | ) |
char* Data::getData | ( | ) |
Getter for data char array.
std::uint32_t Data::getSize | ( | ) |
void Data::setSize | ( | std::uint32_t | new_size | ) |
Setter for size.
size | New size to be set to. |
InvalidSizeData | If new_size is greater than capacity. |
|
private |
The actual size of dynamically allocated data array.
|
private |
char* to dynamically allocated array that stores the data.
|
private |
Size in bytes up to which the data array is valid.