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