Jpp  debug
the software that should make you happy
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
Interface for object output with named access.
Accessible output stream.
Template interface of object output for single data type.
Object(s) writing to Monte Carlo ASCII file (i.e. .evt)
JMonteCarloFileWriter()
Default constructor.
Template definition of Monte Carlo stream output for single data type.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
Definition: JDataWriter.cc:38
Definition: JSTDTypes.hh:14
Implementation of null output for single data type.
Auxiliary class for no type definition.
Definition: JNullType.hh:19
Type list.
Definition: JTypeList.hh:23