forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geometry_version.cc
38 lines (32 loc) · 1.18 KB
/
geometry_version.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "drake/geometry/geometry_version.h"
namespace drake {
namespace geometry {
GeometryVersion::GeometryVersion()
: proximity_version_id_(RoleVersionId::get_new_id()),
perception_version_id_(RoleVersionId::get_new_id()),
illustration_version_id_(RoleVersionId::get_new_id()) {}
bool GeometryVersion::IsSameAs(const GeometryVersion& other, Role role) const {
switch (role) {
case Role::kUnassigned:
throw std::logic_error(
"Trying to compare the version of unassigned roles.");
case Role::kProximity:
return proximity_version_id_ == other.proximity_version_id_;
case Role::kIllustration:
return illustration_version_id_ == other.illustration_version_id_;
case Role::kPerception:
return perception_version_id_ == other.perception_version_id_;
}
DRAKE_UNREACHABLE();
}
void GeometryVersion::modify_proximity() {
proximity_version_id_ = RoleVersionId::get_new_id();
}
void GeometryVersion::modify_perception() {
perception_version_id_ = RoleVersionId::get_new_id();
}
void GeometryVersion::modify_illustration() {
illustration_version_id_ = RoleVersionId::get_new_id();
}
} // namespace geometry
} // namespace drake