Commit e3c855c5 authored by Pavel Vainerman's avatar Pavel Vainerman

Правки после проверки cppcheck (1.70)

parent 910bdd5a
......@@ -59,8 +59,8 @@ static struct option longopts[] =
string conffile("configure.xml");
// --------------------------------------------------------------------------
static bool commandToAll( const string& section, std::shared_ptr<ObjectRepository> rep, Command cmd );
static void createSections( const std::shared_ptr<UniSetTypes::Configuration> c );
static bool commandToAll( const string& section, std::shared_ptr<ObjectRepository>& rep, Command cmd );
static void createSections(const std::shared_ptr<Configuration>& c );
// --------------------------------------------------------------------------
int omap();
int configure( const string& args, UInterface& ui );
......@@ -364,7 +364,7 @@ int main(int argc, char** argv)
}
// ==============================================================================================
static bool commandToAll(const string& section, std::shared_ptr<ObjectRepository> rep, Command cmd)
static bool commandToAll(const string& section, std::shared_ptr<ObjectRepository>& rep, Command cmd)
{
if( verb )
cout << "\n||=======******** " << section << " ********=========||\n" << endl;
......@@ -504,7 +504,7 @@ static bool commandToAll(const string& section, std::shared_ptr<ObjectRepository
}
// ==============================================================================================
static void createSections( const std::shared_ptr<UniSetTypes::Configuration> rconf )
static void createSections( const std::shared_ptr<UniSetTypes::Configuration>& rconf )
{
ObjectRepositoryFactory repf(rconf);
......
......@@ -248,6 +248,7 @@
/*! Вывод состояния внутренних переменных */
inline std::string dumpVars(){ return std::move(vmon.pretty_str()); }
// ------------------------------------------------------------
std::string help();
</xsl:template>
......@@ -530,6 +531,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
</xsl:if>
}
// ----------------------------------------------------------------------------
std::string <xsl:value-of select="$CLASSNAME"/>_SK::help()
{
ostringstream s;
return std::move(s.str());
}
// ----------------------------------------------------------------------------
</xsl:template>
<xsl:template name="COMMON-ID-LIST">
......
......@@ -136,7 +136,7 @@ class DBServer_MySQL:
{
public:
DBServer_MySQL( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_MySQL( const std::string& prefix );
explicit DBServer_MySQL( const std::string& prefix );
virtual ~DBServer_MySQL();
/*! глобальная функция для инициализации объекта */
......
......@@ -34,6 +34,7 @@ DBServer_PostgreSQL::DBServer_PostgreSQL(ObjectId id, const std::string& prefix
DBServer_PostgreSQL::DBServer_PostgreSQL():
DBServer(uniset_conf()->getDBServer()),
db(make_shared<PostgreSQLInterface>()),
PingTime(300000),
ReconnectTime(180000),
connect_ok(false),
......@@ -41,7 +42,6 @@ DBServer_PostgreSQL::DBServer_PostgreSQL():
qbufSize(200),
lastRemove(false)
{
db = make_shared<PostgreSQLInterface>();
// init();
if( getId() == DefaultObjectId )
......
......@@ -46,7 +46,7 @@ class PostgreSQLInterface
class PostgreSQLResult
{
public:
PostgreSQLResult() {}
PostgreSQLResult(){}
PostgreSQLResult( const pqxx::result& res );
~PostgreSQLResult();
......
......@@ -23,8 +23,8 @@ std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
}
// -----------------------------------------------------------------------------
IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory> ic, int numcards, const std::string& prefix_ ):
IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, int numcards, const std::string& prefix_ ):
UniSetObject(id),
polltime(150),
cards(11),
......@@ -533,7 +533,7 @@ void IOControl::ioread( IOInfo* it )
return;
}
IOBase* ib = &(*it);
IOBase* ib = static_cast<IOBase*>(it);
try
{
......@@ -588,7 +588,7 @@ void IOControl::ioread( IOInfo* it )
delBlink(it, lstBlink3);
}
if( it->no_testlamp || (!it->no_testlamp && !isTestLamp) )
if( it->no_testlamp || !isTestLamp )
card->setDigitalChannel(it->subdev, it->channel, 0);
}
break;
......@@ -604,7 +604,7 @@ void IOControl::ioread( IOInfo* it )
delBlink(it, lstBlink3);
}
if( it->no_testlamp || (!it->no_testlamp && !isTestLamp) )
if( it->no_testlamp || !isTestLamp )
card->setDigitalChannel(it->subdev, it->channel, 1);
}
break;
......@@ -657,7 +657,7 @@ void IOControl::ioread( IOInfo* it )
{
bool set = IOBase::processingAsDO(ib, shm, force_out);
if( !it->lamp || (it->lamp && !isTestLamp) )
if( !it->lamp || !isTestLamp )
card->setDigitalChannel(it->subdev, it->channel, set);
}
}
......@@ -1158,8 +1158,8 @@ void IOControl::check_testlamp()
}
// -----------------------------------------------------------------------------
std::shared_ptr<IOControl> IOControl::init_iocontrol( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> ic,
std::shared_ptr<IOControl> IOControl::init_iocontrol(int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -208,12 +208,12 @@ class IOControl:
public UniSetObject
{
public:
IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> shm = nullptr, int numcards = 2, const std::string& prefix = "io" );
IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& shm = nullptr, int numcards = 2, const std::string& prefix = "io" );
virtual ~IOControl();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<IOControl> init_iocontrol( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "io" );
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
......
......@@ -61,7 +61,7 @@ void Element::setChildOut()
it.el->setIn(it.num, _myout);
}
// -------------------------------------------------------------------------
std::shared_ptr<Element> Element::find( const ElementID id )
std::shared_ptr<Element> Element::find(const ElementID& id )
{
for( const auto& it : outs )
{
......
......@@ -13,7 +13,7 @@ class LogicException:
{
public:
LogicException(): UniSetTypes::Exception("LogicException") {}
LogicException( const std::string err): UniSetTypes::Exception(err) {}
LogicException( const std::string& err): UniSetTypes::Exception(err) {}
};
......@@ -44,7 +44,6 @@ class Element
virtual void setIn( int num, bool state ) = 0;
virtual bool getOut() = 0;
inline ElementID getId()
{
return myid;
......@@ -54,7 +53,7 @@ class Element
return "?type?";
}
virtual std::shared_ptr<Element> find( const ElementID id );
virtual std::shared_ptr<Element> find( const ElementID& id );
virtual void addChildOut( std::shared_ptr<Element> el, int in_num );
virtual void delChildOut( std::shared_ptr<Element> el );
......
......@@ -7,7 +7,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
// -------------------------------------------------------------------------
PassiveLProcessor::PassiveLProcessor( UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic, const std::string& prefix ):
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
UniSetObject_LT(objId),
shm(nullptr)
{
......@@ -24,8 +24,6 @@ PassiveLProcessor::PassiveLProcessor( UniSetTypes::ObjectId objId,
throw SystemError("Not found conf-node for " + conf_name );
UniXML::iterator it(confnode);
confnode = conf->getNode(myname);
string lfile = conf->getArgParam("--" + prefix + "-schema", it.getProp("schema"));
if( lfile.empty() )
......@@ -62,7 +60,7 @@ PassiveLProcessor::PassiveLProcessor( UniSetTypes::ObjectId objId,
maxHeartBeat = conf->getArgPInt("--" + prefix + "-heartbeat-max", "10", 10);
}
}
// -------------------------------------------------------------------------
PassiveLProcessor::~PassiveLProcessor()
{
......@@ -264,8 +262,8 @@ void PassiveLProcessor::help_print( int argc, const char* const* argv )
}
// -----------------------------------------------------------------------------
std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic,
std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc(int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -290,3 +288,4 @@ std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc( int argc, con
dinfo << "(plproc): name = " << name << "(" << ID << ")" << endl;
return make_shared<PassiveLProcessor>(ID, shmID, ic, prefix);
}
// -----------------------------------------------------------------------------
......@@ -18,8 +18,8 @@ class PassiveLProcessor:
{
public:
PassiveLProcessor( UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr, const std::string& prefix = "lproc" );
PassiveLProcessor(UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "lproc" );
virtual ~PassiveLProcessor();
enum Timers
......@@ -30,7 +30,7 @@ class PassiveLProcessor:
static void help_print( int argc, const char* const* argv );
static std::shared_ptr<PassiveLProcessor> init_plproc( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "plproc" );
protected:
......
......@@ -143,7 +143,7 @@ class Schema
// наружный выход
struct EXTOut
{
EXTOut( const std::string n, std::shared_ptr<Element> f):
EXTOut( const std::string& n, std::shared_ptr<Element>& f):
name(n), from(f) {}
EXTOut(): name("") {}
......
......@@ -13,8 +13,8 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
MBExchange::MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
const std::shared_ptr<SharedMemory> _ic, const std::string& prefix ):
MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
const std::shared_ptr<SharedMemory>& _ic, const std::string& prefix ):
UniSetObject_LT(objId),
allInitOK(false),
initPause(0),
......
......@@ -37,7 +37,7 @@ class MBExchange:
public UniSetObject_LT
{
public:
MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mb" );
virtual ~MBExchange();
......
......@@ -11,8 +11,8 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
MBTCPMaster::MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
const std::shared_ptr<SharedMemory> ic, const std::string& prefix ):
MBTCPMaster::MBTCPMaster(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
MBExchange(objId, shmId, ic, prefix),
force_disconnect(true)
{
......@@ -219,8 +219,8 @@ void MBTCPMaster::help_print( int argc, const char* const* argv )
cout << "--prefix-persistent-connection 0,1 - Не закрывать соединение на каждом цикле опроса" << endl;
}
// -----------------------------------------------------------------------------
std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> ic,
std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -198,13 +198,13 @@ class MBTCPMaster:
public MBExchange
{
public:
MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbtcp" );
virtual ~MBTCPMaster();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<MBTCPMaster> init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbtcp" );
/*! глобальная функция для вывода help-а */
......
......@@ -12,7 +12,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
const std::shared_ptr<SharedMemory> ic, const std::string& prefix ):
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
MBExchange(objId, shmId, ic, prefix),
force_disconnect(true)
{
......@@ -204,7 +204,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
// Если по текущему каналу связь есть, то возвращаем его
if( mbi != mblist.rend() && !mbi->ignore && mbi->respond )
{
if( mbi->mbtcp->isConnection() || ( !mbi->mbtcp->isConnection() && mbi->init(mblog)) )
if( mbi->mbtcp->isConnection() || mbi->init(mblog) )
{
if( !mbi->ignore )
{
......@@ -469,7 +469,7 @@ void MBTCPMultiMaster::help_print( int argc, const char* const* argv )
}
// -----------------------------------------------------------------------------
std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> ic,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -222,13 +222,13 @@ class MBTCPMultiMaster:
public MBExchange
{
public:
MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbtcp" );
virtual ~MBTCPMultiMaster();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<MBTCPMultiMaster> init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
static std::shared_ptr<MBTCPMultiMaster> init_mbmaster(int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbtcp" );
/*! глобальная функция для вывода help-а */
......
......@@ -9,7 +9,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
RTUExchange::RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory> ic,
RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix_ ):
MBExchange(objId, shmId, ic, prefix_),
mbrtu(0),
......@@ -320,8 +320,8 @@ bool RTUExchange::poll()
return !allNotRespond;
}
// -----------------------------------------------------------------------------
std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange( int argc, const char* const* argv, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory> ic, const std::string& prefix )
std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange(int argc, const char* const* argv, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -14,12 +14,12 @@ class RTUExchange:
{
public:
RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID,
const std::shared_ptr<SharedMemory> ic = nullptr, const std::string& prefix = "rs" );
const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "rs" );
virtual ~RTUExchange();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<RTUExchange> init_rtuexchange( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "rs" );
/*! глобальная функция для вывода help-а */
......
......@@ -58,7 +58,7 @@ MBTCPTestServer::MBTCPTestServer( ModbusAddr myaddr, const string& inetaddr, int
catch( const std::exception& ex )
{
cerr << "(MBTCPTestServer::init): Can`t create socket " << addr << ":" << port << " err: " << ex.what() << endl;
throw ex;
throw;
}
// sslot->initLog(conf,name,logfile);
......
......@@ -65,7 +65,7 @@ static void InitTest()
catch( const std::exception& ex )
{
cerr << "(mbs): Can`t create socket " << addr << ":" << port << " err: " << ex.what() << endl;
throw ex;
throw;
}
//mbs->setVerbose(true);
......
......@@ -67,7 +67,7 @@ static void InitTest()
catch( const std::exception& ex )
{
cerr << "(mb1): Can`t create socket " << addr << ":" << port << " err: " << ex.what() << endl;
throw ex;
throw;
}
CHECK( mbs1 != nullptr );
......@@ -99,7 +99,7 @@ static void InitTest()
catch( const std::exception& ex )
{
cerr << "(mb2): Can`t create socket " << addr << ":" << port << " err: " << ex.what() << endl;
throw ex;
throw;
}
CHECK( mbs2 != nullptr );
......
......@@ -12,7 +12,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace ModbusRTU;
// -----------------------------------------------------------------------------
MBSlave::MBSlave( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory> ic, const string& prefix ):
MBSlave::MBSlave(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic, const string& prefix ):
UniSetObject_LT(objId),
addr(0x01),
initPause(0),
......@@ -1232,8 +1232,8 @@ void MBSlave::help_print( int argc, const char* const* argv )
cout << LogServer::help_print("prefix-logserver") << endl;
}
// -----------------------------------------------------------------------------
std::shared_ptr<MBSlave> MBSlave::init_mbslave( int argc, const char* const* argv, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory> ic, const string& prefix )
std::shared_ptr<MBSlave> MBSlave::init_mbslave(int argc, const char* const* argv, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, const string& prefix )
{
auto conf = uniset_conf();
string name = conf->getArgParam("--" + prefix + "-name", "MBSlave1");
......
......@@ -285,12 +285,12 @@ class MBSlave:
public UniSetObject_LT
{
public:
MBSlave( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr, const std::string& prefix = "mbs" );
MBSlave( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "mbs" );
virtual ~MBSlave();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<MBSlave> init_mbslave(int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbs" );
/*! глобальная функция для вывода help-а */
......
......@@ -12,7 +12,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace ModbusRTU;
// -----------------------------------------------------------------------------
MBTCPPersistentSlave::MBTCPPersistentSlave( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory> ic, const string& prefix ):
MBTCPPersistentSlave::MBTCPPersistentSlave(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic, const string& prefix ):
MBSlave(objId, shmId, ic, prefix),
sesscount_id(DefaultObjectId)
{
......@@ -127,7 +127,7 @@ void MBTCPPersistentSlave::help_print( int argc, const char* const* argv )
}
// -----------------------------------------------------------------------------
std::shared_ptr<MBTCPPersistentSlave> MBTCPPersistentSlave::init_mbslave( int argc, const char* const* argv, UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory> ic, const string& prefix )
const std::shared_ptr<SharedMemory>& ic, const string& prefix )
{
auto conf = uniset_conf();
string name = conf->getArgParam("--" + prefix + "-name", "MBSlave1");
......
......@@ -21,12 +21,12 @@ class MBTCPPersistentSlave:
public MBSlave
{
public:
MBTCPPersistentSlave( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr, const std::string& prefix = "mbs" );
MBTCPPersistentSlave( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "mbs" );
virtual ~MBTCPPersistentSlave();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<MBTCPPersistentSlave> init_mbslave( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbs" );
/*! глобальная функция для вывода help-а */
......
......@@ -11,7 +11,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
RRDServer::RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory> ic,
RRDServer::RRDServer(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic,
const string& prefix ):
UObject_SK(objId, cnode, string(prefix + "-")),
prefix(prefix)
......@@ -251,8 +251,8 @@ void RRDServer::help_print( int argc, const char* const* argv )
cout << LogServer::help_print("prefix-logserver") << endl;
}
// -----------------------------------------------------------------------------
std::shared_ptr<RRDServer> RRDServer::init_rrdstorage( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> ic,
std::shared_ptr<RRDServer> RRDServer::init_rrdstorage(int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -60,13 +60,13 @@ class RRDServer:
public UObject_SK
{
public:
RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "rrd" );
virtual ~RRDServer();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<RRDServer> init_rrdstorage( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "rrd" );
/*! глобальная функция для вывода help-а */
......
......@@ -7,9 +7,10 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
//--------------------------------------------------------------------------------
SMViewer::SMViewer( UniSetTypes::ObjectId shmID ):
SViewer(uniset_conf()->getControllersSection(), true)
SViewer(uniset_conf()->getControllersSection(), true),
shm(make_shared<SMInterface>(shmID, ui, DefaultObjectId))
{
shm = make_shared<SMInterface>(shmID, ui, DefaultObjectId);
}
// --------------------------------------------------------------------------
SMViewer::~SMViewer()
......
......@@ -9,7 +9,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
UNetExchange::UNetExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory> ic, const std::string& prefix ):
UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
UniSetObject_LT(objId),
initPause(0),
activated(false),
......@@ -502,7 +502,7 @@ void UNetExchange::step()
}
// -----------------------------------------------------------------------------
void UNetExchange::ReceiverInfo::step( const std::shared_ptr<SMInterface> shm, const std::string& myname, std::shared_ptr<DebugStream>& unetlog )
void UNetExchange::ReceiverInfo::step( const std::shared_ptr<SMInterface>& shm, const std::string& myname, std::shared_ptr<DebugStream>& unetlog )
{
try
{
......@@ -785,8 +785,8 @@ void UNetExchange::help_print( int argc, const char* argv[] )
cout << LogServer::help_print("prefix-logserver") << endl;
}
// -----------------------------------------------------------------------------
std::shared_ptr<UNetExchange> UNetExchange::init_unetexchange( int argc, const char* const argv[], UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory> ic, const std::string& prefix )
std::shared_ptr<UNetExchange> UNetExchange::init_unetexchange(int argc, const char* const argv[], UniSetTypes::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -102,12 +102,12 @@ class UNetExchange:
public UniSetObject_LT
{
public:
UNetExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr, const std::string& prefix = "unet" );
UNetExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "unet" );
virtual ~UNetExchange();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<UNetExchange> init_unetexchange( int argc, const char* const argv[],
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = 0, const std::string& prefix = "unet" );
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = 0, const std::string& prefix = "unet" );
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* argv[] );
......@@ -190,7 +190,7 @@ class UNetExchange:
std::shared_ptr<UNetReceiver> r1; /*!< приём по первому каналу */
std::shared_ptr<UNetReceiver> r2; /*!< приём по второму каналу */
void step( const std::shared_ptr<SMInterface> shm, const std::string& myname, std::shared_ptr<DebugStream>& log );
void step(const std::shared_ptr<SMInterface>& shm, const std::string& myname, std::shared_ptr<DebugStream>& log );
inline void setRespondID( UniSetTypes::ObjectId id, bool invert = false )
{
......@@ -206,7 +206,7 @@ class UNetExchange:
sidChannelNum = id;
}
inline void initIterators( const std::shared_ptr<SMInterface> shm )
inline void initIterators( const std::shared_ptr<SMInterface>& shm )
{
shm->initIterator(itLostPackets);
shm->initIterator(itRespond);
......
......@@ -17,8 +17,8 @@ UniExchange::NetNodeInfo::NetNodeInfo():
}
// --------------------------------------------------------------------------
UniExchange::UniExchange( UniSetTypes::ObjectId id, UniSetTypes::ObjectId shmID,
const std::shared_ptr<SharedMemory> ic, const std::string& prefix ):
UniExchange::UniExchange(UniSetTypes::ObjectId id, UniSetTypes::ObjectId shmID,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
IOController(id),
polltime(200),
mymap(1),
......@@ -337,8 +337,8 @@ void UniExchange::sigterm( int signo )
{
}
// -----------------------------------------------------------------------------
std::shared_ptr<UniExchange> UniExchange::init_exchange( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory> ic,
std::shared_ptr<UniExchange> UniExchange::init_exchange(int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......
......@@ -38,13 +38,13 @@ class UniExchange:
{
public:
UniExchange( UniSetTypes::ObjectId id, UniSetTypes::ObjectId shmID,
const std::shared_ptr<SharedMemory> ic = nullptr, const std::string& prefix = "unet" );
const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "unet" );
virtual ~UniExchange();
void execute();
static std::shared_ptr<UniExchange> init_exchange( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory> ic = nullptr,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "unet" );
/*! глобальная функция для вывода help-а */
......
......@@ -127,7 +127,7 @@ bool IOBase::check_on_delay( bool val )
// обновляем значение только если наступило время
// или если оно "0"...
if( !val || (val && ptOnDelay.checkTime()) )
if( !val || ptOnDelay.checkTime() )
ondelay_state = val;
// возвращаем ТЕКУЩЕЕ, А НЕ НОВОЕ значение
......@@ -147,7 +147,7 @@ bool IOBase::check_off_delay( bool val )
// обновляем значение только если наступило время
// или если оно "1"...
if( val || (!val && ptOffDelay.checkTime()) )
if( val || ptOffDelay.checkTime() )
offdelay_state = val;
// возвращаем ТЕКУЩЕЕ, А НЕ НОВОЕ значение
......
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