Commit db0848d8 authored by Pavel Vainerman's avatar Pavel Vainerman

minor optimization IOControl

parent fbe49c87
...@@ -240,10 +240,12 @@ void IOControl::execute() ...@@ -240,10 +240,12 @@ void IOControl::execute()
{ {
maxItem = 0; maxItem = 0;
readConfiguration(); readConfiguration();
iomap.resize(maxItem);
cerr << "************************** readConfiguration: " << pt.getCurrent() << " msec " << endl; cerr << "************************** readConfiguration: " << pt.getCurrent() << " msec " << endl;
} }
else else
{ {
iomap.resize(maxItem);
// init iterators // init iterators
for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it ) for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it )
{ {
...@@ -253,7 +255,6 @@ void IOControl::execute() ...@@ -253,7 +255,6 @@ void IOControl::execute()
readconf_ok = true; // .. waitSM() ... readconf_ok = true; // .. waitSM() ...
} }
iomap.resize(maxItem);
maxHalf = maxItem / 2; maxHalf = maxItem / 2;
unideb[Debug::INFO] << myname << "(init): iomap size = " << iomap.size() << endl; unideb[Debug::INFO] << myname << "(init): iomap size = " << iomap.size() << endl;
...@@ -349,7 +350,7 @@ void IOControl::execute() ...@@ -349,7 +350,7 @@ void IOControl::execute()
} }
catch(CORBA::SystemException& ex) catch(CORBA::SystemException& ex)
{ {
unideb[Debug::LEVEL3] << myname << "(execute): ORBA::SystemException: " unideb[Debug::LEVEL3] << myname << "(execute): CORBA::SystemException: "
<< ex.NP_minorString() << endl; << ex.NP_minorString() << endl;
} }
catch(...) catch(...)
...@@ -614,14 +615,14 @@ void IOControl::readConfiguration() ...@@ -614,14 +615,14 @@ void IOControl::readConfiguration()
if(!root) if(!root)
{ {
ostringstream err; ostringstream err;
err << myname << "(readConfiguration): <sensors>"; err << myname << "(readConfiguration): section <sensors> not found";
throw SystemError(err.str()); throw SystemError(err.str());
} }
UniXML_iterator it(root); UniXML_iterator it(root);
if( !it.goChildren() ) if( !it.goChildren() )
{ {
std::cerr << myname << "(readConfiguration): <sensors> ?!!\n"; std::cerr << myname << "(readConfiguration): section <sensors> empty?!!\n";
return; return;
} }
...@@ -719,7 +720,7 @@ bool IOControl::initIOItem( UniXML_iterator& it ) ...@@ -719,7 +720,7 @@ bool IOControl::initIOItem( UniXML_iterator& it )
inf.range = it.getIntProp("range"); inf.range = it.getIntProp("range");
if( inf.range < 0 || inf.range > 3 ) if( inf.range < 0 || inf.range > 3 )
{ {
unideb[Debug::WARN] << myname << "(readItem): (range): " << inf.range unideb[Debug::CRIT] << myname << "(readItem): (range): " << inf.range
<< " " << it.getProp("name") << " " << it.getProp("name")
<< " : range=[0..3]" << endl; << " : range=[0..3]" << endl;
return false; return false;
...@@ -728,7 +729,7 @@ bool IOControl::initIOItem( UniXML_iterator& it ) ...@@ -728,7 +729,7 @@ bool IOControl::initIOItem( UniXML_iterator& it )
inf.aref = it.getIntProp("aref"); inf.aref = it.getIntProp("aref");
if( inf.aref < 0 || inf.aref > 3 ) if( inf.aref < 0 || inf.aref > 3 )
{ {
unideb[Debug::WARN] << myname << "(readItem): : " << inf.aref unideb[Debug::CRIT] << myname << "(readItem): : " << inf.aref
<< " " << it.getProp("name") << endl; << " " << it.getProp("name") << endl;
return false; return false;
} }
...@@ -1017,16 +1018,15 @@ IOControl* IOControl::init_iocontrol( int argc, const char* const* argv, ...@@ -1017,16 +1018,15 @@ IOControl* IOControl::init_iocontrol( int argc, const char* const* argv,
string name = conf->getArgParam("--io-name","IOControl1"); string name = conf->getArgParam("--io-name","IOControl1");
if( name.empty() ) if( name.empty() )
{ {
cerr << "(iocontrol): name'" << endl; cerr << "(iocontrol): Unknown name. Use --io-name " << endl;
return 0; return 0;
} }
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == UniSetTypes::DefaultObjectId )
{ {
cerr << "(iocontrol): '" << name cerr << "(iocontrol): Unknown ID for " << name
<< "' . !" << "' Not found in <objects>" << endl;
<< " " << conf->getObjectsSection() << endl;
return 0; return 0;
} }
......
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