[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 |
|
---|
| 43 | void set(const std::string& str);
|
---|
| 44 |
|
---|
| 45 | char system() const {
|
---|
| 46 | return _system;
|
---|
| 47 | }
|
---|
| 48 | int number() const {
|
---|
| 49 | return _number;
|
---|
| 50 | }
|
---|
| 51 | int flags() const {
|
---|
| 52 | return _flags;
|
---|
| 53 | }
|
---|
| 54 | int toInt() const;
|
---|
[5741] | 55 | std::string toString() const;
|
---|
[6809] | 56 | std::string toInternalString() const;
|
---|
[5741] | 57 |
|
---|
| 58 | bool operator==(const t_prn& prn2) const {
|
---|
[6809] | 59 | if (_system == prn2._system && _number == prn2._number
|
---|
| 60 | && _flags == prn2._flags) {
|
---|
[5741] | 61 | return true;
|
---|
| 62 | }
|
---|
| 63 | else {
|
---|
| 64 | return false;
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[6812] | 68 | /**
|
---|
| 69 | * Cleanup function resets all elements to initial state.
|
---|
| 70 | */
|
---|
[6813] | 71 | inline void clear(void) {
|
---|
[6812] | 72 | _system = 'G';
|
---|
| 73 | _number = 0;
|
---|
[6813] | 74 | _flags = 0;
|
---|
[6812] | 75 | }
|
---|
| 76 |
|
---|
[5741] | 77 | operator unsigned() const;
|
---|
| 78 |
|
---|
[6809] | 79 | friend std::istream& operator >>(std::istream& in, t_prn& prn);
|
---|
[5741] | 80 |
|
---|
[6809] | 81 | private:
|
---|
[5741] | 82 | char _system;
|
---|
[6809] | 83 | int _number;
|
---|
| 84 | int _flags;
|
---|
[5741] | 85 | };
|
---|
| 86 |
|
---|
[6809] | 87 | std::istream& operator >>(std::istream& in, t_prn& prn);
|
---|
[5741] | 88 |
|
---|
| 89 | #endif
|
---|