8 auto oldIter = oldValues.find(name);
9 if (oldIter == oldValues.end())
14 auto newIter = newValues.find(name);
15 if (newIter == newValues.end())
17 throw LocalException(
"Could find value with name: ") << name;
21 if (oldIter->second.type == VALUE_VARIANT_INT)
25 changed = newValue > oldValue;
26 }
else if (oldIter->second.type == VALUE_VARIANT_BOOL)
30 changed = newValue != oldValue;
36 bool operator ==(
const ValueVariant& left,
const ValueVariant& right)
38 if (left.type != right.type)
45 case VALUE_VARIANT_EMPTY:
48 case VALUE_VARIANT_BOOL:
49 return (left.i != 0) == (right.i != 0);
51 case VALUE_VARIANT_INT:
52 return left.i == right.i;
54 case VALUE_VARIANT_FLOAT:
55 return left.f == right.f;
57 case VALUE_VARIANT_STRING:
58 return left.s == right.s;
60 case VALUE_VARIANT_VECTOR3:
61 case VALUE_VARIANT_MATRIX4:
62 return left.v == right.v;
65 throw std::logic_error(
"Remote value type not handled");
68 bool operator !=(
const ValueVariant& left,
const ValueVariant& right)
70 return !(left == right);
93 Eigen::Vector3f result;
102 Eigen::Vector3i result;
113 case VALUE_VARIANT_EMPTY:
115 case VALUE_VARIANT_BOOL:
117 case VALUE_VARIANT_INT:
119 case VALUE_VARIANT_FLOAT:
121 case VALUE_VARIANT_STRING:
123 case VALUE_VARIANT_VECTOR3:
125 case VALUE_VARIANT_MATRIX4:
128 throw LocalException(
"Unknown ValueVariantType: ")
136 result.type = VALUE_VARIANT_BOOL;
137 result.i =
value ? 1 : 0;
144 result.type = VALUE_VARIANT_INT;
152 result.type = VALUE_VARIANT_FLOAT;
160 result.type = VALUE_VARIANT_STRING;
168 result.type = VALUE_VARIANT_VECTOR3;
170 result.v[0] =
value(0);
171 result.v[1] =
value(1);
172 result.v[2] =
value(2);
179 result.type = VALUE_VARIANT_MATRIX4;
181 result.v[0] =
value.row(0)[0];
182 result.v[1] =
value.row(0)[1];
183 result.v[2] =
value.row(0)[2];
184 result.v[3] =
value.row(0)[3];
185 result.v[4] =
value.row(1)[0];
186 result.v[5] =
value.row(1)[1];
187 result.v[6] =
value.row(1)[2];
188 result.v[7] =
value.row(1)[3];
189 result.v[8] =
value.row(2)[0];
190 result.v[9] =
value.row(2)[1];
191 result.v[10] =
value.row(2)[2];
192 result.v[11] =
value.row(2)[3];
193 result.v[12] =
value.row(3)[0];
194 result.v[13] =
value.row(3)[1];
195 result.v[14] =
value.row(3)[2];
196 result.v[15] =
value.row(3)[3];
202 val = getAndReturnValue<bool>(
values, name);
207 val = getAndReturnValue<int>(
values, name);
212 val = getAndReturnValue<float>(
values, name);
217 val = getAndReturnValue<std::string>(
values, name);
222 val = getAndReturnValue<Eigen::Vector3f>(
values, name);
227 val = getAndReturnValue<Eigen::Matrix4f>(
values, name);