Fixposition SDK 0.0.0-heads/main-0-g7b59b93
Collection of c++ libraries and apps for use with Fixposition products
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1/**
2 * \verbatim
3 * ___ ___
4 * \ \ / /
5 * \ \/ / Copyright (c) Fixposition AG (www.fixposition.com) and contributors
6 * / /\ \ License: see the LICENSE file
7 * /__/ \__\
8 * \endverbatim
9 *
10 * @file
11 * @brief Fixposition SDK: Common types
12 *
13 * @page FPSDK_COMMON_TYPES Common types
14 *
15 * **API**: fpsdk_common/types.hpp and fpsdk::common::types
16 *
17 */
18#ifndef __FPSDK_COMMON_TYPES_HPP__
19#define __FPSDK_COMMON_TYPES_HPP__
20
21/* LIBC/STL */
22#include <cstdint>
23#include <type_traits>
24
25/* EXTERNAL */
26
27/* PACKAGE */
28
29namespace fpsdk {
30namespace common {
31/**
32 * @brief Common types
33 */
34namespace types {
35/* ****************************************************************************************************************** */
36
37/**
38 * @brief Convert enum class constant to the underlying integral type value
39 *
40 * @tparam T The enum class type
41 * @param[in] enum_val The enum constant
42 *
43 * @returns the integral value of the enum constant as the value of the underlying type
44 */
45template <typename T, typename = typename std::enable_if<std::is_enum<T>::value, T>::type>
46constexpr typename std::underlying_type<T>::type EnumToVal(T enum_val)
47{
48 return static_cast<typename std::underlying_type<T>::type>(enum_val);
49}
50
51/**
52 * @brief GNSS fix types
53 */
54enum class GnssFixType : int8_t // clang-format off
55{
56 FIX_UNKNOWN = 0, //!< Unknown fix
57 FIX_NOFIX = 1, //!< No fix
58 FIX_DRONLY = 2, //!< Dead-reckoning only fix
59 FIX_TIME = 3, //!< Time only fix
60 FIX_2D = 4, //!< 2D fix
61 FIX_3D = 5, //!< 3D fix
62 FIX_3D_DR = 6, //!< 3D + dead-reckoning fix
63 FIX_RTK_FLOAT = 7, //!< RTK float fix (implies 3D fix)
64 FIX_RTK_FIXED = 8, //!< RTK fixed fix (implies 3D fix)
65 FIX_RTK_FLOAT_DR = 9, //!< RTK float fix + dead-reckoning (implies 3D_DR fix)
66 FIX_RTK_FIXED_DR = 10, //!< RTK fixed fix + dead-reckoning (implies 3D_DR fix)
67}; // clang-format on
68
69/**
70 * @brief Stringify GNSS fix type
71 *
72 * @param[in] fix_type The fix type
73 *
74 * @returns a concise and unique string for the fix types, "?" for bad values
75 */
76const char* GnssFixTypeStr(const GnssFixType fix_type);
77
78/* ****************************************************************************************************************** */
79} // namespace types
80} // namespace common
81} // namespace fpsdk
82#endif // __FPSDK_COMMON_TYPES_HPP__
const char * GnssFixTypeStr(const GnssFixType fix_type)
Stringify GNSS fix type.
GnssFixType
GNSS fix types.
Definition types.hpp:55
@ FIX_3D_DR
3D + dead-reckoning fix
@ FIX_RTK_FLOAT
RTK float fix (implies 3D fix)
@ FIX_DRONLY
Dead-reckoning only fix.
@ FIX_RTK_FLOAT_DR
RTK float fix + dead-reckoning (implies 3D_DR fix)
@ FIX_RTK_FIXED_DR
RTK fixed fix + dead-reckoning (implies 3D_DR fix)
@ FIX_RTK_FIXED
RTK fixed fix (implies 3D fix)
constexpr std::underlying_type< T >::type EnumToVal(T enum_val)
Convert enum class constant to the underlying integral type value.
Definition types.hpp:46
Fixposition SDK.
Definition fpsdk_doc.hpp:20