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;
128 const uniset::ObjectId node_on_s;
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;
149 const uniset::ObjectId node_undef_c;
152 const uniset::ObjectId node_check_undef_s;
155 const uniset::ObjectId node_t_set_c;
158 const uniset::ObjectId node_t_check_s;
161 const uniset::ObjectId node_log_c;
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;
205 virtual
void callback() noexcept override;
207 virtual
void sysCommand( const uniset::SystemMessage* sm ){};
208 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
211 virtual void sigterm(
int signo )
override;
216 virtual void step(){}
218 void preAskSensors( UniversalIO::UIOCommand cmd );
221 virtual void testMode(
bool state );
222 void updateOutputs(
bool force );
235 const std::string argprefix;
250 std::atomic_bool activated;
258 std::shared_ptr<uniset::LogAgregator> loga;
259 std::shared_ptr<DebugStream> mylog;
260 std::shared_ptr<uniset::LogServer> logserv;
261 std::string logserv_host = {
""};
262 int logserv_port = {0};
275 long prev_out_lamp_c;
276 long prev_out_depend_c;
277 long prev_in_d1_check_s;
278 long prev_in_d2_check_s;
279 long prev_out_set_d1_check_s;
280 long prev_out_set_d2_check_s;
281 long prev_out_undef_c;
282 long prev_in_check_undef_s;
283 long prev_out_t_set_c;
284 long prev_in_t_check_s;
291 long priv_in_d1_check_s;
292 long priv_in_d2_check_s;
293 long priv_in_check_undef_s;
294 long priv_in_t_check_s;
301 void updatePreviousValues() noexcept;
302 void preSensorInfo( const uniset::SensorMessage* sm );
303 void preTimerInfo( const uniset::TimerMessage* tm );
313 return std::hash<long>()(key);
317 std::unordered_map<const uniset::ObjectId,size_t, StatHashFn> smStat;
318 size_t processingMessageCatchCount = { 0 };
320 std::string ostate = {
"" };
327 #endif // TestProc_SK_H_