Jpp  18.0.1-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDAQFileWriter.hh
Go to the documentation of this file.
1 #ifndef __JSUPPORT__JDAQFILEWRITER__
2 #define __JSUPPORT__JDAQFILEWRITER__
3 
4 #include <ostream>
5 
7 #include "JIO/JStreamIO.hh"
8 #include "JDAQ/JDAQPreambleIO.hh"
10 #include "JLang/JObjectOutput.hh"
11 #include "JLang/JTypeList.hh"
12 #include "JLang/JNullType.hh"
13 #include "JLang/JObjectOutput.hh"
14 #include "JLang/JConversion.hh"
15 
16 
17 /**
18  * \author mdejong
19  */
20 
21 namespace JSUPPORT {}
22 namespace JPP { using namespace JSUPPORT; }
23 
24 namespace JSUPPORT {
25 
26  using JIO::JWriter;
28  using JIO::JStreamWriter;
33  using JLANG::JNullOutput;
34  using JLANG::JTypeList;
35  using JLANG::JNullType;
36 
37 
38  /**
39  * Auxiliary class for DAQ object writing to binary stream.
40  */
41  template<class T, bool = JLANG::JConversion<T,JDAQPreamble>::is_derived>
43 
44 
45  /**
46  * Implementation of object output for DAQ compatible data types.
47  *
48  * This class implements the JLANG::JObjectOutput interface.
49  */
50  template<class T>
51  class JDAQWriterObjectOutput<T,true> :
52  public JWriterObjectOutput<T>
53  {
54  protected:
55  /**
56  * Constructor.
57  *
58  * \param writer JWriter output
59  */
61  JWriterObjectOutput<T>(writer)
62  {}
63  };
64 
65 
66  /**
67  * Implementation of object output for DAQ incompatible data types.
68  *
69  * This class implements the JLANG::JObjectOutput interface by doing nothing.
70  */
71  template<class T>
72  class JDAQWriterObjectOutput<T,false> :
73  public JNullOutput<T>
74  {
75  protected:
76  /**
77  * Constructor.
78  *
79  * \param writer JWriter output
80  */
82  {}
83  };
84 
85 
86  /**
87  * Implementation of object output to binary file for single data type.
88  *
89  * This class implements the JLANG::JObjectOutput interface.
90  */
91  template<class T>
92  class JDAQWriter :
93  public JDAQWriterObjectOutput<T>
94  {
95  protected:
96  /**
97  * Constructor.
98  *
99  * \param writer JWriter output
100  */
101  JDAQWriter(JWriter& writer) :
102  JDAQWriterObjectOutput<T>(writer)
103  {}
104  };
105 
106 
107  /**
108  * Implementation of object output to binary file for multiple data types.
109  *
110  * This class recursively implements the JLANG::JObjectOutput interface
111  * for all data types by deriving from:
112  * - JDAQWriter<JHead_t>; and
113  * - JDAQWriter<JTail_t>.
114  */
115  template<class JHead_t, class JTail_t>
116  class JDAQWriter< JTypeList<JHead_t, JTail_t> > :
117  public virtual JObjectOutput< JTypeList<JHead_t, JTail_t> >,
118  public JDAQWriter<JHead_t>,
119  public JDAQWriter<JTail_t>
120 
121  {
122  protected:
123  /**
124  * Constructor.
125  *
126  * \param writer JWriter output
127  */
128  JDAQWriter(JWriter& writer) :
129  JDAQWriter<JHead_t>(writer),
130  JDAQWriter<JTail_t>(writer)
131  {}
132  };
133 
134 
135  /**
136  * Terminator class of recursive JDAQWriter class.
137  */
138  template<class JHead_t>
139  class JDAQWriter< JTypeList<JHead_t, JNullType> > :
140  public JDAQWriter<JHead_t>
141  {
142  protected:
143  /**
144  * Constructor.
145  *
146  * \param writer JWriter output
147  */
148  JDAQWriter(JWriter& writer) :
149  JDAQWriter<JHead_t>(writer)
150  {}
151  };
152 
153 
154  /**
155  * Object(s) writing to binary file (i.e.\ .dat).
156  *
157  * This class implements the JLANG::JAccessibleObjectOutput interface.
158  */
159  template<class T>
162  public JStreamWriter,
163  public JDAQWriter<T>,
164  public JAccessibleObjectOutput<T>
165  {
166  public:
167  /**
168  * Default constructor.
169  */
172  JStreamWriter(static_cast<std::ostream&>(*this)),
173  JDAQWriter<T>(static_cast<JWriter&> (*this))
174  {}
175  };
176 }
177 
178 #endif
JDAQWriterObjectOutput(JWriter &writer)
Constructor.
Interface for binary output.
Auxiliary class for DAQ object writing to binary stream.
JDAQWriterObjectOutput(JWriter &writer)
Constructor.
JDAQFileWriter()
Default constructor.
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
JDAQWriter(JWriter &writer)
Constructor.
Type list.
Definition: JTypeList.hh:22
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Auxiliary class for no type definition.
Definition: JNullType.hh:19
Implementation of object output to binary file for single data type.
Implementation of null output for single data type.
Template interface of object output for single data type.
Interface for object output with named access.
Implementation of object output using JIO::JWriter for single data type.
Binary output based on std::ostream.
Definition: JStreamIO.hh:81
Object(s) writing to binary file (i.e. .dat).