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 = 65;
|
---|
14 | static const unsigned MAXPRN_IRNSS = 20;
|
---|
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 &&
|
---|
65 | _number == prn2._number &&
|
---|
66 | _flags == prn2._flags) {
|
---|
67 | return true;
|
---|
68 | }
|
---|
69 | else {
|
---|
70 | return false;
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Cleanup function resets all elements to initial state.
|
---|
76 | */
|
---|
77 | inline void clear(void) {
|
---|
78 | _system = 'G';
|
---|
79 | _number = 0;
|
---|
80 | _flags = 0;
|
---|
81 | }
|
---|
82 |
|
---|
83 | operator unsigned() const;
|
---|
84 |
|
---|
85 | friend std::istream& operator >>(std::istream& in, t_prn& prn);
|
---|
86 |
|
---|
87 | private:
|
---|
88 | char _system;
|
---|
89 | int _number;
|
---|
90 | int _flags;
|
---|
91 | };
|
---|
92 |
|
---|
93 | std::istream& operator >>(std::istream& in, t_prn& prn);
|
---|
94 |
|
---|
95 | #endif
|
---|