GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
signal_enabled_flags.h
Go to the documentation of this file.
1 /*!
2  * \file signal_enabled_flags.h
3  * \brief Class to check the enabled signals
4  * \author Mathieu Favreau, 2025. favreau.mathieu(at)hotmail.com
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 #ifndef GNSS_SDR_SIGNAL_ENABLED_FLAGS_H
18 #define GNSS_SDR_SIGNAL_ENABLED_FLAGS_H
19 
20 #include <cstdint>
21 
23 
24 enum signal_flag : uint32_t
25 {
26  GPS_1C = 0x1 << 0,
27  GPS_2S = 0x1 << 1,
28  GPS_L5 = 0x1 << 2,
29  GAL_1B = 0x1 << 3,
30  GAL_E5a = 0x1 << 4,
31  GAL_E5b = 0x1 << 5,
32  GAL_E6 = 0x1 << 6,
33  GLO_1G = 0x1 << 7,
34  GLO_2G = 0x1 << 8,
35  BDS_B1 = 0x1 << 9,
36  BDS_B3 = 0x1 << 10,
37  QZS_J1 = 0x1 << 11,
38  QZS_J5 = 0x1 << 12
39 };
40 
42 {
43 public:
44  explicit Signal_Enabled_Flags(const ConfigurationInterface* configuration);
45  explicit Signal_Enabled_Flags(uint32_t flags_);
46 
47  template <typename T>
48  uint32_t or_all(const T& value) const
49  {
50  return value;
51  }
52 
53  template <typename T, typename... Args>
54  uint32_t or_all(const T& first, const Args&... rest) const
55  {
56  return first | or_all(rest...);
57  }
58 
59  template <typename... Args>
60  bool check_only_enabled(const Args&... args) const
61  {
62  return (flags ^ or_all(args...)) == 0;
63  }
64 
65  template <typename... Args>
66  bool check_any_enabled(const Args&... args) const
67  {
68  return (flags & or_all(args...)) > 0;
69  }
70 
71  const uint32_t flags;
72 
73  const bool has_gps;
74  const bool has_galileo;
75  const bool has_glonass;
76  const bool has_beidou;
77  const bool has_qzss;
78 
79  const bool only_gps;
80  const bool only_galileo;
81  const bool only_glonass;
82  const bool only_beidou;
83  const bool only_qzss;
84 };
85 
86 #endif // GNSS_SDR_SIGNAL_ENABLED_FLAGS_H
This abstract class represents an interface to configuration parameters.