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_IRNSS = 7;
|
---|
15 | static const unsigned MAXPRN = MAXPRN_GPS + MAXPRN_GLONASS + MAXPRN_GALILEO
|
---|
16 | + MAXPRN_QZSS + MAXPRN_SBAS + MAXPRN_BDS + MAXPRN_IRNSS;
|
---|
17 |
|
---|
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 | }
|
---|
24 |
|
---|
25 | t_prn(char system, int number, int flags) :
|
---|
26 | _system(system), _number(number), _flags(flags) {
|
---|
27 | }
|
---|
28 |
|
---|
29 | ~t_prn() {
|
---|
30 | }
|
---|
31 |
|
---|
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 |
|
---|
44 | void setFlags(int flags) {
|
---|
45 | _flags = flags;
|
---|
46 | }
|
---|
47 |
|
---|
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;
|
---|
60 | std::string toString() const;
|
---|
61 | std::string toInternalString() const;
|
---|
62 |
|
---|
63 | bool operator==(const t_prn& prn2) const {
|
---|
64 | if (_system == prn2._system && _number == prn2._number
|
---|
65 | && _flags == prn2._flags) {
|
---|
66 | return true;
|
---|
67 | }
|
---|
68 | else {
|
---|
69 | return false;
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Cleanup function resets all elements to initial state.
|
---|
75 | */
|
---|
76 | inline void clear(void) {
|
---|
77 | _system = 'G';
|
---|
78 | _number = 0;
|
---|
79 | _flags = 0;
|
---|
80 | }
|
---|
81 |
|
---|
82 | operator unsigned() const;
|
---|
83 |
|
---|
84 | friend std::istream& operator >>(std::istream& in, t_prn& prn);
|
---|
85 |
|
---|
86 | private:
|
---|
87 | char _system;
|
---|
88 | int _number;
|
---|
89 | int _flags;
|
---|
90 | };
|
---|
91 |
|
---|
92 | std::istream& operator >>(std::istream& in, t_prn& prn);
|
---|
93 |
|
---|
94 | #endif
|
---|