OSVR-Core
plugins
unifiedvideoinertialtracker
BodyIdTypes.h
Go to the documentation of this file.
1
11
// Copyright 2016 Sensics, Inc.
12
//
13
// Licensed under the Apache License, Version 2.0 (the "License");
14
// you may not use this file except in compliance with the License.
15
// You may obtain a copy of the License at
16
//
17
// http://www.apache.org/licenses/LICENSE-2.0
18
//
19
// Unless required by applicable law or agreed to in writing, software
20
// distributed under the License is distributed on an "AS IS" BASIS,
21
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
// See the License for the specific language governing permissions and
23
// limitations under the License.
24
25
#ifndef INCLUDED_BodyIdTypes_h_GUID_4FD241A3_25E9_42AF_F075_8EE8191C02F0
26
#define INCLUDED_BodyIdTypes_h_GUID_4FD241A3_25E9_42AF_F075_8EE8191C02F0
27
28
// Internal Includes
29
// - none
30
31
// Library/third-party includes
32
#include <
osvr/Util/TypeSafeId.h
>
33
#include <
osvr/Util/TypeSafeIdHash.h
>
34
35
// Standard includes
36
#include <stdexcept>
37
#include <cstdint>
38
39
namespace
osvr
{
40
namespace
vbtracker {
41
namespace
detail
{
43
struct
BodyIdTag;
45
struct
TargetIdTag;
46
}
// namespace detail
47
}
// namespace vbtracker
48
namespace
util
{
49
namespace
typesafeid_traits {
51
template
<>
struct
WrappedType
<vbtracker::detail::BodyIdTag> {
52
using
type = std::uint16_t;
53
};
55
template
<>
struct
WrappedType
<vbtracker::detail::TargetIdTag> {
56
using
type = std::uint8_t;
57
};
58
}
// namespace typesafeid_traits
59
}
// namespace util
60
61
namespace
vbtracker {
63
using
BodyId
=
util::TypeSafeId<detail::BodyIdTag>
;
65
using
TargetId
=
util::TypeSafeId<detail::TargetIdTag>
;
67
using
BodyTargetId
= std::pair<BodyId, TargetId>;
68
70
template
<
typename
Stream>
71
inline
Stream &operator<<(Stream &os,
BodyTargetId
const
&
id
) {
72
os <<
id
.first.value() <<
":"
<< int(
id
.second.value());
73
return
os;
74
}
75
}
// namespace vbtracker
76
}
// namespace osvr
77
78
namespace
std
{
79
template
<>
80
struct
hash
<
osvr
::vbtracker::BodyTargetId>
81
:
osvr::util::HashIdAggregate
<osvr::vbtracker::BodyTargetId> {};
82
}
// namespace std
83
84
#endif // INCLUDED_BodyIdTypes_h_GUID_4FD241A3_25E9_42AF_F075_8EE8191C02F0
util
Definition:
RunLoopManager.h:42
osvr
The main namespace for all C++ elements of the framework, internal and external.
Definition:
namespace_osvr.dox:3
osvr::vbtracker::BodyTargetId
std::pair< BodyId, TargetId > BodyTargetId
Type-safe zero-based target ID qualified with its body ID.
Definition:
BodyIdTypes.h:67
std
Definition:
TypeSafeIdHash.h:44
TypeSafeIdHash.h
Header defining specializations of std::hash that forward to the contained integer type...
osvr::util::TypeSafeId< detail::BodyIdTag >
osvr::util::HashIdAggregate
Template specialized for common aggregates of TypeSafeIds, with the intent that you can simply open n...
Definition:
TypeSafeIdHash.h:98
detail
Definition:
newuoa.h:1888
hash
Definition:
hash_map.h:20
osvr::util::typesafeid_traits::WrappedType
Explicitly specialize for your tag type if you want a different underlying type.
Definition:
TypeSafeId.h:49
TypeSafeId.h
Header.
Generated by
1.8.12