Jpp
JMonteCarloFileWriter.hh
Go to the documentation of this file.
1 #ifndef __JSUPPORT__JMONTECARLOFILEWRITER__
2 #define __JSUPPORT__JMONTECARLOFILEWRITER__
3 
4 #include <ostream>
5 
8 #include "JLang/JObjectOutput.hh"
9 #include "JLang/JTypeList.hh"
10 #include "JLang/JNullType.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JSUPPORT {}
18 namespace JPP { using namespace JSUPPORT; }
19 
20 namespace JSUPPORT {
21 
24  using JLANG::JNullOutput;
26  using JLANG::JTypeList;
27  using JLANG::JNullType;
28 
29 
30  /**
31  * Template definition of Monte Carlo stream output for single data type.
32  *
33  * This class provides for a null implementation of the JLANG::JObjectOutput interface.
34  * It should be specialised for the data types that will be written to a Monte Carlo file.
35  */
36  template<class T>
38  public virtual JObjectOutput<T>,
39  public virtual JNullOutput<T>
40  {
41  protected:
42  /**
43  * Constructor.
44  *
45  * \param out output stream
46  */
47  JMonteCarloStreamObjectOutput(std::ostream& out)
48  {}
49  };
50 
51 
52  /**
53  * Template specialisation of Monte Carlo stream object output for multiple data types.
54  *
55  * This class recursively implements the JLANG::JObjectOutput interface
56  * for all data types by deriving from:
57  * - JMonteCarloStreamObjectOutput<JHead_t>; and
58  * - JMonteCarloStreamObjectOutput<JTail_t>.
59  */
60  template<class JHead_t, class JTail_t>
61  class JMonteCarloStreamObjectOutput< JTypeList<JHead_t, JTail_t> > :
62  public virtual JObjectOutput< JTypeList<JHead_t, JTail_t> >,
63  public JMonteCarloStreamObjectOutput<JHead_t>,
64  public JMonteCarloStreamObjectOutput<JTail_t>
65 
66  {
67  protected:
68  /**
69  * Constructor.
70  *
71  * \param out output stream
72  */
73  JMonteCarloStreamObjectOutput(std::ostream& out) :
74  JMonteCarloStreamObjectOutput<JHead_t>(out),
75  JMonteCarloStreamObjectOutput<JTail_t>(out)
76  {}
77  };
78 
79 
80  /**
81  * Terminator class of recursive JMonteCarloStreamObjectOutput class.
82  */
83  template<class JHead_t>
85  public JMonteCarloStreamObjectOutput<JHead_t>
86  {
87  protected:
88  /**
89  * Constructor.
90  *
91  * \param out output stream
92  */
93  JMonteCarloStreamObjectOutput(std::ostream& out) :
94  JMonteCarloStreamObjectOutput<JHead_t>(out)
95  {}
96  };
97 
98 
99  /**
100  * Object(s) writing to Monte Carlo ASCII file (i.e .evt)
101  *
102  * This class implements the JLANG::JAccessibleObjectOutput interface.
103  */
104  template<class T>
108  public JAccessibleObjectOutput <T>
109  {
110  public:
111  /**
112  * Default constructor.
113  */
116  JMonteCarloStreamObjectOutput<T>(static_cast<std::ostream&>(*this))
117  {}
118  };
119 }
120 
121 #endif
JSUPPORT::JMonteCarloStreamObjectOutput< JTypeList< JHead_t, JNullType > >::JMonteCarloStreamObjectOutput
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Definition: JMonteCarloFileWriter.hh:93
JLANG::JNullType
Auxiliary class for no type definition.
Definition: JNullType.hh:19
JAccessibleStream.hh
JLANG::JAccessibleOutputStream
Accessible output stream.
Definition: JAccessibleStream.hh:90
JLANG::JObjectOutput
Forward declarations for definitions of I/O redirect and pipe operators.
Definition: JObjectIterator.hh:31
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JSUPPORT::JMonteCarloStreamObjectOutput::JMonteCarloStreamObjectOutput
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Definition: JMonteCarloFileWriter.hh:47
JLANG::JTypeList
Type list.
Definition: JTypeList.hh:22
JSUPPORT::JMonteCarloStreamObjectOutput
Template definition of Monte Carlo stream output for single data type.
Definition: JMonteCarloFileWriter.hh:37
JSUPPORT::JMonteCarloFileWriter::JMonteCarloFileWriter
JMonteCarloFileWriter()
Default constructor.
Definition: JMonteCarloFileWriter.hh:114
JStreamObjectOutput.hh
std
Definition: jaanetDictionary.h:36
JSUPPORT
Support classes and methods for experiment specific I/O.
Definition: JDataWriter.cc:38
JLANG::JAccessibleObjectOutput
Interface for object output with named access.
Definition: JObjectOutput.hh:132
JTypeList.hh
JSUPPORT::JMonteCarloStreamObjectOutput< JTypeList< JHead_t, JTail_t > >::JMonteCarloStreamObjectOutput
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Definition: JMonteCarloFileWriter.hh:73
JNullType.hh
JSUPPORT::JMonteCarloFileWriter
Object(s) writing to Monte Carlo ASCII file (i.e .evt)
Definition: JMonteCarloFileWriter.hh:105
JLANG::JNullOutput
Implementation of null output for single data type.
Definition: JObjectOutput.hh:142
JObjectOutput.hh