Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JBinaryFileWriter.hh
Go to the documentation of this file.
1#ifndef __JIO__JBINARYFILEWRITER__
2#define __JIO__JBINARYFILEWRITER__
3
4#include <ostream>
5
8#include "JLang/JTypeList.hh"
9#include "JLang/JNullType.hh"
10
11#include "JIO/JStreamIO.hh"
13
14
15/**
16 * \author mdejong
17 */
18
19namespace JIO {}
20namespace JPP { using namespace JIO; }
21
22namespace JIO {
23
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 */
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 */
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>
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
Object(s) writing to binary file (i.e. .jpp).
JBinaryFileWriter()
Default constructor.
JBinaryWriterObjectOutput(JWriter &writer)
Constructor.
JBinaryWriterObjectOutput(JWriter &writer)
Constructor.
Auxiliary class for object writing to binary stream.
Implementation of object output to binary file for single data type.
JBinaryWriter(JWriter &writer)
Constructor.
Binary output based on std::ostream.
Definition JStreamIO.hh:83
Implementation of object output using JIO::JWriter for single data type.
Interface for binary output.
Interface for object output with named access.
Template interface of object output for single data type.
Auxiliary classes and methods for binary I/O.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Implementation of null output for single data type.
Auxiliary class for no type definition.
Definition JNullType.hh:19
Type list.
Definition JTypeList.hh:23