SysDirectedStreamsMessage.h
Go to the documentation of this file.
00001 
00037 #ifndef LibMultiSense_SysDirectedStreamsMessage
00038 #define LibMultiSense_SysDirectedStreamsMessage
00039 
00040 #include "details/utility/Portability.hh"
00041 
00042 namespace crl {
00043 namespace multisense {
00044 namespace details {
00045 namespace wire {
00046 
00047 class DirectedStream {
00048 public:
00049     static CRL_CONSTEXPR VersionType VERSION = 1;
00050 
00051     uint32_t    mask;
00052     std::string address;
00053     uint16_t    udpPort;
00054     uint32_t    fpsDecimation;
00055 
00056     DirectedStream() {};
00057     DirectedStream(uint32_t           m,
00058                    const std::string& addr,
00059                    uint16_t           p,
00060                    uint32_t           dec) :
00061         mask(m),
00062         address(addr),
00063         udpPort(p),
00064         fpsDecimation(dec) {};
00065 
00066     template<class Archive>
00067         void serialize(Archive&          message,
00068                        const VersionType version)
00069     {
00070         VersionType thisVersion = VERSION;
00071 
00072         message & thisVersion;
00073         message & mask;
00074         message & address;
00075         message & udpPort;
00076         message & fpsDecimation;
00077     };
00078 };
00079 
00080 class SysDirectedStreams {
00081 public:
00082     static CRL_CONSTEXPR IdType      ID        = ID_DATA_SYS_DIRECTED_STREAMS;
00083     static CRL_CONSTEXPR VersionType VERSION   = 1;
00084 
00085     static CRL_CONSTEXPR uint32_t    CMD_NONE  = 0;
00086     static CRL_CONSTEXPR uint32_t    CMD_START = 1;
00087     static CRL_CONSTEXPR uint32_t    CMD_STOP  = 2;
00088 
00089     uint32_t                          command;
00090     std::vector<wire::DirectedStream> streams;
00091 
00092     //
00093     // Constructors
00094 
00095     SysDirectedStreams(utility::BufferStreamReader&r, VersionType v) {serialize(r,v);};
00096     SysDirectedStreams(uint32_t cmd) : command(cmd) {};
00097     SysDirectedStreams() : command(CMD_NONE) {};
00098 
00099     //
00100     // Serialization routine
00101     
00102     template<class Archive>
00103         void serialize(Archive&          message,
00104                        const VersionType version)
00105     {
00106         message & command;
00107         uint32_t elements = streams.size();
00108         message & elements;
00109         streams.resize(elements);
00110         for(uint32_t i=0; i<elements; i++)
00111             streams[i].serialize(message, version);
00112     }
00113 };
00114 
00115 }}}}; // namespaces
00116 
00117 #endif


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