Archive class.
More...
#include <Serialiser.h>
|
enum | Tags { kNone = 0
, kCompress = 1
, kRandomAccessCompress = 2
, kMultithread = 4
} |
|
|
| Archive () |
| Constructor.
|
|
| Archive (size_t len, size_t tag=kNone) |
| Constructor. More...
|
|
| ~Archive () |
| Destructor. More...
|
|
bool | writeToFile (const std::string &fileName) |
| Writes binary stream to a file. More...
|
|
bool | readFromFile (const std::string &fileName) |
| Reads a file and store inside the binary stream. More...
|
|
void | reset () |
| Resets the index pointer of the archive.
|
|
void | clear () |
| Clears the binary stream.
|
|
void | resize (size_t len) |
| Resize buffer.
|
|
std::string | encodeBase64 (bool compress=false) |
| Encode the binary stream in base 64. More...
|
|
bool | decodeBase64 (const std::string &stringValue) |
| Reads a base64 string and store inside the binary stream. More...
|
|
Archive class.
The Archive class is used to serialize or deserialize atoms objects.
◆ Archive()
AtomsCore::Archive::Archive |
( |
size_t |
len, |
|
|
size_t |
tag = kNone |
|
) |
| |
Constructor.
- Parameters
-
len | Lenght of the binary stream (in bytes) |
tag | Serialization options (can be used togheter):
- kMultithread: activate multithread serialization
- kCompress: activate lz4 compression on whole file
- kRandomAccessCompress: activate lz4 compression on single key-value
|
◆ ~Archive()
AtomsCore::Archive::~Archive |
( |
| ) |
|
Destructor.
If the autoDelete flag is on, the destructor deletes the stream buffer before destroying the object
◆ decodeBase64()
bool AtomsCore::Archive::decodeBase64 |
( |
const std::string & |
stringValue | ) |
|
Reads a base64 string and store inside the binary stream.
- Parameters
-
- Returns
- Return true if the string is read
◆ encodeBase64()
std::string AtomsCore::Archive::encodeBase64 |
( |
bool |
compress = false | ) |
|
Encode the binary stream in base 64.
- Parameters
-
- Returns
- Return the binary stream encoded in base 64
◆ readFromFile()
bool AtomsCore::Archive::readFromFile |
( |
const std::string & |
fileName | ) |
|
Reads a file and store inside the binary stream.
- Parameters
-
- Returns
- Return true if the file is read
◆ writeToFile()
bool AtomsCore::Archive::writeToFile |
( |
const std::string & |
fileName | ) |
|
Writes binary stream to a file.
- Parameters
-
- Returns
- Return true if the file is written
◆ autoDelete
bool AtomsCore::Archive::autoDelete |
Autodelete flag.
If this flag is true the binary stream is deleted by the destructor
◆ index
size_t AtomsCore::Archive::index |
Current binary stream index.
This store the current index used to read or write the binary stream
The documentation for this class was generated from the following file: