| [5741] | 1 | #ifndef PRN_H
|
|---|
| 2 | #define PRN_H
|
|---|
| 3 |
|
|---|
| 4 | #include <string>
|
|---|
| 5 |
|
|---|
| 6 | class t_prn {
|
|---|
| [6809] | 7 | public:
|
|---|
| [9024] | 8 | static const unsigned MAXPRN_GPS = 32;
|
|---|
| [5741] | 9 | static const unsigned MAXPRN_GLONASS = 26;
|
|---|
| [6321] | 10 | static const unsigned MAXPRN_GALILEO = 36;
|
|---|
| [9024] | 11 | static const unsigned MAXPRN_QZSS = 10;
|
|---|
| 12 | static const unsigned MAXPRN_SBAS = 38;
|
|---|
| 13 | static const unsigned MAXPRN_BDS = 65;
|
|---|
| [10619] | 14 | static const unsigned MAXPRN_NavIC = 20;
|
|---|
| [6809] | 15 | static const unsigned MAXPRN = MAXPRN_GPS + MAXPRN_GLONASS + MAXPRN_GALILEO
|
|---|
| [10619] | 16 | + MAXPRN_QZSS + MAXPRN_SBAS + MAXPRN_BDS + MAXPRN_NavIC;
|
|---|
| [5741] | 17 |
|
|---|
| [10791] | 18 | t_prn() : _system('G'), _number(0), _flag(0) {}
|
|---|
| 19 | t_prn(char system, int number) : _system(system), _number(number), _flag(0) {}
|
|---|
| 20 | t_prn(char system, int number, int flag) : _system(system), _number(number), _flag(flag) {}
|
|---|
| 21 | ~t_prn() {}
|
|---|
| [5741] | 22 |
|
|---|
| [10791] | 23 | bool valid() const {
|
|---|
| 24 | return _number != 0;
|
|---|
| [6809] | 25 | }
|
|---|
| [5741] | 26 |
|
|---|
| [6809] | 27 | void set(char system, int number) {
|
|---|
| 28 | _system = system;
|
|---|
| 29 | _number = number;
|
|---|
| [10599] | 30 | _flag = 0;
|
|---|
| [6809] | 31 | }
|
|---|
| 32 |
|
|---|
| [10599] | 33 | void set(char system, int number, int flag) {
|
|---|
| [6809] | 34 | _system = system;
|
|---|
| 35 | _number = number;
|
|---|
| [10599] | 36 | _flag = flag;
|
|---|
| [6809] | 37 | }
|
|---|
| 38 |
|
|---|
| [10791] | 39 | void set(unsigned nn);
|
|---|
| 40 |
|
|---|
| [10599] | 41 | void setFlag(int flag) {
|
|---|
| 42 | _flag = flag;
|
|---|
| [7004] | 43 | }
|
|---|
| 44 |
|
|---|
| [6809] | 45 | void set(const std::string& str);
|
|---|
| 46 |
|
|---|
| 47 | char system() const {
|
|---|
| 48 | return _system;
|
|---|
| 49 | }
|
|---|
| 50 | int number() const {
|
|---|
| 51 | return _number;
|
|---|
| 52 | }
|
|---|
| [10599] | 53 | int flag() const {
|
|---|
| 54 | return _flag;
|
|---|
| [6809] | 55 | }
|
|---|
| 56 | int toInt() const;
|
|---|
| [5741] | 57 | std::string toString() const;
|
|---|
| [6809] | 58 | std::string toInternalString() const;
|
|---|
| [5741] | 59 |
|
|---|
| 60 | bool operator==(const t_prn& prn2) const {
|
|---|
| [8797] | 61 | if (_system == prn2._system &&
|
|---|
| 62 | _number == prn2._number &&
|
|---|
| [10599] | 63 | _flag == prn2._flag) {
|
|---|
| [5741] | 64 | return true;
|
|---|
| 65 | }
|
|---|
| 66 | else {
|
|---|
| 67 | return false;
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| [6812] | 71 | /**
|
|---|
| 72 | * Cleanup function resets all elements to initial state.
|
|---|
| 73 | */
|
|---|
| [6813] | 74 | inline void clear(void) {
|
|---|
| [6812] | 75 | _system = 'G';
|
|---|
| 76 | _number = 0;
|
|---|
| [10599] | 77 | _flag = 0;
|
|---|
| [6812] | 78 | }
|
|---|
| 79 |
|
|---|
| [5741] | 80 | operator unsigned() const;
|
|---|
| 81 |
|
|---|
| [6809] | 82 | friend std::istream& operator >>(std::istream& in, t_prn& prn);
|
|---|
| [5741] | 83 |
|
|---|
| [6809] | 84 | private:
|
|---|
| [5741] | 85 | char _system;
|
|---|
| [10599] | 86 | int _number;
|
|---|
| 87 | int _flag;
|
|---|
| [5741] | 88 | };
|
|---|
| 89 |
|
|---|
| [6809] | 90 | std::istream& operator >>(std::istream& in, t_prn& prn);
|
|---|
| [5741] | 91 |
|
|---|
| 92 | #endif
|
|---|