Jpp
software
JIO
JObjectBinaryIO.hh
Go to the documentation of this file.
1
#ifndef __JIO__JOBJECTBINARYIO__
2
#define __JIO__JOBJECTBINARYIO__
3
4
#include "
JLang/JObjectIO.hh
"
5
#include "
JIO/JFileStreamIO.hh
"
6
7
8
/**
9
* \author mdejong
10
*/
11
12
namespace
JIO
{}
13
namespace
JPP
{
using namespace
JIO
; }
14
15
namespace
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>
23
struct
JObjectBinaryIO
{
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
JIO::JObjectBinaryIO::store
void store(const char *file_name) const
Store to output file.
Definition:
JObjectBinaryIO.hh:40
JFileStreamIO.hh
JIO::JObjectBinaryIO
Auxiliary base class for storing and loading a single object to and from a binary file,...
Definition:
JObjectBinaryIO.hh:23
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:37
JObjectIO.hh
JIO
Auxiliary classes and methods for binary I/O.
Definition:
JBinaryFileReader.hh:17
JIO::JObjectBinaryIO::load
void load(const char *file_name)
Load from input file.
Definition:
JObjectBinaryIO.hh:29
Generated by
1.8.16