Commit 3de2c879 authored by Pavel Vainerman's avatar Pavel Vainerman

make style..

parent d40f8a8c
......@@ -55,7 +55,7 @@ static void print_help()
// --------------------------------------------------------------------------
int main( int argc, char** argv )
{
// std::ios::sync_with_stdio(false); // нельзя отключать.. тогда "обмен с сервером" рассинхронизируется
// std::ios::sync_with_stdio(false); // нельзя отключать.. тогда "обмен с сервером" рассинхронизируется
int optindex = 0;
int opt = 0;
......
......@@ -34,7 +34,7 @@ static void print_help()
// --------------------------------------------------------------------------
int main( int argc, char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
int optindex = 0;
int opt = 0;
......
......@@ -13,6 +13,7 @@ int main( int argc, const char** argv )
auto conf = uniset_init(argc, argv);
xmlNode* cnode = conf->getNode("Skel");
if( cnode == NULL )
{
cerr << "(Skel): not found <Skel> in conffile" << endl;
......
......@@ -145,8 +145,14 @@ class DBServer_MySQL:
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return dblog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return dblog;
}
protected:
typedef std::map<int, std::string> DBTableMap;
......
......@@ -8,7 +8,7 @@ using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
try
{
......
......@@ -21,8 +21,14 @@ class DBServer_PostgreSQL:
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return dblog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return dblog;
}
protected:
typedef std::map<int, std::string> DBTableMap;
......
......@@ -8,7 +8,7 @@ using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
try
{
......
......@@ -145,8 +145,14 @@ class DBServer_SQLite:
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return dblog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return dblog;
}
protected:
typedef std::map<int, std::string> DBTableMap;
......
......@@ -13,7 +13,7 @@ static void short_usage()
// --------------------------------------------------------------------------
int main(int argc, char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
try
{
......
......@@ -76,7 +76,7 @@ static struct option longopts[] =
// --------------------------------------------------------------------------
int main(int argc, char* argv[])
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
comedi_t* card;
const char* dev = "/dev/comedi0";
lsampl_t data = 0;
......
......@@ -11,7 +11,7 @@ using namespace UniSetExtensions;
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && strcmp(argv[1], "--help") == 0 )
{
......
......@@ -9,7 +9,7 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
try
{
......
......@@ -11,7 +11,7 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
......
......@@ -217,8 +217,14 @@ class MBExchange:
void execute();
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return mblog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return mblog;
}
protected:
virtual void step();
......
......@@ -14,7 +14,7 @@ static void print_help()
// --------------------------------------------------------------------------
int main( int argc, const char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
unsigned short v1 = 0;
unsigned short v2 = 0;
const char* type = "";
......
......@@ -58,7 +58,7 @@ static void readMTR( ModbusRTUMaster* mb, ModbusRTU::ModbusAddr addr,
int main( int argc, char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
Command cmd = cmdNOP;
int optindex = 0;
int opt = 0;
......
......@@ -74,7 +74,7 @@ static char* checkArg( int ind, int argc, char* argv[] );
// --------------------------------------------------------------------------
int main( int argc, char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
Command cmd = cmdNOP;
int optindex = 0;
int opt = 0;
......
......@@ -9,7 +9,7 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main( int argc, char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
try
{
......
......@@ -349,8 +349,14 @@ class MBSlave:
return askCount;
}
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return mblog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return mblog;
}
protected:
......
......@@ -15,7 +15,7 @@ using namespace std;
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
......
......@@ -15,7 +15,7 @@ using namespace std;
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
......
......@@ -72,8 +72,14 @@ class RRDServer:
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return mylog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return mylog;
}
protected:
RRDServer();
......
......@@ -11,7 +11,7 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
......
......@@ -539,7 +539,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
{
try
{
ui->send(it,tm);
ui->send(it, tm);
ok = true;
break;
}
......
......@@ -374,8 +374,14 @@ class SharedMemory:
return histSaveTime; /*!< период между точками "дампа", мсек */
}
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return smlog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return smlog;
}
protected:
typedef std::list<Restorer_XML::ReaderSlot> ReadSlotList;
......
......@@ -10,7 +10,7 @@ using namespace UniSetExtensions;
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{
......
......@@ -14,12 +14,18 @@ class TestObject:
void askNotifyChange();
void askNotifyFirstNotNull();
inline bool getEvnt(){ return evntIsOK; }
inline bool getEvnt()
{
return evntIsOK;
}
void stopHeartbeat();
void runHeartbeat( int max=3 );
void runHeartbeat( int max = 3 );
inline timeout_t getHeartbeatTime(){ return ptHeartBeat.getInterval(); }
inline timeout_t getHeartbeatTime()
{
return ptHeartBeat.getInterval();
}
protected:
TestObject();
......
......@@ -65,7 +65,7 @@ int main(int argc, char* argv[] )
xmlNode* o_node = conf->getNode("TestObject");
obj = make_shared<TestObject>(o_id,o_node);
obj = make_shared<TestObject>(o_id, o_node);
act->add(obj);
auto nullsm = make_shared<NullSM>(ns_id, "reserv-sm-configure.xml");
......
......@@ -35,7 +35,7 @@ std::list< ThreadCreator<IOControl>* > lst_iothr;
// --------------------------------------------------------------------------
int main( int argc, const char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{
......
......@@ -99,8 +99,14 @@ class UNetExchange:
bool checkExistUNetHost( const std::string& host, ost::tpport_t port );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; }
inline std::shared_ptr<DebugStream> log(){ return unetlog; }
inline std::shared_ptr<LogAgregator> getLogAggregator()
{
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return unetlog;
}
protected:
......
......@@ -9,7 +9,7 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
{
// std::ios::sync_with_stdio(false);
// std::ios::sync_with_stdio(false);
try
{
......
......@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2015-05-24+03:00
// generate timestamp: 2015-05-30+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......
......@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2015-05-24+03:00
// generate timestamp: 2015-05-30+03:00
// -----------------------------------------------------------------------------
#include <memory>
#include "Configuration.h"
......@@ -117,17 +117,17 @@ UObject_SK::UObject_SK( ObjectId id, xmlNode* cnode, const std::string& _argpref
loga->add(ulog());
logserv = make_shared<LogServer>(loga);
logserv->init( argprefix + "-logserver", confnode );
logserv->init( argprefix + "logserver", confnode );
UniXML::iterator it(cnode);
// ------- init logserver ---
if( findArgParam("--" + argprefix + "-run-logserver", conf->getArgc(), conf->getArgv()) != -1 )
if( findArgParam("--" + argprefix + "run-logserver", conf->getArgc(), conf->getArgv()) != -1 )
{
logserv_host = conf->getArg2Param("--" + argprefix + "-logserver-host", it.getProp("logserverHost"), "localhost");
logserv_port = conf->getArgPInt("--" + argprefix + "-logserver-port", it.getProp("logserverPort"), getId());
logserv_host = conf->getArg2Param("--" + argprefix + "logserver-host", it.getProp("logserverHost"), "localhost");
logserv_port = conf->getArgPInt("--" + argprefix + "logserver-port", it.getProp("logserverPort"), getId());
}
forceOut = conf->getArgPInt("--" + argprefix + "force-out", it.getProp("forceOut"), false);
......@@ -309,7 +309,7 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm )
switch( _sm->command )
{
case SystemMessage::WatchDog:
ulogany << myname << "(preSysCommand): WatchDog" << endl;
uinfo << myname << "(preSysCommand): WatchDog" << endl;
if( !active || !ptStartUpTimeout.checkTime() )
{
......@@ -458,9 +458,16 @@ void UObject_SK::callback()
// "сердцебиение"
if( idHeartBeat != DefaultObjectId && ptHeartBeat.checkTime() )
{
ui->setValue(idHeartBeat, maxHeartBeat, UniversalIO::AI);
try
{
ui->setValue(idHeartBeat, maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception& ex )
{
ucrit << myname << "(execute): " << ex << endl;
}
}
// обновление выходов
updateOutputs(forceOut);
......
......@@ -55,7 +55,7 @@ class Pulse
ostate = false;
// учитываем что step мог вызваться гораздо позже..
t0.setTiming( t0_msec - t1.getCurrent()%t1.getInterval() );
t0.setTiming( t0_msec - t1.getCurrent() % t1.getInterval() );
}
if( !ostate && t0.checkTime() )
......@@ -63,7 +63,7 @@ class Pulse
ostate = true;
// учитываем что step мог вызваться гораздо позже..
t1.setTiming(t1_msec - t0.getCurrent()%t0.getInterval() );
t1.setTiming(t1_msec - t0.getCurrent() % t0.getInterval() );
}
return ostate;
......
......@@ -113,7 +113,7 @@ std::list<LogAgregator::LogInfo> LogAgregator::getLogList()
{
std::list<LogAgregator::LogInfo> l;
for( auto&& i : lmap )
for( auto && i : lmap )
l.push_back(i.second);
return std::move(l);
......@@ -122,10 +122,12 @@ std::list<LogAgregator::LogInfo> LogAgregator::getLogList()
std::list<LogAgregator::LogInfo> LogAgregator::getLogList( const std::string& regex_str )
{
std::list<LogAgregator::LogInfo> l;
try
{
std::regex rule(regex_str);
for( auto&& i : lmap )
for( auto && i : lmap )
{
if( std::regex_match(i.second.log->getLogName(), rule) )
l.push_back(i.second);
......
......@@ -177,6 +177,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
if( tcp->isPending(ost::Socket::pendingOutput, outTimeout) )
{
rlog.info() << "(LogReader): ** send command: cmd='" << msg.cmd << "' logname='" << msg.logname << "' data='" << msg.data << "'" << endl;
for( size_t i = 0; i < sizeof(msg); i++ )
(*tcp) << ((unsigned char*)(&msg))[i];
......@@ -186,14 +187,14 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
else
rlog.warn() << "(LogReader): **** SEND COMMAND ('" << msg.cmd << "' FAILED!" << endl;
if( cmdonly && msg.cmd!=LogServerTypes::cmdList )
if( cmdonly && msg.cmd != LogServerTypes::cmdList )
{
disconnect();
return;
}
}
while( (!cmdonly || msg.cmd==LogServerTypes::cmdList) && tcp->isPending(ost::Socket::pendingInput, inTimeout) )
while( (!cmdonly || msg.cmd == LogServerTypes::cmdList) && tcp->isPending(ost::Socket::pendingInput, inTimeout) )
{
int n = tcp->peek( buf, sizeof(buf) - 1 );
......@@ -203,7 +204,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
buf[n] = '\0';
log << buf;
if( msg.cmd==LogServerTypes::cmdList )
if( msg.cmd == LogServerTypes::cmdList )
break;
}
else
......
......@@ -149,6 +149,7 @@ void LogSession::run()
}
s << "=====================" << endl;
if( isPending(Socket::pendingOutput, cmdTimeout) )
{
......@@ -158,7 +159,7 @@ void LogSession::run()
}
// обрабатываем команды только если нашли log
for( auto&& li: loglist )
for( auto && li : loglist )
{
// Обработка команд..
// \warning Работа с логом ведётся без mutex-а, хотя он разделяется отдельными потоками
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment