ImageMetaMessage.h
Go to the documentation of this file.
00001 
00037 #ifndef LibMultiSense_ImageMetaMessage
00038 #define LibMultiSense_ImageMetaMessage
00039 
00040 #include <typeinfo>
00041 
00042 #include "details/utility/Portability.hh"
00043 
00044 namespace crl {
00045 namespace multisense {
00046 namespace details {
00047 namespace wire {
00048 
00049 class WIRE_HEADER_ATTRIBS_ ImageMetaHeader {
00050 public:
00051 
00052     static CRL_CONSTEXPR IdType      ID      = ID_DATA_IMAGE_META;
00053     static CRL_CONSTEXPR VersionType VERSION = 1;
00054 
00055     static CRL_CONSTEXPR uint32_t HISTOGRAM_CHANNELS = 4; // g0, r, b, g1
00056     static CRL_CONSTEXPR uint32_t HISTOGRAM_BINS     = 256;
00057     static CRL_CONSTEXPR uint32_t HISTOGRAM_LENGTH   = (HISTOGRAM_CHANNELS * HISTOGRAM_BINS *
00058                                                 sizeof(uint32_t));
00059 
00060 #ifdef SENSORPOD_FIRMWARE
00061     IdType      id;
00062     VersionType version;
00063 #endif // SENSORPOD_FIRMWARE
00064 
00065     int64_t            frameId;
00066     float              framesPerSecond;
00067     float              gain;
00068     uint32_t           exposureTime;
00069     uint32_t           timeSeconds;
00070     uint32_t           timeMicroSeconds;
00071     int32_t            angle; // microradians
00072 
00073     ImageMetaHeader() 
00074         :
00075 #ifdef SENSORPOD_FIRMWARE
00076         id(ID),
00077         version(VERSION),
00078 #endif // SENSORPOD_FIRMWARE
00079         frameId(0),
00080         framesPerSecond(0),
00081         gain(0.0),
00082         exposureTime(0),
00083         timeSeconds(0),
00084         timeMicroSeconds(0),    
00085         angle(0) {};
00086 };
00087 
00088 #ifndef SENSORPOD_FIRMWARE
00089 
00090 class ImageMeta : public ImageMetaHeader {
00091 public:
00092 
00093     uint32_t histogramP[HISTOGRAM_BINS * HISTOGRAM_CHANNELS];
00094 
00095     //
00096     // Constructors
00097 
00098     ImageMeta(utility::BufferStreamReader&r, VersionType v) {serialize(r,v);};
00099     ImageMeta() {};
00100   
00101     //
00102     // Serialization routine
00103 
00104     template<class Archive>
00105         void serialize(Archive&          message,
00106                        const VersionType version)
00107     {
00108         message & frameId;
00109         message & framesPerSecond;
00110         message & gain;
00111         message & exposureTime;
00112         message & timeSeconds;
00113         message & timeMicroSeconds;
00114         message & angle;
00115         
00116         if (typeid(Archive) == typeid(utility::BufferStreamWriter))
00117             message.write(histogramP, HISTOGRAM_LENGTH);
00118         else
00119             message.read(histogramP, HISTOGRAM_LENGTH);
00120     }
00121 };
00122 
00123 #endif // !SENSORPOD_FIRMWARE
00124 
00125 }}}}; // namespaces
00126 
00127 #endif


multisense_lib
Author(s):
autogenerated on Thu Aug 27 2015 14:01:11