Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JObjectBinaryIO.hh
Go to the documentation of this file.
1#ifndef __JIO__JOBJECTBINARYIO__
2#define __JIO__JOBJECTBINARYIO__
3
4#include "JLang/JObjectIO.hh"
6
7
8/**
9 * \author mdejong
10 */
11
12namespace JIO {}
13namespace JPP { using namespace JIO; }
14
15namespace JIO {
16
17 /**
18 * Auxiliary base class for storing and loading a single object to and from a binary file, respectively.
19 * The implementation of this functionality is based on a static cast of
20 * the given template parameter (known as "curiously recurring template pattern").
21 */
22 template<class T>
24 /**
25 * Load from input file.
26 *
27 * \param file_name file name
28 */
29 void load(const char* file_name)
30 {
31 JLANG::load<JFileStreamReader>(file_name, static_cast<T&>(*this));
32 }
33
34
35 /**
36 * Store to output file.
37 *
38 * \param file_name file name
39 */
40 void store(const char* file_name) const
41 {
42 JLANG::store<JFileStreamWriter>(file_name, static_cast<const T&>(*this));
43 }
44 };
45}
46
47#endif
General methods for loading and storing a single object from and to a file, respectively.
Auxiliary classes and methods for binary I/O.
void store(const std::string &file_name, const T &object)
Store object to output file.
Definition JObjectIO.hh:68
void load(const std::string &file_name, T &object)
Load object from input file.
Definition JObjectIO.hh:55
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary base class for storing and loading a single object to and from a binary file,...
void store(const char *file_name) const
Store to output file.
void load(const char *file_name)
Load from input file.