| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // This file is part of INSTINCT, the INS Toolkit for Integrated | ||
| 2 | // Navigation Concepts and Training by the Institute of Navigation of | ||
| 3 | // the University of Stuttgart, Germany. | ||
| 4 | // | ||
| 5 | // This Source Code Form is subject to the terms of the Mozilla Public | ||
| 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| 7 | // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| 8 | |||
| 9 | /// @file SatelliteSystem.hpp | ||
| 10 | /// @brief GNSS Satellite System | ||
| 11 | /// @author T. Topp (topp@ins.uni-stuttgart.de) | ||
| 12 | /// @date 2022-04-22 | ||
| 13 | |||
| 14 | #pragma once | ||
| 15 | |||
| 16 | #include <cstdint> | ||
| 17 | #include <string> | ||
| 18 | #include <vector> | ||
| 19 | #include <fmt/format.h> | ||
| 20 | |||
| 21 | #include <nlohmann/json.hpp> | ||
| 22 | using json = nlohmann::json; ///< json namespace | ||
| 23 | |||
| 24 | #include "Navigation/Time/TimeSystem.hpp" | ||
| 25 | |||
| 26 | namespace NAV | ||
| 27 | { | ||
| 28 | |||
| 29 | /// @brief Satellite System enumeration | ||
| 30 | enum SatelliteSystem_ : uint64_t | ||
| 31 | { // clang-format off | ||
| 32 | SatSys_None = 0x0000'0000'0000'0000, ///< No Satellite system | ||
| 33 | GPS = 0x0000'0000'0000'00FF, ///< Global Positioning System | ||
| 34 | GAL = 0x0000'0000'0000'FF00, ///< Galileo | ||
| 35 | GLO = 0x0000'0000'00FF'0000, ///< Globalnaja nawigazionnaja sputnikowaja sistema (GLONASS) | ||
| 36 | BDS = 0x0000'0000'FF00'0000, ///< Beidou | ||
| 37 | QZSS = 0x0000'00FF'0000'0000, ///< Quasi-Zenith Satellite System | ||
| 38 | IRNSS = 0x0000'FF00'0000'0000, ///< Indian Regional Navigation Satellite System | ||
| 39 | SBAS = 0x00FF'0000'0000'0000, ///< Satellite Based Augmentation System | ||
| 40 | }; // clang-format on | ||
| 41 | |||
| 42 | /// @brief Satellite System type | ||
| 43 | struct SatelliteSystem | ||
| 44 | { | ||
| 45 | /// @brief Satellite System enumeration with continuous range. Not usable as a mask | ||
| 46 | enum Enum : uint8_t | ||
| 47 | { | ||
| 48 | Enum_GPS, ///< Global Positioning System | ||
| 49 | Enum_GAL, ///< Galileo | ||
| 50 | Enum_GLO, ///< Globalnaja nawigazionnaja sputnikowaja sistema (GLONASS) | ||
| 51 | Enum_BDS, ///< Beidou | ||
| 52 | Enum_QZSS, ///< Quasi-Zenith Satellite System | ||
| 53 | Enum_IRNSS, ///< Indian Regional Navigation Satellite System | ||
| 54 | Enum_SBAS, ///< Satellite Based Augmentation System | ||
| 55 | Enum_COUNT, ///< Count variable | ||
| 56 | Enum_None, ///< No Satellite system | ||
| 57 | }; | ||
| 58 | |||
| 59 | /// @brief Default Constructor | ||
| 60 | constexpr SatelliteSystem() = default; | ||
| 61 | |||
| 62 | /// @brief Implicit Constructor from Value type | ||
| 63 | /// @param[in] type Value type to construct from | ||
| 64 | 2450322 | constexpr SatelliteSystem(SatelliteSystem_ type) // NOLINT(hicpp-explicit-conversions, google-explicit-constructor) | |
| 65 | 2450322 | : value(type) | |
| 66 | 2450322 | {} | |
| 67 | |||
| 68 | /// @brief Implicit Constructor from Enum type | ||
| 69 | /// @param[in] enumeration Enum type to construct from | ||
| 70 | SatelliteSystem(Enum enumeration) // NOLINT(hicpp-explicit-conversions, google-explicit-constructor) | ||
| 71 | : value(SatelliteSystem::fromEnum(enumeration)) | ||
| 72 | {} | ||
| 73 | |||
| 74 | /// @brief Construct new object from std::string | ||
| 75 | /// @param[in] typeString String representation of the satellite system | ||
| 76 | static SatelliteSystem fromString(const std::string& typeString); | ||
| 77 | |||
| 78 | /// @brief Construct new object from char | ||
| 79 | /// @param[in] typeChar Character representation of the satellite system | ||
| 80 | static SatelliteSystem fromChar(char typeChar); | ||
| 81 | |||
| 82 | /// @brief Constructs a new object from continuous enumeration | ||
| 83 | /// @param[in] enumeration Continuous enumeration of the satellite system | ||
| 84 | static SatelliteSystem fromEnum(Enum enumeration); | ||
| 85 | |||
| 86 | /// @brief Assignment operator from Value type | ||
| 87 | /// @param[in] v Value type to construct from | ||
| 88 | /// @return The Type type from the value type | ||
| 89 | 12537171 | constexpr SatelliteSystem& operator=(SatelliteSystem_ v) | |
| 90 | { | ||
| 91 | 12537171 | value = v; | |
| 92 | 12537171 | return *this; | |
| 93 | } | ||
| 94 | |||
| 95 | friend constexpr bool operator==(const SatelliteSystem& lhs, const SatelliteSystem& rhs); | ||
| 96 | |||
| 97 | /// @brief Less than comparison (needed for map) | ||
| 98 | /// @param[in] rhs Right hand side of the operator | ||
| 99 | /// @return True if lhs < rhs | ||
| 100 | 3078360 | constexpr bool operator<(const SatelliteSystem& rhs) const { return value < rhs.value; } | |
| 101 | |||
| 102 | /// @brief Allow switch(SatelliteSystem_(type)) and comparisons | ||
| 103 | 31512757 | constexpr explicit operator SatelliteSystem_() const { return value; } | |
| 104 | /// @brief Prevent usage: if(...) | ||
| 105 | constexpr explicit operator bool() = delete; | ||
| 106 | |||
| 107 | /// @brief int conversion operator | ||
| 108 | /// @return A int representation of the type | ||
| 109 | 86678281 | constexpr explicit operator uint64_t() const { return uint64_t(value); } | |
| 110 | |||
| 111 | /// @brief std::string conversion operator | ||
| 112 | /// @return A std::string representation of the type | ||
| 113 | explicit operator std::string() const; | ||
| 114 | |||
| 115 | /// @brief char conversion operator | ||
| 116 | /// @return A char representation of the type | ||
| 117 | explicit operator char() const; | ||
| 118 | |||
| 119 | /// @brief Get the Time System of the specified Satellite System | ||
| 120 | /// @param[in] satSys Satellite System to get the time system for | ||
| 121 | static TimeSystem GetTimeSystemForSatelliteSystem(SatelliteSystem satSys); | ||
| 122 | |||
| 123 | /// @brief Get the Time System of this Satellite System | ||
| 124 | [[nodiscard]] TimeSystem getTimeSystem() const; | ||
| 125 | |||
| 126 | /// @brief Get a list of satellites in the constellation | ||
| 127 | /// @param[in] satSys Satellite System to get the list for | ||
| 128 | static std::vector<uint16_t> GetSatellitesForSatelliteSystem(SatelliteSystem satSys); | ||
| 129 | |||
| 130 | /// @brief Get a list of satellites in the constellation | ||
| 131 | [[nodiscard]] std::vector<uint16_t> getSatellites() const; | ||
| 132 | |||
| 133 | /// @brief Get additional information about the satellite if available | ||
| 134 | /// @param[in] satSys Satellite System | ||
| 135 | /// @param[in] satNum Satellite Number | ||
| 136 | /// @return Optional String of additional information | ||
| 137 | static std::optional<std::string> GetSatelliteInfo(SatelliteSystem satSys, uint16_t satNum); | ||
| 138 | |||
| 139 | /// @brief Get additional information about the satellite if available | ||
| 140 | /// @param[in] satNum Satellite Number | ||
| 141 | /// @return Optional String of additional information | ||
| 142 | [[nodiscard]] std::optional<std::string> getSatelliteInfo(uint16_t satNum) const; | ||
| 143 | |||
| 144 | /// @brief Get the continuous enumeration of the specified Satellite System | ||
| 145 | /// @param[in] satSys Satellite System to get the continuous enumeration for | ||
| 146 | static Enum ToEnumeration(SatelliteSystem satSys); | ||
| 147 | |||
| 148 | /// @brief Returns a continuous enumeration of the object | ||
| 149 | [[nodiscard]] Enum toEnumeration() const; | ||
| 150 | |||
| 151 | /// @brief Get char representation of the specified Satellite System | ||
| 152 | /// @param[in] satSys Satellite System to get the continuous enumeration for | ||
| 153 | static char ToChar(SatelliteSystem satSys); | ||
| 154 | |||
| 155 | /// @brief Returns the char representation of the object | ||
| 156 | [[nodiscard]] char toChar() const; | ||
| 157 | |||
| 158 | /// @brief Get a vector representation of the specified Satellite Systems | ||
| 159 | /// @param[in] satSys Satellite System to get the vector for | ||
| 160 | static std::vector<SatelliteSystem> ToVector(SatelliteSystem satSys); | ||
| 161 | |||
| 162 | /// @brief Get a vector representation of the specified Satellite Systems | ||
| 163 | [[nodiscard]] std::vector<SatelliteSystem> toVector() const; | ||
| 164 | |||
| 165 | /// @brief Returns a list with all possible satellite systems | ||
| 166 | static std::vector<SatelliteSystem> GetAll(); | ||
| 167 | |||
| 168 | private: | ||
| 169 | /// @brief Internal value | ||
| 170 | SatelliteSystem_ value = SatelliteSystem_::SatSys_None; | ||
| 171 | }; | ||
| 172 | |||
| 173 | // ######################################################################################################################################### | ||
| 174 | |||
| 175 | /// @brief Converts the provided link into a json object | ||
| 176 | /// @param[out] j Json object which gets filled with the info | ||
| 177 | /// @param[in] data Data to convert into json | ||
| 178 | void to_json(json& j, const SatelliteSystem& data); | ||
| 179 | /// @brief Converts the provided json object into a link object | ||
| 180 | /// @param[in] j Json object with the needed values | ||
| 181 | /// @param[out] data Object to fill from the json | ||
| 182 | void from_json(const json& j, SatelliteSystem& data); | ||
| 183 | |||
| 184 | // ######################################################################################################################################### | ||
| 185 | |||
| 186 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 187 | /// @param[in] lhs Left-hand side enum value. | ||
| 188 | /// @param[in] rhs Right-hand side enum value. | ||
| 189 | /// @return The binary ORed value. | ||
| 190 | 12531302 | constexpr SatelliteSystem_ operator|(SatelliteSystem_ lhs, SatelliteSystem_ rhs) | |
| 191 | { | ||
| 192 | 12531302 | return SatelliteSystem_(uint64_t(lhs) | uint64_t(rhs)); | |
| 193 | } | ||
| 194 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 195 | /// @param[in] lhs Left-hand side enum value. | ||
| 196 | /// @param[in] rhs Right-hand side enum value. | ||
| 197 | /// @return The binary ORed value. | ||
| 198 | 12530723 | constexpr SatelliteSystem_ operator|(SatelliteSystem lhs, SatelliteSystem rhs) | |
| 199 | { | ||
| 200 | 12530723 | return SatelliteSystem_(lhs) | SatelliteSystem_(rhs); | |
| 201 | } | ||
| 202 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 203 | /// @param[in] lhs Left-hand side enum value. | ||
| 204 | /// @param[in] rhs Right-hand side enum value. | ||
| 205 | /// @return The binary ORed value. | ||
| 206 | constexpr SatelliteSystem_ operator|(SatelliteSystem_ lhs, SatelliteSystem rhs) | ||
| 207 | { | ||
| 208 | return lhs | SatelliteSystem_(rhs); | ||
| 209 | } | ||
| 210 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 211 | /// @param[in] lhs Left-hand side enum value. | ||
| 212 | /// @param[in] rhs Right-hand side enum value. | ||
| 213 | /// @return The binary ORed value. | ||
| 214 | constexpr SatelliteSystem_ operator|(SatelliteSystem lhs, SatelliteSystem_ rhs) | ||
| 215 | { | ||
| 216 | return SatelliteSystem_(lhs) | rhs; | ||
| 217 | } | ||
| 218 | |||
| 219 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 220 | /// @param[in] lhs Left-hand side enum value. | ||
| 221 | /// @param[in] rhs Right-hand side enum value. | ||
| 222 | /// @return The binary ORed value. | ||
| 223 | constexpr SatelliteSystem_& operator|=(SatelliteSystem_& lhs, const SatelliteSystem_& rhs) | ||
| 224 | { | ||
| 225 | lhs = lhs | rhs; | ||
| 226 | return lhs; | ||
| 227 | } | ||
| 228 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 229 | /// @param[in] lhs Left-hand side enum value. | ||
| 230 | /// @param[in] rhs Right-hand side enum value. | ||
| 231 | /// @return The binary ORed value. | ||
| 232 | 12530850 | constexpr SatelliteSystem& operator|=(SatelliteSystem& lhs, const SatelliteSystem& rhs) | |
| 233 | { | ||
| 234 | 12530850 | lhs = lhs | rhs; | |
| 235 | 12530742 | return lhs; | |
| 236 | } | ||
| 237 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 238 | /// @param[in] lhs Left-hand side enum value. | ||
| 239 | /// @param[in] rhs Right-hand side enum value. | ||
| 240 | /// @return The binary ORed value. | ||
| 241 | constexpr SatelliteSystem_& operator|=(SatelliteSystem_& lhs, const SatelliteSystem& rhs) | ||
| 242 | { | ||
| 243 | lhs = lhs | SatelliteSystem_(rhs); | ||
| 244 | return lhs; | ||
| 245 | } | ||
| 246 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 247 | /// @param[in] lhs Left-hand side enum value. | ||
| 248 | /// @param[in] rhs Right-hand side enum value. | ||
| 249 | /// @return The binary ORed value. | ||
| 250 | constexpr SatelliteSystem& operator|=(SatelliteSystem& lhs, const SatelliteSystem_& rhs) | ||
| 251 | { | ||
| 252 | lhs = lhs | rhs; | ||
| 253 | return lhs; | ||
| 254 | } | ||
| 255 | |||
| 256 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 257 | /// @param[in] lhs Left-hand side enum value. | ||
| 258 | /// @param[in] rhs Right-hand side enum value. | ||
| 259 | /// @return The binary ANDed value. | ||
| 260 | 278558 | constexpr SatelliteSystem_ operator&(SatelliteSystem_ lhs, SatelliteSystem_ rhs) | |
| 261 | { | ||
| 262 | 278558 | return SatelliteSystem_(uint64_t(lhs) & uint64_t(rhs)); | |
| 263 | } | ||
| 264 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 265 | /// @param[in] lhs Left-hand side enum value. | ||
| 266 | /// @param[in] rhs Right-hand side enum value. | ||
| 267 | /// @return The binary ANDed value. | ||
| 268 | 6342 | constexpr SatelliteSystem operator&(SatelliteSystem lhs, SatelliteSystem rhs) | |
| 269 | { | ||
| 270 | 6342 | return SatelliteSystem_(lhs) & SatelliteSystem_(rhs); | |
| 271 | } | ||
| 272 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 273 | /// @param[in] lhs Left-hand side enum value. | ||
| 274 | /// @param[in] rhs Right-hand side enum value. | ||
| 275 | /// @return The binary ANDed value. | ||
| 276 | constexpr SatelliteSystem_ operator&(SatelliteSystem lhs, SatelliteSystem_ rhs) | ||
| 277 | { | ||
| 278 | return SatelliteSystem_(lhs) & rhs; | ||
| 279 | } | ||
| 280 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 281 | /// @param[in] lhs Left-hand side enum value. | ||
| 282 | /// @param[in] rhs Right-hand side enum value. | ||
| 283 | /// @return The binary ANDed value. | ||
| 284 | constexpr SatelliteSystem_ operator&(SatelliteSystem_ lhs, SatelliteSystem rhs) | ||
| 285 | { | ||
| 286 | return lhs & SatelliteSystem_(rhs); | ||
| 287 | } | ||
| 288 | |||
| 289 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 290 | /// @param[in] lhs Left-hand side enum value. | ||
| 291 | /// @param[in] rhs Right-hand side enum value. | ||
| 292 | /// @return The binary ANDed value. | ||
| 293 | constexpr SatelliteSystem_& operator&=(SatelliteSystem_& lhs, const SatelliteSystem_& rhs) | ||
| 294 | { | ||
| 295 | lhs = lhs & rhs; | ||
| 296 | return lhs; | ||
| 297 | } | ||
| 298 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 299 | /// @param[in] lhs Left-hand side enum value. | ||
| 300 | /// @param[in] rhs Right-hand side enum value. | ||
| 301 | /// @return The binary ANDed value. | ||
| 302 | constexpr SatelliteSystem& operator&=(SatelliteSystem& lhs, const SatelliteSystem& rhs) | ||
| 303 | { | ||
| 304 | lhs = lhs & rhs; | ||
| 305 | return lhs; | ||
| 306 | } | ||
| 307 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 308 | /// @param[in] lhs Left-hand side enum value. | ||
| 309 | /// @param[in] rhs Right-hand side enum value. | ||
| 310 | /// @return The binary ANDed value. | ||
| 311 | constexpr SatelliteSystem_& operator&=(SatelliteSystem_& lhs, const SatelliteSystem& rhs) | ||
| 312 | { | ||
| 313 | lhs = lhs & SatelliteSystem_(rhs); | ||
| 314 | return lhs; | ||
| 315 | } | ||
| 316 | /// @brief Allows combining flags of the SatelliteSystem enum. | ||
| 317 | /// @param[in] lhs Left-hand side enum value. | ||
| 318 | /// @param[in] rhs Right-hand side enum value. | ||
| 319 | /// @return The binary ANDed value. | ||
| 320 | constexpr SatelliteSystem& operator&=(SatelliteSystem& lhs, const SatelliteSystem_& rhs) | ||
| 321 | { | ||
| 322 | lhs = lhs & rhs; | ||
| 323 | return lhs; | ||
| 324 | } | ||
| 325 | |||
| 326 | /// @brief Allows negating flags of the SatelliteSystem enum. | ||
| 327 | /// @param[in] rhs Right-hand side enum value. | ||
| 328 | /// @return The binary NEGed value. | ||
| 329 | constexpr SatelliteSystem_ operator~(SatelliteSystem_ rhs) | ||
| 330 | { | ||
| 331 | return SatelliteSystem_(~uint64_t(rhs)); | ||
| 332 | } | ||
| 333 | /// @brief Allows negating flags of the SatelliteSystem enum. | ||
| 334 | /// @param[in] rhs Right-hand side enum value. | ||
| 335 | /// @return The binary NEGed value. | ||
| 336 | constexpr SatelliteSystem_ operator~(SatelliteSystem rhs) | ||
| 337 | { | ||
| 338 | return SatelliteSystem_(~uint64_t(rhs)); | ||
| 339 | } | ||
| 340 | |||
| 341 | // ######################################################################################################################################### | ||
| 342 | |||
| 343 | /// @brief Equal compares values | ||
| 344 | /// @param[in] lhs Left-hand side of the operator | ||
| 345 | /// @param[in] rhs Right-hand side of the operator | ||
| 346 | /// @return Whether the comparison was successful | ||
| 347 | 54545346 | constexpr bool operator==(const SatelliteSystem& lhs, const SatelliteSystem& rhs) { return lhs.value == rhs.value; } | |
| 348 | /// @brief Equal compares values | ||
| 349 | /// @param[in] lhs Left-hand side of the operator | ||
| 350 | /// @param[in] rhs Right-hand side of the operator | ||
| 351 | /// @return Whether the comparison was successful | ||
| 352 | 896740 | constexpr bool operator==(const SatelliteSystem& lhs, const SatelliteSystem_& rhs) { return lhs == SatelliteSystem(rhs); } | |
| 353 | /// @brief Equal compares values | ||
| 354 | /// @param[in] lhs Left-hand side of the operator | ||
| 355 | /// @param[in] rhs Right-hand side of the operator | ||
| 356 | /// @return Whether the comparison was successful | ||
| 357 | constexpr bool operator==(const SatelliteSystem_& lhs, const SatelliteSystem& rhs) { return SatelliteSystem(lhs) == rhs; } | ||
| 358 | |||
| 359 | /// @brief Inequal compares values | ||
| 360 | /// @param[in] lhs Left-hand side of the operator | ||
| 361 | /// @param[in] rhs Right-hand side of the operator | ||
| 362 | /// @return Whether the comparison was successful | ||
| 363 | 223622 | constexpr bool operator!=(const SatelliteSystem& lhs, const SatelliteSystem& rhs) { return !(lhs == rhs); } | |
| 364 | /// @brief Inequal compares values | ||
| 365 | /// @param[in] lhs Left-hand side of the operator | ||
| 366 | /// @param[in] rhs Right-hand side of the operator | ||
| 367 | /// @return Whether the comparison was successful | ||
| 368 | 12684 | constexpr bool operator!=(const SatelliteSystem& lhs, const SatelliteSystem_& rhs) { return !(lhs == rhs); } | |
| 369 | /// @brief Inequal compares values | ||
| 370 | /// @param[in] lhs Left-hand side of the operator | ||
| 371 | /// @param[in] rhs Right-hand side of the operator | ||
| 372 | /// @return Whether the comparison was successful | ||
| 373 | constexpr bool operator!=(const SatelliteSystem_& lhs, const SatelliteSystem& rhs) { return !(lhs == rhs); } | ||
| 374 | |||
| 375 | /// @brief Stream insertion operator overload | ||
| 376 | /// @param[in, out] os Output stream object to stream the time into | ||
| 377 | /// @param[in] satSys Object to print | ||
| 378 | /// @return Returns the output stream object in order to chain stream insertions | ||
| 379 | std::ostream& operator<<(std::ostream& os, const SatelliteSystem& satSys); | ||
| 380 | |||
| 381 | /// All Systems | ||
| 382 | constexpr SatelliteSystem_ SatSys_All = GPS | GAL | GLO | BDS | QZSS | IRNSS | SBAS; | ||
| 383 | |||
| 384 | } // namespace NAV | ||
| 385 | |||
| 386 | namespace std | ||
| 387 | { | ||
| 388 | /// @brief Hash function for SatelliteSystem (needed for unordered_map) | ||
| 389 | template<> | ||
| 390 | struct hash<NAV::SatelliteSystem_> | ||
| 391 | { | ||
| 392 | /// @brief Hash function for SatelliteSystem | ||
| 393 | /// @param[in] satSys Satellite system | ||
| 394 | 3207338 | std::size_t operator()(const NAV::SatelliteSystem_& satSys) const | |
| 395 | { | ||
| 396 | using namespace NAV; // NOLINT(google-build-using-namespace) | ||
| 397 |
8/9✓ Branch 0 taken 400 times.
✓ Branch 1 taken 1441133 times.
✓ Branch 2 taken 1247880 times.
✓ Branch 3 taken 155174 times.
✓ Branch 4 taken 229104 times.
✓ Branch 5 taken 111934 times.
✓ Branch 6 taken 14609 times.
✓ Branch 7 taken 7220 times.
✗ Branch 8 not taken.
|
3207338 | switch (satSys) |
| 398 | { | ||
| 399 | 400 | case SatSys_None: | |
| 400 | 400 | return 1; | |
| 401 | 1441133 | case GPS: | |
| 402 | 1441133 | return 100; | |
| 403 | 1247880 | case GAL: | |
| 404 | 1247880 | return 200; | |
| 405 | 155174 | case GLO: | |
| 406 | 155174 | return 300; | |
| 407 | 229104 | case BDS: | |
| 408 | 229104 | return 400; | |
| 409 | 111934 | case QZSS: | |
| 410 | 111934 | return 500; | |
| 411 | 14609 | case IRNSS: | |
| 412 | 14609 | return 600; | |
| 413 | 7220 | case SBAS: | |
| 414 | 7220 | return 700; | |
| 415 | } | ||
| 416 | ✗ | return 0; | |
| 417 | } | ||
| 418 | }; | ||
| 419 | /// @brief Hash function for SatelliteSystem (needed for unordered_map) | ||
| 420 | template<> | ||
| 421 | struct hash<NAV::SatelliteSystem> | ||
| 422 | { | ||
| 423 | /// @brief Hash function for SatelliteSystem | ||
| 424 | /// @param[in] satSys Satellite system | ||
| 425 | 651361 | std::size_t operator()(const NAV::SatelliteSystem& satSys) const | |
| 426 | { | ||
| 427 | 651361 | return std::hash<NAV::SatelliteSystem_>()(NAV::SatelliteSystem_(satSys)); | |
| 428 | } | ||
| 429 | }; | ||
| 430 | } // namespace std | ||
| 431 | |||
| 432 | #ifndef DOXYGEN_IGNORE | ||
| 433 | |||
| 434 | /// @brief Formatter for SatelliteSystem | ||
| 435 | template<> | ||
| 436 | struct fmt::formatter<NAV::SatelliteSystem> : fmt::formatter<std::string> | ||
| 437 | { | ||
| 438 | /// @brief Defines how to format SatelliteSystem structs | ||
| 439 | /// @param[in] satSys Struct to format | ||
| 440 | /// @param[in, out] ctx Format context | ||
| 441 | /// @return Output iterator | ||
| 442 | template<typename FormatContext> | ||
| 443 | 38591 | auto format(const NAV::SatelliteSystem& satSys, FormatContext& ctx) const | |
| 444 | { | ||
| 445 |
2/4✓ Branch 1 taken 38591 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 38591 times.
✗ Branch 6 not taken.
|
38591 | return fmt::formatter<std::string>::format(std::string(satSys), ctx); |
| 446 | } | ||
| 447 | }; | ||
| 448 | |||
| 449 | #endif | ||
| 450 |