Jpp 20.0.0-rc.8
the software that should make you happy
Loading...
Searching...
No Matches
JIO::JObjectBinaryIO< T > Struct Template Reference

Auxiliary base class for storing and loading a single object to and from a binary file, respectively. More...

#include <JObjectBinaryIO.hh>

Inheritance diagram for JIO::JObjectBinaryIO< T >:
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JOSCPROB::JOscProbInterpolator< JCollection_t, JFunction1D_t, JFunctionalMaplist_t > JPHYSICS::JCDFTable< JFunction1D_t, JMaplist_t, JDistance_t > JPHYSICS::JPDFTable< JFunction1D_t, JMaplist_t, JDistance_t > JTOOLS::JMultiPDF< JFunction_t, JMaplist_t, JDistance_t >

Public Member Functions

void load (const char *file_name)
 Load from input file.
 
void store (const char *file_name) const
 Store to output file.
 

Detailed Description

template<class T>
struct JIO::JObjectBinaryIO< T >

Auxiliary base class for storing and loading a single object to and from a binary file, respectively.

The implementation of this functionality is based on a static cast of the given template parameter (known as "curiously recurring template pattern").

Definition at line 25 of file JObjectBinaryIO.hh.

Member Function Documentation

◆ load()

template<class T >
void JIO::JObjectBinaryIO< T >::load ( const char * file_name)
inline

Load from input file.

Parameters
file_namefile name

Definition at line 32 of file JObjectBinaryIO.hh.

33 {
34 using namespace JPP;
35
36 if (is_gzipped(file_name))
37 JLANG::load<JGZFileStreamReader>(file_name, static_cast<T&>(*this));
38 else
39 JLANG::load<JFileStreamReader> (file_name, static_cast<T&>(*this));
40 }
bool is_gzipped(const char *const file_name)
Check if file is gzipped.
Definition JZip.hh:22
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).

◆ store()

template<class T >
void JIO::JObjectBinaryIO< T >::store ( const char * file_name) const
inline

Store to output file.

Parameters
file_namefile name

Definition at line 48 of file JObjectBinaryIO.hh.

49 {
50 using namespace JPP;
51
52 {
53 JLANG::store<JFileStreamWriter> (file_name, static_cast<const T&>(*this));
54 }
55 }
void store(const std::string &file_name, const T &object)
Store object to output file.
Definition JObjectIO.hh:68

The documentation for this struct was generated from the following file: