types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019, FZI Forschungszentrum Informatik (refactor)
3  *
4  * Copyright 2017, 2018 Simon Rasmussen (refactor)
5  *
6  * Copyright 2015, 2016 Thomas Timm Andersen (original version)
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #pragma once
22 
23 #include <inttypes.h>
24 #include <array>
25 #include <iostream>
26 
27 namespace urcl
28 {
29 using vector3d_t = std::array<double, 3>;
30 using vector6d_t = std::array<double, 6>;
31 using vector6int32_t = std::array<int32_t, 6>;
32 using vector6uint32_t = std::array<uint32_t, 6>;
33 
34 template <class T, std::size_t N>
35 std::ostream& operator<<(std::ostream& out, const std::array<T, N>& item)
36 {
37  out << "[";
38  for (size_t i = 0; i < item.size(); ++i)
39  {
40  out << item[i];
41  if (i != item.size() - 1)
42  {
43  out << ", ";
44  }
45  }
46  out << "]";
47  return out;
48 }
49 
57 template <typename E>
58 constexpr typename std::underlying_type<E>::type toUnderlying(const E e) noexcept
59 {
60  return static_cast<typename std::underlying_type<E>::type>(e);
61 }
62 } // namespace urcl
std::array< double, 3 > vector3d_t
Definition: types.h:29
std::array< int32_t, 6 > vector6int32_t
Definition: types.h:31
constexpr std::underlying_type< E >::type toUnderlying(const E e) noexcept
Converts an enum type to its underlying type.
Definition: types.h:58
std::array< uint32_t, 6 > vector6uint32_t
Definition: types.h:32
std::array< double, 6 > vector6d_t
Definition: types.h:30


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26