forked from sammy-tri/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geometry_ids.h
59 lines (44 loc) · 1.54 KB
/
geometry_ids.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include "drake/common/drake_copyable.h"
#include "drake/common/identifier.h"
namespace drake {
namespace geometry {
namespace internal {
class EncodedData;
} // namespace internal
/** Type used to identify transient collision filter declarations in SceneGraph.
*/
using FilterId = drake::Identifier<class FilterTag>;
/** Type used to identify geometry sources in SceneGraph. */
using SourceId = drake::Identifier<class SourceTag>;
/** Type used to identify geometry frames in SceneGraph.*/
using FrameId = drake::Identifier<class FrameTag>;
/** Type used to identify geometry instances in SceneGraph. */
class GeometryId : public drake::Identifier<class GeometryTag> {
using Base = drake::Identifier<class GeometryTag>;
public:
GeometryId() = default;
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(GeometryId);
static GeometryId get_new_id() {
auto base_id = Base::get_new_id();
return GeometryId(base_id.get_value());
}
private:
explicit GeometryId(int64_t value) : Base(value) {}
// EncodedData needs to be able to create GeometryId from FCL-encoded data.
// This gives it access to the otherwise inaccessible constructor.
friend class internal::EncodedData;
};
} // namespace geometry
} // namespace drake
namespace std {
/** Enables use of the identifier to serve as a key in STL containers.
@relates GeometryId
*/
template <>
struct hash<drake::geometry::GeometryId> {
size_t operator()(const drake::geometry::GeometryId& id) const {
return std::hash<int64_t>()(id.get_value());
}
};
} // namespace std