Utils for Input/Output operations of serializable objects.
More...
#include <SerialIO.h>
|
template<class SerialClass > |
void | write (std::string const &path, SerialClass const *object, bool fastCompression=true) |
|
template<typename SerialClass > |
SerialClass * | read (std::string const &path, bool const fastCompression=true) |
|
|
| SerialIO ()=default |
| Singleton constructor.
|
|
Utils for Input/Output operations of serializable objects.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
◆ getInstance()
Obtain the singleton instance of SerialIO. It will be instantiated iff no instance is available
- Returns
- Singleton instance of SerialIO
◆ handleArchiveException()
void SerialIO::handleArchiveException |
( |
std::string const & |
perpetrator, |
|
|
boost::archive::archive_exception & |
aex |
|
) |
| |
|
protected |
Handle given archive exception.
A detailed message for the exception will be built and logged as a warning
- Parameters
-
perpetrator | Name of the perpetrator where the archive exception occurred. Generally speaking, it will be the name of a method (i.e. "SerialIO::read") |
aex | Archive exception to be handled |
◆ read()
template<typename SerialClass >
SerialClass* SerialIO::read |
( |
std::string const & |
path, |
|
|
bool const |
fastCompression = true |
|
) |
| |
Read a serialized object and build corresponding instance from it.
- Template Parameters
-
SerialClass | Specify the serializable type to use |
- Parameters
-
path | Path to read the serialized object from |
fastCompression | Specify if use the fast compression mode (true), which means the compression will be as fast as possible, or the best compression mode (false), which means the compression will lead to a size as small as possible at expenses of execution time. |
- Returns
- Instance built from serialized object file
◆ write()
template<class SerialClass >
void SerialIO::write |
( |
std::string const & |
path, |
|
|
SerialClass const * |
object, |
|
|
bool |
fastCompression = true |
|
) |
| |
Serialize an object and write it to a file.
- Template Parameters
-
SerialClass | Specify the serializable type to use |
- Parameters
-
path | Path to write the serialized object to |
object | Object to be serialized and stored |
fastCompression | Specify if use the fast compression mode (true), which means the compression will be as fast as possible, or the best compression mode (false), which means the compression will lead to a size as small as possible at expenses of execution time. |
The documentation for this class was generated from the following files:
- src/filems/serialization/SerialIO.h
- src/filems/serialization/SerialIO.cpp