13 #ifndef TestProc_SK_H_
14 #define TestProc_SK_H_
18 #include <unordered_map>
20 #include "UniSetObject.h"
23 #include "DebugStream.h"
24 #include "LogServer.h"
25 #include "LogAgregator.h"
46 inline std::shared_ptr<
DebugStream> log() noexcept {
return mylog; }
47 inline std::shared_ptr<uniset::LogAgregator> logAgregator() noexcept {
return loga; }
49 void init_dlog( std::shared_ptr<DebugStream> d ) noexcept;
53 #define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
56 #define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
59 #define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
62 #define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
65 #define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
68 #define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
71 #define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
74 #define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
77 #define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
80 #define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
83 #define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
86 #define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
89 #define mylogany log()->any()
92 #define vmonit( var ) vmon.add( #var, var )
121 std::string help() noexcept;
127 const uniset::ObjectId
on_s;
128 const uniset::ObjectId node_on_s;
130 const uniset::ObjectId
lamp_c;
131 const uniset::ObjectId node_lamp_c;
134 const uniset::ObjectId node_depend_c;
137 const uniset::ObjectId node_d1_check_s;
140 const uniset::ObjectId node_d2_check_s;
143 const uniset::ObjectId node_set_d1_check_s;
146 const uniset::ObjectId node_set_d2_check_s;
148 const uniset::ObjectId
undef_c;
149 const uniset::ObjectId node_undef_c;
152 const uniset::ObjectId node_check_undef_s;
154 const uniset::ObjectId
t_set_c;
155 const uniset::ObjectId node_t_set_c;
158 const uniset::ObjectId node_t_check_s;
160 const uniset::ObjectId
log_c;
161 const uniset::ObjectId node_log_c;
163 const uniset::ObjectId
log_s;
164 const uniset::ObjectId node_log_s;
174 const
long& in_d1_check_s;
175 const
long& in_d2_check_s;
176 long out_set_d1_check_s;
177 long out_set_d2_check_s;
179 const
long& in_check_undef_s;
181 const
long& in_t_check_s;
183 const
long& in_log_s;
202 virtual
void callback() noexcept override;
204 virtual
void sysCommand( const uniset::SystemMessage* sm ){};
205 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
208 virtual void sigterm(
int signo )
override;
213 virtual void step(){}
215 void preAskSensors( UniversalIO::UIOCommand cmd );
218 virtual void testMode(
bool state );
219 void updateOutputs(
bool force );
232 const std::string argprefix;
247 std::atomic_bool activated;
255 std::shared_ptr<uniset::LogAgregator> loga;
256 std::shared_ptr<DebugStream> mylog;
257 std::shared_ptr<uniset::LogServer> logserv;
258 std::string logserv_host = {
""};
259 int logserv_port = {0};
272 long prev_out_lamp_c;
273 long prev_out_depend_c;
274 long prev_in_d1_check_s;
275 long prev_in_d2_check_s;
276 long prev_out_set_d1_check_s;
277 long prev_out_set_d2_check_s;
278 long prev_out_undef_c;
279 long prev_in_check_undef_s;
280 long prev_out_t_set_c;
281 long prev_in_t_check_s;
288 long priv_in_d1_check_s;
289 long priv_in_d2_check_s;
290 long priv_in_check_undef_s;
291 long priv_in_t_check_s;
298 void updatePreviousValues() noexcept;
299 void preSensorInfo( const uniset::SensorMessage* sm );
300 void preTimerInfo( const uniset::TimerMessage* tm );
310 return std::hash<long>()(key);
314 std::unordered_map<const uniset::ObjectId,size_t, StatHashFn> smStat;
315 size_t processingMessageCatchCount = { 0 };
317 std::string ostate = {
"" };
324 #endif // TestProc_SK_H_