| 1 | #ifndef PRN_H
|
|---|
| 2 | #define PRN_H
|
|---|
| 3 |
|
|---|
| 4 | #include <string>
|
|---|
| 5 |
|
|---|
| 6 | class t_prn {
|
|---|
| 7 | public:
|
|---|
| 8 | static const unsigned MAXPRN_GPS = 32;
|
|---|
| 9 | static const unsigned MAXPRN_GLONASS = 26;
|
|---|
| 10 | static const unsigned MAXPRN_GALILEO = 36;
|
|---|
| 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;
|
|---|
| 16 |
|
|---|
| 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 | }
|
|---|
| 23 |
|
|---|
| 24 | t_prn(char system, int number, int flags) :
|
|---|
| 25 | _system(system), _number(number), _flags(flags) {
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | ~t_prn() {
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 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 setFlags(int flags) {
|
|---|
| 44 | _flags = flags;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 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;
|
|---|
| 59 | std::string toString() const;
|
|---|
| 60 | std::string toInternalString() const;
|
|---|
| 61 |
|
|---|
| 62 | bool operator==(const t_prn& prn2) const {
|
|---|
| 63 | if (_system == prn2._system && _number == prn2._number
|
|---|
| 64 | && _flags == prn2._flags) {
|
|---|
| 65 | return true;
|
|---|
| 66 | }
|
|---|
| 67 | else {
|
|---|
| 68 | return false;
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | /**
|
|---|
| 73 | * Cleanup function resets all elements to initial state.
|
|---|
| 74 | */
|
|---|
| 75 | inline void clear(void) {
|
|---|
| 76 | _system = 'G';
|
|---|
| 77 | _number = 0;
|
|---|
| 78 | _flags = 0;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | operator unsigned() const;
|
|---|
| 82 |
|
|---|
| 83 | friend std::istream& operator >>(std::istream& in, t_prn& prn);
|
|---|
| 84 |
|
|---|
| 85 | private:
|
|---|
| 86 | char _system;
|
|---|
| 87 | int _number;
|
|---|
| 88 | int _flags;
|
|---|
| 89 | };
|
|---|
| 90 |
|
|---|
| 91 | std::istream& operator >>(std::istream& in, t_prn& prn);
|
|---|
| 92 |
|
|---|
| 93 | #endif
|
|---|