JpegMessage.h
Go to the documentation of this file.
1 
37 #ifndef LibMultiSense_JpegMessage
38 #define LibMultiSense_JpegMessage
39 
40 #include <typeinfo>
41 #include <cmath>
42 
44 
45 namespace crl {
46 namespace multisense {
47 namespace details {
48 namespace wire {
49 
51 public:
52 
54 static CRL_CONSTEXPR VersionType VERSION = 1;
55 
56 #ifdef SENSORPOD_FIRMWARE
57  IdType id;
58  VersionType version;
59 #endif // SENSORPOD_FIRMWARE
60 
61  uint32_t source;
62  int64_t frameId;
63  uint16_t width;
64  uint16_t height;
65  uint32_t length;
66  uint32_t quality;
67 
69 #ifdef SENSORDPOD_FIRMWARE
70  id(ID),
71  version(VERSION),
72 #endif // SENSORPOD_FIRMWARE
73  source(0),
74  frameId(0),
75  width(0),
76  height(0),
77  length(0),
78  quality(0) {};
79 };
80 
81 #ifndef SENSORPOD_FIRMWARE
82 
83 class JpegImage : public JpegImageHeader {
84 public:
85 
86  void *dataP;
87 
88  //
89  // Constructors
90 
92  JpegImage() : dataP(NULL) {};
93 
94  //
95  // Serialization routine
96 
97  template<class Archive>
98  void serialize(Archive& message,
99  const VersionType version)
100  {
101  message & source;
102  message & frameId;
103  message & width;
104  message & height;
105  message & length;
106  message & quality;
107 
108  if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
109 
110  message.write(dataP, length);
111 
112  } else {
113 
114  dataP = message.peek();
115  message.seek(message.tell() + length);
116  }
117  }
118 };
119 
120 #endif // !SENSORPOD_FIRMWARE
121 
122 }}}}; // namespaces
123 
124 #endif
void serialize(Archive &message, const VersionType version)
Definition: JpegMessage.h:98
std::string * frameId(M &m)
static CRL_CONSTEXPR IdType ID_DATA_JPEG_IMAGE
Definition: Protocol.h:202
void serialize(Stream &stream, const T &t)
Definition: channel.cc:56
#define WIRE_HEADER_ATTRIBS_
Definition: Protocol.h:55
JpegImage(utility::BufferStreamReader &r, VersionType v)
Definition: JpegMessage.h:91
#define CRL_CONSTEXPR
Definition: Portability.hh:38


multisense_lib
Author(s):
autogenerated on Sat Apr 6 2019 02:16:46