BPNGClientLib
Library for accessing the Telemotive data logger devices
OnlineLoggerInfoWrapper.hh
Go to the documentation of this file.
1 //************************************************************
2 //
7 //************************************************************
8 
9 #ifndef ONLINELOGGERINFOWRAPPER_HH
10 #define ONLINELOGGERINFOWRAPPER_HH
11 
12 // sys
13 #include <cstdlib>
14 #include <cstring>
15 #include <vector>
16 #include <iosfwd>
17 
18 // client
19 #include <IBPNGClient.h>
20 
21 
22 //************************************************************
23 //
24 // OnlineLoggerInfoWrapper
25 //
27 //
28 //************************************************************
29 
31 {
32 public:
33 
36 
38  OnlineLoggerInfoWrapper(const char *_ip, const char *_name);
39 
42 
45 
48 
51 
54 
57 
60 
62  const OnlineLoggerInfo & getInfo() const;
63 
65  void setIP(const char *_ip);
66 
68  const char * getIP() const;
69 
71  void setName(const char *_ip);
72 
74  const char * getName() const;
75 
77  void setMbnr(const char *_ip);
78 
80  const char * getMbnr() const;
81 
83  int32_t getTslNetworkId() const;
84 
86  friend std::ostream & operator<<(std::ostream &os, const OnlineLoggerInfoWrapper &oli);
87 
88 
89 private:
90 
92  static char *emptyString();
93 
95  static char *dupString(const char *sorig);
96 
98  static void emptyAll(OnlineLoggerInfoWrapper &dst);
99 
101  static void duplicateAll(OnlineLoggerInfoWrapper &dst, const OnlineLoggerInfo &info);
102 
104  void deleteAll();
105 };
106 
107 
108 // inline and template functions
109 
110 inline
112 {
113  OnlineLoggerInfo::operator=(createEmptyOnlineLoggerInfo());
114  emptyAll(*this);
115 }
116 
117 
118 inline
120 {
121  OnlineLoggerInfo::operator=(info);
122  duplicateAll(*this, info);
123 }
124 
125 
126 inline
128 {
129  OnlineLoggerInfo::operator=(info);
130  duplicateAll(*this, info);
131 }
132 
133 
134 inline
136 {
137  // get all members 1:1
138  OnlineLoggerInfo::operator=(info);
139 
140  // fill the RHS with empty strings
141  emptyAll(info);
142 }
143 
144 
145 inline
147 {
148  deleteAll();
149 }
150 
151 
152 inline
155 {
156  deleteAll();
157  OnlineLoggerInfo::operator=(info);
158  duplicateAll(*this, info);
159 
160  return *this;
161 }
162 
163 
164 inline const OnlineLoggerInfo &
166 {
167  return *this;
168 }
169 
170 
171 inline const char *
173 {
174  return ip;
175 }
176 
177 
178 inline const char *
180 {
181  return name;
182 }
183 
184 
185 inline const char *
187 {
188  return mbnr;
189 }
190 
191 
192 inline int32_t
194 {
195  return tslNetworkId;
196 }
197 
198 
201 {
202  return operator= (info.getInfo());
203 }
204 
205 
206 extern std::ostream & operator<<(std::ostream &os, const OnlineLoggerInfoWrapper &oli);
207 extern std::ostream & operator<<(std::ostream &os, const std::vector<OnlineLoggerInfoWrapper> &list);
208 
209 #endif // ONLINELOGGERINFOWRAPPER_HH
const char * getMbnr() const
Get logger&#39;s mainboard number.
Definition: OnlineLoggerInfoWrapper.hh:186
const char * mbnr
mainboard number
Definition: BPNGDefines.h:659
Struct with information about a logger found in LAN/WLAN used to notify IBPNGClientListener about det...
Definition: BPNGDefines.h:655
void setName(const char *_ip)
Set logger&#39;s name.
OnlineLoggerInfoWrapper & operator=(const OnlineLoggerInfo &info)
Copy assignement from the "original".
Definition: OnlineLoggerInfoWrapper.hh:154
void setMbnr(const char *_ip)
Set logger&#39;s mainboard number.
~OnlineLoggerInfoWrapper()
DTOR.
Definition: OnlineLoggerInfoWrapper.hh:146
const OnlineLoggerInfo & getInfo() const
Get OnlineLoggerInfo.
Definition: OnlineLoggerInfoWrapper.hh:165
Wrapper around brain dead OnlineLoggerInfo.
Definition: OnlineLoggerInfoWrapper.hh:30
void setIP(const char *_ip)
Set logger&#39;s IP.
DECLDIR OnlineLoggerInfo createEmptyOnlineLoggerInfo()
friend std::ostream & operator<<(std::ostream &os, const OnlineLoggerInfoWrapper &oli)
Output operator.
const char * getName() const
Get logger&#39;s name.
Definition: OnlineLoggerInfoWrapper.hh:179
int32_t tslNetworkId
id of tsl network, -1 = no TSL, all devices with same tslNetworkId belong to the same TSL ...
Definition: BPNGDefines.h:668
OnlineLoggerInfoWrapper()
Default CTOR.
Definition: OnlineLoggerInfoWrapper.hh:111
const char * getIP() const
Get logger&#39;s IP.
Definition: OnlineLoggerInfoWrapper.hh:172
Interface class for the BPNGClient DLL.
const char * ip
the logger&#39;s ip address, obligatory if OnlineLoggerInfo is used with IBPNGClient::setDevice() ...
Definition: BPNGDefines.h:657
const char * name
the logger&#39;s name
Definition: BPNGDefines.h:658
int32_t getTslNetworkId() const
Get logger&#39;s TSL network ID.
Definition: OnlineLoggerInfoWrapper.hh:193