Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JDriver< JClass_t > Class Template Reference

Auxiliary class to load and store objects. More...

#include <JDriver.hh>

Static Public Member Functions

static JClass_t * load ()
 Load object.
 
static JClass_t * load (std::istream &in)
 Load object.
 
template<class T >
static void store (std::ostream &out, const T *p)
 Store object.
 

Static Private Member Functions

static JClass_t * load (JLANG::JBool< false > option)
 Load object without input.
 
static JClass_t * load (std::istream &in, JLANG::JBool< false > option)
 Load object without input.
 
static JClass_t * load (std::istream &in, JLANG::JBool< true > option)
 Load object with input.
 
static void store (std::ostream &out, const JClass_t *p, JBool< false > option)
 Store object without output.
 
static void store (std::ostream &out, const JClass_t *p, JBool< true > option)
 Store object with output.
 

Detailed Description

template<class JClass_t>
class JTOOLS::JDriver< JClass_t >

Auxiliary class to load and store objects.

Definition at line 27 of file JDriver.hh.

Member Function Documentation

◆ load() [1/5]

template<class JClass_t >
static JClass_t * JTOOLS::JDriver< JClass_t >::load ( JLANG::JBool< false > option)
inlinestaticprivate

Load object without input.

Parameters
optionI/O option
Returns
pointer to newly loaded object

Definition at line 35 of file JDriver.hh.

36 {
37 return new JClass_t();
38 }

◆ load() [2/5]

template<class JClass_t >
static JClass_t * JTOOLS::JDriver< JClass_t >::load ( std::istream & in,
JLANG::JBool< false > option )
inlinestaticprivate

Load object without input.

Parameters
ininput stream
optionI/O option
Returns
pointer to newly loaded object

Definition at line 48 of file JDriver.hh.

49 {
50 return load(option);
51 }
static JClass_t * load()
Load object.
Definition JDriver.hh:111

◆ load() [3/5]

template<class JClass_t >
static JClass_t * JTOOLS::JDriver< JClass_t >::load ( std::istream & in,
JLANG::JBool< true > option )
inlinestaticprivate

Load object with input.

Parameters
ininput stream
optionI/O option
Returns
pointer to newly loaded object

Definition at line 61 of file JDriver.hh.

62 {
63 JClass_t* p = load(JLANG::JBool<false>());
64
65 in >> *p;
66
67 if (in.fail()) {
68
69 delete p;
70
71 p = NULL;
72 }
73
74 return p;
75 }
Auxiliary template class for type bool.
Definition JBool.hh:21

◆ store() [1/3]

template<class JClass_t >
static void JTOOLS::JDriver< JClass_t >::store ( std::ostream & out,
const JClass_t * p,
JBool< false > option )
inlinestaticprivate

Store object without output.

This implementation doesn't do anything.

Parameters
outoutput stream
optionI/O option
ppointer to object

Definition at line 86 of file JDriver.hh.

87 {}

◆ store() [2/3]

template<class JClass_t >
static void JTOOLS::JDriver< JClass_t >::store ( std::ostream & out,
const JClass_t * p,
JBool< true > option )
inlinestaticprivate

Store object with output.

Parameters
outoutput stream
optionI/O option
ppointer object

Definition at line 97 of file JDriver.hh.

98 {
99 if (p != NULL) {
100 out << *p;
101 }
102 }

◆ load() [4/5]

template<class JClass_t >
static JClass_t * JTOOLS::JDriver< JClass_t >::load ( )
inlinestatic

Load object.

Returns
pointer to newly loaded object

Definition at line 111 of file JDriver.hh.

112 {
114 }
Test availability of stream operators.

◆ load() [5/5]

template<class JClass_t >
static JClass_t * JTOOLS::JDriver< JClass_t >::load ( std::istream & in)
inlinestatic

Load object.

Parameters
ininput stream
Returns
pointer to newly loaded object

Definition at line 123 of file JDriver.hh.

124 {
126 }

◆ store() [3/3]

template<class JClass_t >
template<class T >
static void JTOOLS::JDriver< JClass_t >::store ( std::ostream & out,
const T * p )
inlinestatic

Store object.

Parameters
outoutput stream
ppointer to object

Definition at line 136 of file JDriver.hh.

137 {
138 store(out, dynamic_cast<const JClass_t*>(p), JLANG::JBool<JStreamAvailable<JClass_t>::has_ostream>());
139 }
static void store(std::ostream &out, const JClass_t *p, JBool< false > option)
Store object without output.
Definition JDriver.hh:86

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