LibMultiSense
LibMultiSense Documentation
Loading...
Searching...
No Matches
CompressedImageMessage.hh
Go to the documentation of this file.
1
37#ifndef LibMultiSense_CompressedImageMessage
38#define LibMultiSense_CompressedImageMessage
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_COMPRESSED_IMAGE;
54static CRL_CONSTEXPR VersionType VERSION = 1;
55
56static CRL_CONSTEXPR uint32_t H264_CODEC = 0;
57
58#ifdef SENSORPOD_FIRMWARE
59 IdType id;
60 VersionType version;
61#endif // SENSORPOD_FIRMWARE
62
63 uint32_t source;
64 uint32_t bitsPerPixel;
65 uint32_t codec;
66 int64_t frameId;
67 uint16_t width;
68 uint16_t height;
69 uint32_t exposure;
70 float gain;
73
75 :
76#ifdef SENSORPOD_FIRMWARE
77 id(ID),
78 version(VERSION),
79#endif // SENSORPOD_FIRMWARE
80 source(0),
81 bitsPerPixel(0),
82 codec(0),
83 frameId(0),
84 width(0),
85 height(0),
86 exposure(0),
87 gain(0.0),
88 compressedDataBufferSize(0),
89 sourceExtended(0)
90 {};
91};
92
93#ifndef SENSORPOD_FIRMWARE
94
96public:
97
98 void *dataP;
99
100 //
101 // Constructors
102
104 CompressedImage() : dataP(NULL) {};
105
106 //
107 // Serialization routine
108
109 template<class Archive>
110 void serialize(Archive& message,
111 const VersionType version)
112 {
113 message & source;
114 message & bitsPerPixel;
115 message & codec;
116 message & frameId;
117 message & width;
118 message & height;
119 message & exposure;
120 message & gain;
121 message & compressedDataBufferSize;
122
123 if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
124
125 message.write(dataP, compressedDataBufferSize);
126
127 } else {
128
129 dataP = message.peek();
130 message.seek(message.tell() + compressedDataBufferSize);
131 }
132
133 if (version >= 1)
134 {
135 message & sourceExtended;
136 }
137 else
138 {
139 sourceExtended = 0;
140 }
141
142 }
143};
144
145#endif // !SENSORPOD_FIRMWARE
146
147}}}} // namespaces
148
149#endif
Macros and symbols to help portability between different compiler versions.
#define CRL_CONSTEXPR
#define WIRE_HEADER_ATTRIBS_
Definition Protocol.hh:65
CompressedImage(utility::BufferStreamReader &r, VersionType v)
void serialize(Archive &message, const VersionType version)