OpenDaVINCI  4.16.0
Serializer.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_SERIALIZATION_SERIALIZER_H_
21 #define OPENDAVINCI_CORE_SERIALIZATION_SERIALIZER_H_
22 
23 #include <string>
24 
27 
28 namespace odcore {
29  namespace serialization {
30 
31  using namespace std;
32 
39  public:
40  Serializer();
41 
42  virtual ~Serializer();
43 
49  virtual void getSerializedData(ostream &o) = 0;
50 
51  public:
60  virtual uint32_t writeValue(ostream &o, const Serializable &v) = 0;
61 
70  virtual uint32_t writeValue(ostream &o, const bool &v) = 0;
71 
80  virtual uint32_t writeValue(ostream &o, const char &v) = 0;
81 
90  virtual uint32_t writeValue(ostream &o, const unsigned char &v) = 0;
91 
100  virtual uint32_t writeValue(ostream &o, const int8_t &v) = 0;
101 
110  virtual uint32_t writeValue(ostream &o, const int16_t &v) = 0;
111 
120  virtual uint32_t writeValue(ostream &o, const uint16_t &v) = 0;
121 
130  virtual uint32_t writeValue(ostream &o, const int32_t &v) = 0;
131 
140  virtual uint32_t writeValue(ostream &o, const uint32_t &v) = 0;
141 
150  virtual uint32_t writeValue(ostream &o, const int64_t &v) = 0;
151 
160  virtual uint32_t writeValue(ostream &o, const uint64_t &v) = 0;
161 
170  virtual uint32_t writeValue(ostream &o, const float &v) = 0;
171 
180  virtual uint32_t writeValue(ostream &o, const double &v) = 0;
181 
190  virtual uint32_t writeValue(ostream &o, const string &v) = 0;
191 
201  virtual uint32_t writeValue(ostream &o, const void *data, const uint32_t &size) = 0;
202 
203  public:
210  virtual void write(const uint32_t &id, const Serializable &s) = 0;
211 
218  virtual void write(const uint32_t &id, const bool &b) = 0;
219 
226  virtual void write(const uint32_t &id, const char &c) = 0;
227 
234  virtual void write(const uint32_t &id, const unsigned char &uc) = 0;
235 
242  virtual void write(const uint32_t &id, const int8_t &i) = 0;
243 
250  virtual void write(const uint32_t &id, const int16_t &i) = 0;
251 
258  virtual void write(const uint32_t &id, const uint16_t &ui) = 0;
259 
266  virtual void write(const uint32_t &id, const int32_t &i) = 0;
267 
274  virtual void write(const uint32_t &id, const uint32_t &ui) = 0;
275 
282  virtual void write(const uint32_t &id, const int64_t &i) = 0;
283 
290  virtual void write(const uint32_t &id, const uint64_t &ui) = 0;
291 
298  virtual void write(const uint32_t &id, const float &f) = 0;
299 
306  virtual void write(const uint32_t &id, const double &d) = 0;
307 
314  virtual void write(const uint32_t &id, const string &s) = 0;
315 
323  virtual void write(const uint32_t &id, const void *data, const uint32_t &size) = 0;
324 
325  public:
334  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const Serializable &s) = 0;
335 
344  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const bool &b) = 0;
345 
354  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const char &c) = 0;
355 
364  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const unsigned char &uc) = 0;
365 
374  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const int8_t &i) = 0;
375 
384  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const int16_t &i) = 0;
385 
394  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const uint16_t &ui) = 0;
395 
404  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const int32_t &i) = 0;
405 
414  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const uint32_t &ui) = 0;
415 
424  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const int64_t &i) = 0;
425 
434  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const uint64_t &ui) = 0;
435 
444  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const float &f) = 0;
445 
454  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const double &d) = 0;
455 
464  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const string &s) = 0;
465 
475  virtual void write(const uint32_t &id, const string &longName, const string &shortName, const void *data, const uint32_t &size) = 0;
476 
477  public:
485  static float htonf(float f);
486 
494  static double htond(double d);
495 
503  static uint64_t __htonll(uint64_t ui);
504 
512  static int64_t __htonll(int64_t i);
513  };
514 
515  }
516 } // odcore::serialization
517 
518 #endif /*OPENDAVINCI_CORE_SERIALIZATION_SERIALIZER_H_*/
Definition: Serializer.h:38
#define OPENDAVINCI_API
Definition: opendavinci.h:67
Definition: Serializable.h:59