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