Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JBinaryFileWriter.hh
Go to the documentation of this file.
1 #ifndef __JIO__JBINARYFILEWRITER__
2 #define __JIO__JBINARYFILEWRITER__
3 
4 #include <ostream>
5 
7 #include "JLang/JObjectOutput.hh"
8 #include "JLang/JTypeList.hh"
9 #include "JLang/JNullType.hh"
10 
11 #include "JIO/JStreamIO.hh"
13 
14 
15 /**
16  * \author mdejong
17  */
18 
19 namespace JIO {}
20 namespace JPP { using namespace JIO; }
21 
22 namespace JIO {
23 
27  using JLANG::JNullOutput;
28  using JLANG::JTypeList;
29  using JLANG::JNullType;
30 
31  /**
32  * Auxiliary class for object writing to binary stream.
33  */
34  template<class T, const bool = JLANG::JConversion<T,JSerialisable>::is_derived>
36 
37 
38  /**
39  * Implementation of object output for binary stream compatible data types.
40  *
41  * This class implements the JLANG::JObjectOutput interface.
42  */
43  template<class T>
45  public JWriterObjectOutput<T>
46  {
47  protected:
48  /**
49  * Constructor.
50  *
51  * \param writer JWriter output
52  */
54  JWriterObjectOutput<T>(writer)
55  {}
56  };
57 
58 
59  /**
60  * Implementation of object output for binary stream incompatible data types.
61  *
62  * This class implements the JLANG::JObjectOutput interface by doing nothing.
63  */
64  template<class T>
66  public JNullOutput<T>
67  {
68  protected:
69  /**
70  * Constructor.
71  *
72  * \param writer JWriter output
73  */
75  {}
76  };
77 
78 
79  /**
80  * Implementation of object output to binary file for single data type.
81  *
82  * This class implements the JLANG::JObjectOutput interface.
83  */
84  template<class T>
85  class JBinaryWriter :
87  {
88  protected:
89  /**
90  * Constructor.
91  *
92  * \param writer JWriter output
93  */
96  {}
97  };
98 
99 
100  /**
101  * Implementation of object output to binary file for multiple data types.
102  *
103  * This class recursively implements the JLANG::JObjectOutput interface
104  * for all data types by deriving from:
105  * - JBinaryWriter<JHead_t>; and
106  * - JBinaryWriter<JTail_t>.
107  */
108  template<class JHead_t, class JTail_t>
109  class JBinaryWriter< JTypeList<JHead_t, JTail_t> > :
110  public virtual JObjectOutput< JTypeList<JHead_t, JTail_t> >,
111  public JBinaryWriter<JHead_t>,
112  public JBinaryWriter<JTail_t>
113 
114  {
115  protected:
116  /**
117  * Constructor.
118  *
119  * \param writer JWriter output
120  */
122  JBinaryWriter<JHead_t>(writer),
123  JBinaryWriter<JTail_t>(writer)
124  {}
125  };
126 
127 
128  /**
129  * Terminator class of recursive JBinaryWriter class.
130  */
131  template<class JHead_t>
132  class JBinaryWriter< JTypeList<JHead_t, JNullType> > :
133  public JBinaryWriter<JHead_t>
134  {
135  protected:
136  /**
137  * Constructor.
138  *
139  * \param writer JWriter output
140  */
142  JBinaryWriter<JHead_t>(writer)
143  {}
144  };
145 
146 
147  /**
148  * Object(s) writing to binary file (i.e.\ .jpp).
149  *
150  * This class implements the JLANG::JAccessibleObjectOutput interface.
151  */
152  template<class T>
154  public JAccessibleObjectOutput<T>,
156  protected JStreamWriter,
157  public JBinaryWriter<T>
158  {
159  public:
160  /**
161  * Default constructor.
162  */
165  JStreamWriter (static_cast<std::ostream&>(*this)),
166  JBinaryWriter<T>(static_cast<JWriter&> (*this))
167  {}
168  };
169 }
170 
171 #endif
Interface for binary output.
JBinaryWriterObjectOutput(JWriter &writer)
Constructor.
Implementation of object output to binary file for single data type.
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
Type list.
Definition: JTypeList.hh:22
JBinaryWriter(JWriter &writer)
Constructor.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Auxiliary class for no type definition.
Definition: JNullType.hh:19
Object(s) writing to binary file (i.e. .jpp).
JBinaryFileWriter()
Default constructor.
Implementation of null output for single data type.
Template interface of object output for single data type.
Auxiliary class for object writing to binary stream.
JBinaryWriterObjectOutput(JWriter &writer)
Constructor.
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