Jpp  18.5.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
JEEP::JContainer< JContainer_t > Struct Template Reference

Auxiliary wrapper for I/O of container with optional comment (see JComment). More...

#include <JContainer.hh>

Inheritance diagram for JEEP::JContainer< JContainer_t >:
JLANG::JObjectStreamIO< T >

Public Types

typedef JContainer_t container_type
 

Public Member Functions

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

Public Attributes

JComment comment
 

Friends

std::istream & operator>> (std::istream &in, JContainer &container)
 Read container from input. More...
 
std::ostream & operator<< (std::ostream &out, const JContainer &container)
 Write container to output. More...
 

Detailed Description

template<class JContainer_t>
struct JEEP::JContainer< JContainer_t >

Auxiliary wrapper for I/O of container with optional comment (see JComment).

When used in conjunction with the command line parser JPARSER::JParser,
the value at the corresponding option can contain data or be the name of a file.
The I/O of the actual container is handled via the auxiliary methods that are part of JStreamToolkit.hh.

Definition at line 39 of file JContainer.hh.

Member Typedef Documentation

template<class JContainer_t>
typedef JContainer_t JEEP::JContainer< JContainer_t >::container_type

Definition at line 43 of file JContainer.hh.

Member Function Documentation

template<class T>
void JLANG::JObjectStreamIO< T >::load ( const char *  file_name)
inlineinherited

Load from input file.

Parameters
file_namefile name

Definition at line 30 of file JObjectStreamIO.hh.

31  {
32  JLANG::load<std::ifstream>(file_name, static_cast<T&>(*this));
33  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T>
void JLANG::JObjectStreamIO< T >::store ( const char *  file_name) const
inlineinherited

Store to output file.

Parameters
file_namefile name

Definition at line 41 of file JObjectStreamIO.hh.

42  {
43  JLANG::store<std::ofstream>(file_name, static_cast<const T&>(*this));
44  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T

Friends And Related Function Documentation

template<class JContainer_t>
std::istream& operator>> ( std::istream &  in,
JContainer< JContainer_t > &  container 
)
friend

Read container from input.

Parameters
ininput stream
containercontainer
Returns
input stream

Definition at line 53 of file JContainer.hh.

54  {
55  using namespace JPP;
56 
57  JStringStream is(in);
58 
59  if (getFileStatus(is.str().c_str())) {
60  is.load();
61  }
62 
63  is >> container.comment;
64 
65  readObject(is, static_cast<container_type&>(container));
66 
67  return in;
68  }
is
Definition: JDAQCHSM.chsm:167
std::istream & readObject(std::istream &in, T &object)
Stream input of object.
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
JComment comment
Definition: JContainer.hh:90
template<class JContainer_t>
std::ostream& operator<< ( std::ostream &  out,
const JContainer< JContainer_t > &  container 
)
friend

Write container to output.

Parameters
outoutput stream
containercontainer
Returns
output stream

Definition at line 78 of file JContainer.hh.

79  {
80  using namespace std;
81  using namespace JPP;
82 
83  out << container.comment;
84 
85  writeObject(out, "", static_cast<const container_type&>(container), '\n');
86 
87  return out;
88  }
JComment comment
Definition: JContainer.hh:90
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.

Member Data Documentation

template<class JContainer_t>
JComment JEEP::JContainer< JContainer_t >::comment

Definition at line 90 of file JContainer.hh.


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