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 
45 namespace crl {
46 namespace multisense {
47 namespace details {
48 namespace wire {
49 
51 public:
52 
54 static CRL_CONSTEXPR VersionType VERSION = 0;
55 
56 #ifdef SENSORPOD_FIRMWARE
57  IdType id;
58  VersionType version;
59 #endif // SENSORPOD_FIRMWARE
60 
61  uint32_t source;
62  uint32_t bitsPerPixel;
63  uint32_t codec;
64  int64_t frameId;
65  uint16_t width;
66  uint16_t height;
67  uint32_t exposure;
68  float gain;
70 
72  :
73 #ifdef SENSORDPOD_FIRMWARE
74  id(ID),
75  version(VERSION),
76 #endif // SENSORPOD_FIRMWARE
77  source(0),
78  bitsPerPixel(0),
79  codec(0),
80  frameId(0),
81  width(0),
82  height(0),
83  exposure(0),
84  gain(0.0),
85  compressedDataBufferSize(0)
86  {};
87 };
88 
89 #ifndef SENSORPOD_FIRMWARE
90 
92 public:
93 
94  void *dataP;
95 
96  //
97  // Constructors
98 
100  CompressedImage() : dataP(NULL) {};
101 
102  //
103  // Serialization routine
104 
105  template<class Archive>
106  void serialize(Archive& message,
107  const VersionType version)
108  {
109  (void) version;
110  message & source;
111  message & bitsPerPixel;
112  message & codec;
113  message & frameId;
114  message & width;
115  message & height;
116  message & exposure;
117  message & gain;
118  message & compressedDataBufferSize;
119 
120  if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
121 
122  message.write(dataP, compressedDataBufferSize);
123 
124  } else {
125 
126  dataP = message.peek();
127  message.seek(message.tell() + compressedDataBufferSize);
128  }
129 
130  }
131 };
132 
133 #endif // !SENSORPOD_FIRMWARE
134 
135 }}}} // namespaces
136 
137 #endif
CompressedImage(utility::BufferStreamReader &r, VersionType v)
void serialize(Archive &message, const VersionType version)
std::string * frameId(M &m)
void serialize(Stream &stream, const T &t)
Definition: channel.cc:58
#define WIRE_HEADER_ATTRIBS_
Definition: Protocol.hh:64
static CRL_CONSTEXPR IdType ID_DATA_COMPRESSED_IMAGE
Definition: Protocol.hh:225
#define CRL_CONSTEXPR
Definition: Portability.hh:49


multisense_lib
Author(s):
autogenerated on Sat Jun 24 2023 03:01:21