Commit 6e876dea authored by Vitaly Lipatov's avatar Vitaly Lipatov

use appropriate getArg(P)Int, get(P)IntProp instead direct atoi using

parent 13ced4c3
......@@ -364,8 +364,8 @@ void DBServer_MySQL::init()
tblMap[UniSetTypes::Message::Alarm] = "Messages";
tblMap[UniSetTypes::Message::SensorInfo] = "AnalogSensors";
PingTime = atoi( conf->getProp(node,"pingTime").c_str() );
ReconnectTime = atoi( conf->getProp(node,"reconnectTime").c_str() );
PingTime = conf->getIntProp(node,"pingTime");
ReconnectTime = conf->getIntProp(node,"reconnectTime");
if( dbnode.empty() )
dbnode = "localhost";
......
......@@ -21,7 +21,7 @@ MBSlave::MBSlave( ModbusRTU::ModbusAddr addr, const std::string dev, const std::
{
cout << "$Id: MBSlave.cc,v 1.7 2009/02/24 20:27:24 vpashka Exp $" << endl;
// int replyTimeout = atoi( conf->getArgParam("--reply-timeout",it.getProp("reply_timeout")).c_str() );
// int replyTimeout = uni_atoi( conf->getArgParam("--reply-timeout",it.getProp("reply_timeout")).c_str() );
// if( replyTimeout <= 0 )
// replyTimeout = 2000;
......
......@@ -20,7 +20,7 @@ MBTCPServer::MBTCPServer( ModbusAddr myaddr, const string inetaddr, int port, bo
{
cout << "$Id: MBTCPServer.cc,v 1.1 2008/11/22 23:22:23 vpashka Exp $" << endl;
// int replyTimeout = atoi( conf->getArgParam("--reply-timeout",it.getProp("reply_timeout")).c_str() );
// int replyTimeout = uni_atoi( conf->getArgParam("--reply-timeout",it.getProp("reply_timeout")).c_str() );
// if( replyTimeout <= 0 )
// replyTimeout = 2000;
......
......@@ -512,13 +512,9 @@ activated(false)
</xsl:if>
</xsl:for-each>
sleep_msec = conf->getArgInt("--sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>");
if( sleep_msec &lt;=0 )
sleep_msec = <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>;
sleep_msec = conf->getArgPInt("--sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>", <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>);
resetMsgTime = uni_atoi(conf->getProp(cnode,"resetMsgTime"));
if( resetMsgTime &lt;= 0 )
resetMsgTime = 200;
resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 200);
ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = conf->getArgInt("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>");
......@@ -527,13 +523,9 @@ activated(false)
else if( smReadyTimeout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout&lt;=0 )
activateTimeout = 20000;
activateTimeout = conf->getArgPInt("--activate-timeout", 20000);
int msec = conf->getArgInt("--startup-timeout");
if( msec&lt;=0 )
msec = 10000;
int msec = conf->getArgPInt("--startup-timeout", 10000);
ptStartUpTimeout.setTiming(msec);
}
......@@ -709,13 +701,9 @@ activated(false)
</xsl:call-template>
</xsl:for-each>
sleep_msec = conf->getArgInt("--sleep-msec","<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>");
if( sleep_msec &lt;=0 )
sleep_msec = <xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>;
sleep_msec = conf->getArgPInt("--sleep-msec","<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>", <xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>);
resetMsgTime = uni_atoi(conf->getProp(cnode,"resetMsgTime"));
if( resetMsgTime &lt;= 0 )
resetMsgTime = 0;
resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 0);
ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = conf->getArgInt("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>");
......@@ -724,13 +712,9 @@ activated(false)
else if( smReadyTimeout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout&lt;=0 )
activateTimeout = 20000;
activateTimeout = conf->getArgPInt("--activate-timeout", 20000);
int msec = conf->getArgInt("--startup-timeout");
if( msec&lt;=0 )
msec = 10000;
int msec = conf->getArgPInt("--startup-timeout", 10000);
ptStartUpTimeout.setTiming(msec);
}
......
......@@ -53,7 +53,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
if( cnode == NULL )
throw SystemError("Not find conf-node " + cname + " for " + myname);
defCardNum = atoi( conf->getArgParam("--io-default-cardnum","-1").c_str());
defCardNum = conf->getArgInt("--io-default-cardnum","-1");
unideb[Debug::INFO] << myname << "(init): numcards=" << numcards << endl;
......@@ -120,9 +120,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
force = conf->getArgInt("--io-force",it.getProp("force"));
force_out = conf->getArgInt("--io-force-out",it.getProp("force_out"));
filtersize = conf->getArgInt("--io-filtersize",it.getProp("filtersize"));
if( filtersize <= 0 )
filtersize = 1;
filtersize = conf->getArgPInt("--io-filtersize",it.getProp("filtersize"), 1);
filterT = atof(conf->getArgParam("--io-filterT",it.getProp("filterT")).c_str());
......@@ -150,25 +148,16 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
unideb[Debug::INFO] << myname << "(init): read s_field='" << s_field
<< "' s_fvalue='" << s_fvalue << "'" << endl;
int blink_msec = conf->getArgInt("--io-blink-time",it.getProp("blink-time"));
if( blink_msec<=0 )
blink_msec = 300;
int blink_msec = conf->getArgPInt("--io-blink-time",it.getProp("blink-time"), 300);
ptBlink.setTiming(blink_msec);
int blink2_msec = conf->getArgInt("--io-blink2-time",it.getProp("blink2-time"));
if( blink2_msec<=0 )
blink2_msec = 150;
int blink2_msec = conf->getArgPInt("--io-blink2-time",it.getProp("blink2-time"), 150);
ptBlink2.setTiming(blink2_msec);
int blink3_msec = conf->getArgInt("--io-blink3-time",it.getProp("blink3-time"));
if( blink3_msec<=0 )
blink3_msec = 100;
int blink3_msec = conf->getArgPInt("--io-blink3-time",it.getProp("blink3-time"), 100);
ptBlink3.setTiming(blink2_msec);
smReadyTimeout = atoi(conf->getArgParam("--io-sm-ready-timeout",it.getProp("ready_timeout")).c_str());
smReadyTimeout = conf->getArgInt("--io-sm-ready-timeout",it.getProp("ready_timeout"));
if( smReadyTimeout == 0 )
smReadyTimeout = 15000;
else if( smReadyTimeout < 0 )
......@@ -207,14 +196,10 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgInt("--io-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <= 0 )
maxHeartBeat = 10;
maxHeartBeat = conf->getArgPInt("--io-heartbeat-max",it.getProp("heartbeat_max"), 10);
}
activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout <= 0 )
activateTimeout = 25000;
activateTimeout = conf->getArgPInt("--activate-timeout", 25000);
if( !shm->isLocalwork() ) // ic
ic->addReadItem( sigc::mem_fun(this,&IOControl::readItem) );
......@@ -672,10 +657,7 @@ bool IOControl::initIOItem( UniXML_iterator& it )
string c(it.getProp("card"));
if( c.empty() )
inf.ncard = defCardNum;
else
inf.ncard = atoi( c.c_str() );
inf.ncard = uni_atoi( c );
if( c.empty() || inf.ncard < 0 || inf.ncard >= (int)cards.size() )
{
......@@ -686,7 +668,7 @@ bool IOControl::initIOItem( UniXML_iterator& it )
inf.ncard = defCardNum;
}
inf.subdev = atoi( it.getProp("subdev").c_str());
inf.subdev = it.getIntProp("subdev");
if( inf.subdev < 0 )
inf.subdev = DefaultSubdev;
......@@ -708,8 +690,8 @@ bool IOControl::initIOItem( UniXML_iterator& it )
inf.subdev = DefaultSubdev;
}
inf.channel = atoi((it.getProp("channel")).c_str());
if( inf.channel<0 || inf.channel > 32 )
inf.channel = it.getIntProp("channel");
if( inf.channel < 0 || inf.channel > 32 )
{
unideb[Debug::WARN] << myname << "(readItem): : " << inf.channel
<< " " << it.getProp("name") << endl;
......@@ -719,14 +701,14 @@ bool IOControl::initIOItem( UniXML_iterator& it )
if( !IOBase::initItem(&inf,it,shm,&unideb,myname,filtersize,filterT) )
return false;
inf.lamp = atoi( it.getProp("lamp").c_str() );
inf.no_testlamp = atoi( it.getProp("no_iotestlamp").c_str() );
inf.lamp = it.getIntProp("lamp");
inf.no_testlamp = it.getIntProp("no_iotestlamp");
inf.aref = 0;
inf.range = 0;
if( inf.stype == UniversalIO::AnalogInput || inf.stype == UniversalIO::AnalogOutput )
{
inf.range = atoi((it.getProp("range")).c_str());
inf.range = it.getIntProp("range");
if( inf.range < 0 || inf.range > 3 )
{
unideb[Debug::WARN] << myname << "(readItem): (range): " << inf.range
......@@ -735,7 +717,7 @@ bool IOControl::initIOItem( UniXML_iterator& it )
return false;
}
inf.aref = atoi((it.getProp("aref")).c_str());
inf.aref = it.getIntProp("aref");
if( inf.aref < 0 || inf.aref > 3 )
{
unideb[Debug::WARN] << myname << "(readItem): : " << inf.aref
......@@ -753,7 +735,8 @@ bool IOControl::initIOItem( UniXML_iterator& it )
//
if( maxItem >= iomap.size() )
iomap.resize(maxItem+10);
int prior = atoi((it.getProp("iopriority")).c_str());
int prior = it.getIntProp("iopriority");
if( prior > 0 )
{
IOPriority p(prior,maxItem);
......@@ -1039,10 +1022,7 @@ IOControl* IOControl::init_iocontrol( int argc, const char* const* argv,
return 0;
}
int numcards = atoi(conf->getArgParam("--io-numcards","1").c_str());
if( numcards <= 0 )
numcards = 1;
int numcards = conf->getArgPInt("--io-numcards",1);
unideb[Debug::INFO] << "(iocontrol): name = " << name << "(" << ID << ")" << endl;
return new IOControl(ID,icID,ic,numcards);
......
......@@ -7,8 +7,7 @@ using namespace UniSetTypes;
// -------------------------------------------------------------------------
LProcessor::LProcessor()
{
sleepTime = conf->getArgInt("--sleepTime");
sleepTime = (sleepTime<=0) ? 200 : sleepTime;
sleepTime = conf->getArgPInt("--sleepTime", 200);
}
LProcessor::~LProcessor()
......
......@@ -50,9 +50,7 @@ void SchemaXML::read( const string xmlfile )
{
string type(xml.getProp(it, "type"));
string ID(xml.getProp(it, "id"));
int inCount(atoi(xml.getProp(it, "inCount").c_str()));
inCount = (inCount <= 0) ? 1 : inCount;
int inCount(xml.getPIntProp(it, "inCount", 1));
if( type == "OR" )
manage( new TOR(ID, inCount) );
......@@ -60,12 +58,12 @@ void SchemaXML::read( const string xmlfile )
manage( new TAND(ID, inCount) );
else if( type == "Delay" )
{
int delayMS = atoi( xml.getProp(it,"delayMS").c_str() );
int delayMS = xml.getIntProp(it,"delayMS");
manage( new TDelay(ID,delayMS,inCount) );
}
else if( type == "NOT" )
{
bool defout = atoi( xml.getProp(it,"default_out_state").c_str() );
bool defout = xml.getIntProp(it,"default_out_state");
manage( new TNOT(ID,defout) );
}
else
......@@ -98,7 +96,7 @@ void SchemaXML::read( const string xmlfile )
string type(xml.getProp(it, "type"));
string fID(xml.getProp(it, "from"));
string tID(xml.getProp(it, "to"));
int toIn(atoi(xml.getProp(it, "toInput").c_str()));
int toIn(xml.getIntProp(it, "toInput"));
if( type == "ext" )
{
......
......@@ -51,7 +51,7 @@ prefix(prefix)
force = conf->getArgInt("--" + prefix + "-force",it.getProp("force"));
// int recv_timeout = atoi(conf->getArgParam("--" + prefix + "-recv-timeout",it.getProp("recv_timeout")).c_str());
// int recv_timeout = conf->getArgParam("--" + prefix + "-recv-timeout",it.getProp("recv_timeout")));
string saddr = conf->getArgParam("--" + prefix + "-my-addr",it.getProp("addr"));
......@@ -95,9 +95,7 @@ prefix(prefix)
if( iaddr.empty() )
throw UniSetTypes::SystemError(myname+"(MBSlave): Unknown TCP server address. Use: --mbs-inet-addr [ XXX.XXX.XXX.XXX| hostname ]");
int port = atoi(conf->getArgParam("--" + prefix + "-inet-port",it.getProp("iport")).c_str());
if( port <=0 )
port = 502;
int port = conf->getArgPInt("--" + prefix + "-inet-port",it.getProp("iport"), 502);
ost::InetAddress ia(iaddr.c_str());
mbslot = new ModbusTCPServerSlot(ia,port);
......@@ -126,9 +124,7 @@ prefix(prefix)
// mbslot->connectRemoteService( sigc::mem_fun(this, &MBSlave::remoteService) );
// -------------------------------
initPause = atoi(conf->getArgParam("--" + prefix + "-initPause",it.getProp("initPause")).c_str());
if( !initPause )
initPause = 3000;
initPause = conf->getArgPInt("--" + prefix + "-initPause",it.getProp("initPause"), 3000);
if( shm->isLocalwork() )
{
......@@ -157,10 +153,7 @@ prefix(prefix)
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgInt("--" + prefix + "-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <= 0 )
maxHeartBeat = 10;
maxHeartBeat = conf->getArgPInt("--" + prefix + "-heartbeat-max",it.getProp("heartbeat_max"), 10);
test_id = sidHeartBeat;
}
else
......@@ -184,14 +177,9 @@ prefix(prefix)
if( wait_msec < 500 )
wait_msec = 500;
activateTimeout = conf->getArgInt("--" + prefix + "-activate-timeout");
if( activateTimeout <= 0 )
activateTimeout = 20000;
timeout_t msec = conf->getArgInt("--" + prefix + "-timeout",it.getProp("timeout"));
if( msec == 0 )
msec = 3000;
activateTimeout = conf->getArgPInt("--" + prefix + "-activate-timeout", 20000);
timeout_t msec = conf->getArgPInt("--" + prefix + "-timeout",it.getProp("timeout"), 3000);
ptTimeout.setTiming(msec);
dlog[Debug::INFO] << myname << "(init): rs-timeout=" << msec << " msec" << endl;
......@@ -212,8 +200,8 @@ prefix(prefix)
dlog[Debug::WARN] << myname << "(build file list): ignore empty name... " << endl;
continue;
}
int id = atoi(fit.getProp("id").c_str());
if( id==0 )
int id = fit.getIntProp("id");
if( id == 0 )
{
dlog[Debug::WARN] << myname << "(build file list): FAILED ID for " << nm << "... ignore..." << endl;
continue;
......
......@@ -57,13 +57,9 @@ allNotRespond(false)
use485F = conf->getArgInt("--rs-use485F",it.getProp("use485F"));
defSpeed = ComPort::getSpeed(speed);
recv_timeout = conf->getArgInt("--rs-recv-timeout",it.getProp("recv_timeout"));
if( recv_timeout <= 0 )
recv_timeout = 50;
recv_timeout = conf->getArgPInt("--rs-recv-timeout",it.getProp("recv_timeout"), 50);
int alltout = conf->getArgInt("--rs-all-timeout",it.getProp("all_timeout"));
if( alltout <= 0 )
alltout = 2000;
int alltout = conf->getArgPInt("--rs-all-timeout",it.getProp("all_timeout"), 2000);
ptAllNotRespond.setTiming(alltout);
......@@ -73,13 +69,9 @@ allNotRespond(false)
mbregFromID = conf->getArgInt("--mbs-reg-from-id",it.getProp("reg_from_id"));
dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl;
polltime = conf->getArgInt("--rs-polltime",it.getProp("polltime"));
if( !polltime )
polltime = 100;
polltime = conf->getArgPInt("--rs-polltime",it.getProp("polltime"), 100);
initPause = conf->getArgInt("--rs-initPause",it.getProp("initPause"));
if( !initPause )
initPause = 3000;
initPause = conf->getArgPInt("--rs-initPause",it.getProp("initPause"), 3000);
force = conf->getArgInt("--rs-force",it.getProp("force"));
force_out = conf->getArgInt("--rs-force-out",it.getProp("force_out"));
......@@ -112,9 +104,7 @@ allNotRespond(false)
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgInt("--rs-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <= 0 )
maxHeartBeat = 10;
maxHeartBeat = conf->getArgPInt("--rs-heartbeat-max",it.getProp("heartbeat_max"), 10);
test_id = sidHeartBeat;
}
else
......@@ -131,9 +121,7 @@ allNotRespond(false)
dlog[Debug::INFO] << myname << "(init): test_id=" << test_id << endl;
activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout <= 0 )
activateTimeout = 20000;
activateTimeout = conf->getArgPInt("--activate-timeout", 20000);
initMB(false);
......@@ -1534,13 +1522,9 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX
}
dlog[Debug::INFO] << myname << "(initDeviceInfo): add addr=" << ModbusRTU::addr2str(a) << endl;
int tout = atoi(it.getProp("timeout").c_str());
if( tout > 0 )
d->second->resp_ptTimeout.setTiming(tout);
else
d->second->resp_ptTimeout.setTiming(UniSetTimer::WaitUpTime);
d->second->resp_invert = atoi(it.getProp("invert").c_str());
int tout = it.getPIntProp("timeout", UniSetTimer::WaitUpTime);
d->second->resp_ptTimeout.setTiming(tout);
d->second->resp_invert = it.getIntProp("invert");
string s = it.getProp("speed");
if( !s.empty() )
......
......@@ -57,13 +57,13 @@ namespace UniSetExtensions
ostringstream err;
err << "Not find conf-node for HeartBeatTime";
cerr << err.str() << endl;
throw SystemError(err.str());
throw SystemError(err.str());
}
UniXML_iterator it(cnode);
heartBeatTime = atoi(it.getProp("time_msec").c_str());
if( heartBeatTime <=0 )
heartBeatTime = it.getIntProp("time_msec");
if( heartBeatTime <= 0 )
{
heartBeatTime = 0;
dlog[Debug::WARN] << "(getHeartBeatTime): 'HEARTBEAT' !" << endl;
......
......@@ -414,34 +414,24 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->si.id = sid;
b->si.node = conf->getLocalNode();
b->nofilter = atoi( it.getProp("nofilter").c_str() );
b->ignore = atoi( it.getProp("ioignore").c_str() );
b->invert = atoi( it.getProp("ioinvert").c_str() );
b->defval = atoi( it.getProp("default").c_str() );
b->noprecision = atoi( it.getProp("noprecision").c_str() );
b->nofilter = it.getIntProp("nofilter");
b->ignore = it.getIntProp("ioignore");
b->invert = it.getIntProp("ioinvert");
b->defval = it.getIntProp("default");
b->noprecision = it.getIntProp("noprecision");
b->value = b->defval;
b->breaklim = atoi( it.getProp("breaklim").c_str() );
b->breaklim = it.getIntProp("breaklim");
long msec = atoi( it.getProp("jardelay").c_str() );
long msec = it.getPIntProp("jardelay", UniSetTimer::WaitUpTime);
b->ptJar.setTiming(msec);
if( msec<=0 )
b->ptJar.setTiming(UniSetTimer::WaitUpTime);
msec = atoi( it.getProp("ondelay").c_str() );
msec = it.getPIntProp("ondelay", UniSetTimer::WaitUpTime);
b->ptOnDelay.setTiming(msec);
if( msec<=0 )
b->ptOnDelay.setTiming(UniSetTimer::WaitUpTime);
msec = atoi( it.getProp("offdelay").c_str() );
msec = it.getPIntProp("offdelay", UniSetTimer::WaitUpTime);
b->ptOffDelay.setTiming(msec);
if( msec<=0 )
b->ptOffDelay.setTiming(UniSetTimer::WaitUpTime);
string saf = it.getProp("safety");
if( !saf.empty() )
b->safety = atoi(saf.c_str());
else
b->safety = NoSafety;
b->safety = it.getPIntProp("safety", NoSafety);
b->stype = UniSetTypes::getIOType(it.getProp("iotype"));
if( b->stype == UniversalIO::UnknownIOType )
......@@ -466,16 +456,16 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
if( b->stype == UniversalIO::AnalogInput || b->stype == UniversalIO::AnalogOutput )
{
b->cal.minRaw = atoi( it.getProp("rmin").c_str() );
b->cal.maxRaw = atoi( it.getProp("rmax").c_str() );
b->cal.minCal = atoi( it.getProp("cmin").c_str() );
b->cal.maxCal = atoi( it.getProp("cmax").c_str() );
b->cal.sensibility = atoi( it.getProp("sensibility").c_str() );
b->cal.precision = atoi( it.getProp("precision").c_str() );
b->cal.minRaw = it.getIntProp("rmin");
b->cal.maxRaw = it.getIntProp("rmax");
b->cal.minCal = it.getIntProp("cmin");
b->cal.maxCal = it.getIntProp("cmax");
b->cal.sensibility = it.getIntProp("sensibility");
b->cal.precision = it.getIntProp("precision");
int f_size = def_filtersize;
float f_T = def_filterT;
int f_median = atoi( it.getProp("filtermedian").c_str() );
int f_median = it.getIntProp("filtermedian");
if( f_median > 0 )
{
......@@ -486,9 +476,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
{
if( !it.getProp("filtersize").empty() )
{
f_size = atoi(it.getProp("filtersize").c_str());
if( f_size < 0 )
f_size = 0;
#warning " 0, f_size def_filtersize?"
f_size = it.getPIntProp("filtersize", 0);
}
}
......
......@@ -38,13 +38,9 @@ activated(false)
{
si.node = conf->getLocalNode();
sleep_msec = conf->getArgInt("--sleep-msec","200");
if( sleep_msec <= 0 )
sleep_msec = 200;
sleep_msec = conf->getArgPInt("--sleep-msec", 200);
resetMsgTime = conf->getIntProp(cnode,"resetMsgTime");
if( resetMsgTime <= 0 )
resetMsgTime = 200;
resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 200);
ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = conf->getArgInt("--sm-ready-timeout","");
......@@ -53,13 +49,9 @@ activated(false)
else if( smReadyTimeout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
activateTimeout = conf->getArgInt("--activate-timeout"));
if( activateTimeout <= 0 )
activateTimeout = 20000;
activateTimeout = conf->getArgPInt("--activate-timeout", 20000);
timeout_t msec = conf->getArgInt("--startup-timeout");
if( msec == 0 )
msec = 10000;
timeout_t msec = conf->getArgPInt("--startup-timeout", 10000);
ptStartUpTimeout.setTiming(msec);
}
......
......@@ -66,22 +66,16 @@ stCountOfQueueFull(0)
myname = "noname";
section = "nonameSection";
SizeOfMessageQueue = atoi(conf->getField("SizeOfMessageQueue").c_str());
if( SizeOfMessageQueue <= 0 )
SizeOfMessageQueue = 1000;
SizeOfMessageQueue = conf->getPIntField("SizeOfMessageQueue", 1000);
MaxCountRemoveOfMessage = atoi(conf->getField("MaxCountRemoveOfMessage").c_str());
MaxCountRemoveOfMessage = conf->getIntField("MaxCountRemoveOfMessage");
if( MaxCountRemoveOfMessage <= 0 )
MaxCountRemoveOfMessage = SizeOfMessageQueue / 4;
if( MaxCountRemoveOfMessage <= 0 )
MaxCountRemoveOfMessage = 10;
recvMutexTimeout = atoi(conf->getField("RecvMutexTimeout").c_str());
if( recvMutexTimeout <= 0 )
recvMutexTimeout = 10000;
recvMutexTimeout = conf->getPIntField("RecvMutexTimeout", 10000);
pushMutexTimeout = atoi(conf->getField("PushMutexTimeout").c_str());
if( pushMutexTimeout <= 0 )
pushMutexTimeout = 9000;
pushMutexTimeout = conf->getPIntField("PushMutexTimeout", 9000);
}
// ------------------------------------------------------------------------------------------
UniSetObject::UniSetObject( ObjectId id ):
......@@ -100,11 +94,9 @@ MaxCountRemoveOfMessage(10),
stMaxQueueMessages(0),
stCountOfQueueFull(0)
{
SizeOfMessageQueue = atoi(conf->getField("SizeOfMessageQueue").c_str());
if( SizeOfMessageQueue <= 0 )
SizeOfMessageQueue = 1000;
MaxCountRemoveOfMessage = atoi(conf->getField("MaxCountRemoveOfMessage").c_str());
SizeOfMessageQueue = conf->getPIntField("SizeOfMessageQueue", 1000);
MaxCountRemoveOfMessage = conf->getIntField("MaxCountRemoveOfMessage");
if( MaxCountRemoveOfMessage <= 0 )
MaxCountRemoveOfMessage = SizeOfMessageQueue / 4;
if( MaxCountRemoveOfMessage <= 0 )
......@@ -124,13 +116,8 @@ stCountOfQueueFull(0)
myname = "noname";
section = "nonameSection";
}
recvMutexTimeout = atoi(conf->getField("RecvMutexTimeout").c_str());
if( recvMutexTimeout <= 0 )
recvMutexTimeout = 10000;
pushMutexTimeout = atoi(conf->getField("PushMutexTimeout").c_str());
if( pushMutexTimeout <= 0 )
pushMutexTimeout = 9000;
recvMutexTimeout = conf->getPIntField("RecvMutexTimeout", 10000);
pushMutexTimeout = conf->getPIntField("PushMutexTimeout", 9000);
}
......@@ -160,23 +147,16 @@ stCountOfQueueFull(0)
unideb[Debug::WARN] << "name: ObjectsMap!!!" << endl;
throw Exception(name+": ObjectsMap!!!");
}
SizeOfMessageQueue = atoi(conf->getField("SizeOfMessageQueue").c_str());
if( SizeOfMessageQueue <= 0 )
SizeOfMessageQueue = 1000;
SizeOfMessageQueue = conf->getPIntField("SizeOfMessageQueue", 1000);
MaxCountRemoveOfMessage = atoi(conf->getField("MaxCountRemoveOfMessage").c_str());
MaxCountRemoveOfMessage = conf->getIntField("MaxCountRemoveOfMessage");
if( MaxCountRemoveOfMessage <= 0 )
MaxCountRemoveOfMessage = SizeOfMessageQueue / 4;
if( MaxCountRemoveOfMessage <= 0 )
MaxCountRemoveOfMessage = 10;
recvMutexTimeout = atoi(conf->getField("RecvMutexTimeout").c_str());
if( recvMutexTimeout <= 0 )
recvMutexTimeout = 10000;
pushMutexTimeout = atoi(conf->getField("PushMutexTimeout").c_str());
if( pushMutexTimeout <= 0 )
pushMutexTimeout = 9000;
recvMutexTimeout = conf->getPIntField("RecvMutexTimeout", 10000);
pushMutexTimeout = conf->getPIntField("PushMutexTimeout", 9000);
ui.initBackId(myid);
}
......
......@@ -61,7 +61,7 @@ InfoServer::InfoServer( ObjectId id, ISRestorer* d ):
xmlNode* root = xml->findNode(xml->getFirstNode(),"LocalInfoServer");
if( root )
{
dbrepeat = atoi(xml->getProp(root,"dbrepeat").c_str());
dbrepeat = xml->getIntProp(root,"dbrepeat");
if( !dbrepeat )
unideb[Debug::INFO] << myname << "(init): dbrepeat="<< dbrepeat << endl;
......
......@@ -357,8 +357,8 @@ void TimerService::init(const string& confnode)
return;
}
MaxCountTimers = atoi(conf->getProp(node,"MaxCountTimers").c_str());
AskLifeTimeSEC = atoi(conf->getProp(node,"AskLifeTimeSEC").c_str());
MaxCountTimers = conf->getIntProp(node,"MaxCountTimers");
AskLifeTimeSEC = conf->getIntProp(node,"AskLifeTimeSEC");
assert( TimerService::MaxCountTimers > 0 );
assert( TimerService::AskLifeTimeSEC >= 0 );
......
......@@ -605,8 +605,8 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll
continue;
}
mydepinfo.block_invert = atoi( dit.getProp("block_invert").c_str());;
long block_val = atoi( dit.getProp("block_value").c_str());;
mydepinfo.block_invert = dit.getIntProp("block_invert");
long block_val = dit.getIntProp("block_value");
long defval = 0;
if( blk.dit != dioEnd(ic) )
......
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