Helios++
Helios software for LiDAR simulations
SerialIO.h
1 #pragma once
2 
3 
4 #include <boost/archive/archive_exception.hpp>
5 
6 #include <string>
7 
13 class SerialIO {
14 private:
15  // *** SINGLETON *** //
16  // ******************* //
20  static SerialIO * instance;
24  SerialIO() = default;
25 public:
26  // *** SINGLETON *** //
27  // ******************* //
33  static SerialIO * getInstance();
34 
35  virtual ~SerialIO() = default;
36 
37  // *** SERIAL IO METHODS *** //
38  // ************************* //
49  template<class SerialClass>
50  void write(
51  std::string const& path,
52  SerialClass const *object,
53  bool fastCompression=true
54  );
55 
66  template<typename SerialClass>
67  SerialClass * read(
68  std::string const& path,
69  bool const fastCompression=true
70  );
71 
72 protected:
73  // *** INNER UTIL METHODS *** //
74  // **************************** //
87  std::string const &perpetrator,
88  boost::archive::archive_exception &aex
89  );
90 };
91 
92 #include <SerialIO.tcc>
Utils for Input/Output operations of serializable objects.
Definition: SerialIO.h:13
static SerialIO * instance
Pointer to singleton instance of SerialIO.
Definition: SerialIO.h:20
void write(std::string const &path, SerialClass const *object, bool fastCompression=true)
SerialIO()=default
Singleton constructor.
static SerialIO * getInstance()
Definition: SerialIO.cpp:6
SerialClass * read(std::string const &path, bool const fastCompression=true)
void handleArchiveException(std::string const &perpetrator, boost::archive::archive_exception &aex)
Handle given archive exception.
Definition: SerialIO.cpp:13