LibMultiSense
LibMultiSense Documentation
Loading...
Searching...
No Matches
StreamControlMessage.hh
Go to the documentation of this file.
1
37#ifndef LibMultiSense_StreamControlMessage
38#define LibMultiSense_StreamControlMessage
39
41
42namespace crl {
43namespace multisense {
44namespace details {
45namespace wire {
46
48public:
51
52 //
53 // Set modify mask bit high to have the device
54 // accept the corresponding bit in the control mask.
55
58
59 //
60 // Convenience functions
61
62 void enable(SourceType mask) {
63 modifyMask = controlMask = mask;
64 };
65 void disable(SourceType mask) {
66 modifyMask = mask; controlMask = 0;
67 };
68
69 //
70 // Constructor
71
75
76 //
77 // Serialization routine.
78
79 template<class Archive>
80 void serialize(Archive& message,
81 const VersionType version)
82 {
83
84 uint32_t modifyMaskLow = 0;
85 uint32_t modifyMaskHigh = 0;
86 uint32_t controlMaskLow = 0;
87 uint32_t controlMaskHigh = 0;
88
89 if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
90
91 modifyMaskLow = (uint32_t)(modifyMask>>0);
92 modifyMaskHigh = (uint32_t)((modifyMask&0xFFFFFFFF00000000ull)>>32);
93 controlMaskLow = (uint32_t)(controlMask>>0);
94 controlMaskHigh = (uint32_t)((controlMask&0xFFFFFFFF00000000ull)>>32);
95
96 message & modifyMaskLow;
97 message & controlMaskLow;
98
99 if (version >= 2)
100 {
101 message & modifyMaskHigh;
102 message & controlMaskHigh;
103 }
104
105 } else {
106
107
108 message & modifyMaskLow;
109 message & controlMaskLow;
110
111 if (version >= 2)
112 {
113 message & modifyMaskHigh;
114 message & controlMaskHigh;
115 }
116
117 modifyMask = ((uint64_t)modifyMaskHigh) << 32 | modifyMaskLow;
118 controlMask = ((uint64_t)controlMaskHigh) << 32 | controlMaskLow;
119
120 }
121
122 }
123};
124
125}}}} // namespaces
126
127#endif
Macros and symbols to help portability between different compiler versions.
#define CRL_CONSTEXPR
StreamControl(utility::BufferStreamReader &r, VersionType v)
void serialize(Archive &message, const VersionType version)
static CRL_CONSTEXPR IdType ID_CMD_STREAM_CONTROL
Definition Protocol.hh:176