LibMultiSense
LibMultiSense Documentation
Loading...
Searching...
No Matches
JpegMessage.hh
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
45namespace crl {
46namespace multisense {
47namespace details {
48namespace wire {
49
51public:
52
53static CRL_CONSTEXPR IdType ID = ID_DATA_JPEG_IMAGE;
54static CRL_CONSTEXPR VersionType VERSION = 2;
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;
68
70#ifdef SENSORPOD_FIRMWARE
71 id(ID),
72 version(VERSION),
73#endif // SENSORPOD_FIRMWARE
74 source(0),
75 frameId(0),
76 width(0),
77 height(0),
78 length(0),
79 quality(0),
80 sourceExtended(0)
81 {};
82};
83
84#ifndef SENSORPOD_FIRMWARE
85
86class JpegImage : public JpegImageHeader {
87public:
88
89 void *dataP;
90
91 //
92 // Constructors
93
95 JpegImage() : dataP(NULL) {};
96
97 //
98 // Serialization routine
99
100 template<class Archive>
101 void serialize(Archive& message,
102 const VersionType version)
103 {
104 message & source;
105 message & frameId;
106 message & width;
107 message & height;
108 message & length;
109 message & quality;
110
111 if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
112
113 message.write(dataP, length);
114
115 } else {
116
117 dataP = message.peek();
118 message.seek(message.tell() + length);
119 }
120
121 if (version >= 2)
122 {
123 message & sourceExtended;
124 }
125 else
126 {
127 sourceExtended = 0;
128 }
129 }
130};
131
132#endif // !SENSORPOD_FIRMWARE
133
134}}}} // namespaces
135
136#endif
Macros and symbols to help portability between different compiler versions.
#define CRL_CONSTEXPR
#define WIRE_HEADER_ATTRIBS_
Definition Protocol.hh:65
JpegImage(utility::BufferStreamReader &r, VersionType v)
void serialize(Archive &message, const VersionType version)