Commit 868dce1e authored by Pavel Vainerman's avatar Pavel Vainerman

Вторая проверка статическим анализатором, make style

parent fe60ba5a
...@@ -348,7 +348,7 @@ int main(int argc, char** argv) ...@@ -348,7 +348,7 @@ int main(int argc, char** argv)
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cout << "admin(main): " << ex << endl; cout << "admin(main): " << ex << endl;
...@@ -517,7 +517,7 @@ static bool commandToAll(const string& section, std::shared_ptr<ObjectRepository ...@@ -517,7 +517,7 @@ static bool commandToAll(const string& section, std::shared_ptr<ObjectRepository
} }
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << setw(55) << ob << " <--- " << ex << endl; cerr << setw(55) << ob << " <--- " << ex << endl;
...@@ -574,7 +574,7 @@ int omap() ...@@ -574,7 +574,7 @@ int omap()
uniset_conf()->oind->printMap(cout); uniset_conf()->oind->printMap(cout);
cout << "==========================================================================\n"; cout << "==========================================================================\n";
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << " configuration init failed: " << ex << endl; cerr << " configuration init failed: " << ex << endl;
...@@ -639,7 +639,7 @@ int setValue( const string& args, UInterface& ui ) ...@@ -639,7 +639,7 @@ int setValue( const string& args, UInterface& ui )
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "(setValue): " << ex << endl;; cerr << "(setValue): " << ex << endl;;
...@@ -706,7 +706,7 @@ int getValue( const string& args, UInterface& ui ) ...@@ -706,7 +706,7 @@ int getValue( const string& args, UInterface& ui )
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "(getValue): " << ex << endl; cerr << "(getValue): " << ex << endl;
...@@ -755,7 +755,7 @@ int getCalibrate( const std::string& args, UInterface& ui ) ...@@ -755,7 +755,7 @@ int getCalibrate( const std::string& args, UInterface& ui )
else else
cout << ci; cout << ci;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "(getCalibrate): " << ex << endl;; cerr << "(getCalibrate): " << ex << endl;;
...@@ -800,7 +800,7 @@ int getRawValue( const std::string& args, UInterface& ui ) ...@@ -800,7 +800,7 @@ int getRawValue( const std::string& args, UInterface& ui )
else else
cout << ui.getRawValue(it.si); cout << ui.getRawValue(it.si);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "(getRawValue): " << ex << endl;; cerr << "(getRawValue): " << ex << endl;;
...@@ -845,7 +845,7 @@ int getChangedTime( const std::string& args, UInterface& ui ) ...@@ -845,7 +845,7 @@ int getChangedTime( const std::string& args, UInterface& ui )
else else
cout << ui.getChangedTime(it.si.id, it.si.node); cout << ui.getChangedTime(it.si.id, it.si.node);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "(getChangedTime): " << ex << endl;; cerr << "(getChangedTime): " << ex << endl;;
...@@ -913,9 +913,11 @@ int logRotate( const string& arg, UInterface& ui ) ...@@ -913,9 +913,11 @@ int logRotate( const string& arg, UInterface& ui )
else // посылка определённому объекту else // посылка определённому объекту
{ {
UniSetTypes::ObjectId id = conf->getObjectID(arg); UniSetTypes::ObjectId id = conf->getObjectID(arg);
if( id == DefaultObjectId ) if( id == DefaultObjectId )
id = conf->getControllerID(arg); id = conf->getControllerID(arg);
else if( id == DefaultObjectId )
if( id == DefaultObjectId )
id = conf->getServiceID(arg); id = conf->getServiceID(arg);
if( id == DefaultObjectId ) if( id == DefaultObjectId )
...@@ -953,6 +955,7 @@ int configure( const string& arg, UInterface& ui ) ...@@ -953,6 +955,7 @@ int configure( const string& arg, UInterface& ui )
else // посылка определённому объекту else // посылка определённому объекту
{ {
UniSetTypes::ObjectId id = conf->getObjectID(arg); UniSetTypes::ObjectId id = conf->getObjectID(arg);
if( id == DefaultObjectId ) if( id == DefaultObjectId )
id = conf->getControllerID(arg); id = conf->getControllerID(arg);
...@@ -1004,7 +1007,7 @@ int oinfo( const string& args, UInterface& ui, int userparam ) ...@@ -1004,7 +1007,7 @@ int oinfo( const string& args, UInterface& ui, int userparam )
cout << inf->info << endl; cout << inf->info << endl;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cout << "ID='" << it.id << "' ERROR: " << ex << endl; cout << "ID='" << it.id << "' ERROR: " << ex << endl;
......
...@@ -215,7 +215,7 @@ int main( int argc, char** argv ) ...@@ -215,7 +215,7 @@ int main( int argc, char** argv )
{ {
cerr << "(mbtester): " << err << endl; cerr << "(mbtester): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(mbtester): " << ex << endl; cerr << "(mbtester): " << ex << endl;
} }
......
...@@ -713,7 +713,7 @@ int main( int argc, char** argv ) ...@@ -713,7 +713,7 @@ int main( int argc, char** argv )
{ {
cerr << "(mbtester): " << err << endl; cerr << "(mbtester): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(mbtester): " << ex << endl; cerr << "(mbtester): " << ex << endl;
} }
......
...@@ -135,7 +135,7 @@ int main( int argc, char** argv ) ...@@ -135,7 +135,7 @@ int main( int argc, char** argv )
{ {
ui.setValue(it.si, j, DefaultObjectId); ui.setValue(it.si, j, DefaultObjectId);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << endl << "save id=" << it.fname << " " << ex << endl; cerr << endl << "save id=" << it.fname << " " << ex << endl;
} }
...@@ -162,7 +162,7 @@ int main( int argc, char** argv ) ...@@ -162,7 +162,7 @@ int main( int argc, char** argv )
{ {
ui.setValue(it->si, i, DefaultObjectId); ui.setValue(it->si, i, DefaultObjectId);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << endl << "save id=" << it->fname << " " << ex << endl; cerr << endl << "save id=" << it->fname << " " << ex << endl;
} }
...@@ -172,7 +172,7 @@ int main( int argc, char** argv ) ...@@ -172,7 +172,7 @@ int main( int argc, char** argv )
msleep(amsec); msleep(amsec);
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << endl << "(simitator): " << ex << endl; cerr << endl << "(simitator): " << ex << endl;
return 1; return 1;
......
...@@ -47,7 +47,7 @@ int main( int argc, const char** argv ) ...@@ -47,7 +47,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cout << "(main):" << ex << endl; cout << "(main):" << ex << endl;
} }
......
...@@ -94,7 +94,7 @@ int main( int argc, char* argv[], char* envp[] ) ...@@ -94,7 +94,7 @@ int main( int argc, char* argv[], char* envp[] )
cerr << "(log-stdin): " << err << endl; cerr << "(log-stdin): " << err << endl;
return 1; return 1;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(log-stdin): " << ex << endl; cerr << "(log-stdin): " << ex << endl;
return 1; return 1;
......
...@@ -105,7 +105,7 @@ int main( int argc, char* argv[], char* envp[] ) ...@@ -105,7 +105,7 @@ int main( int argc, char* argv[], char* envp[] )
cerr << "(logserver-wrap): " << err << endl; cerr << "(logserver-wrap): " << err << endl;
return 1; return 1;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(logserver-wrap): " << ex << endl; cerr << "(logserver-wrap): " << ex << endl;
return 1; return 1;
......
...@@ -317,7 +317,7 @@ int main( int argc, char** argv ) ...@@ -317,7 +317,7 @@ int main( int argc, char** argv )
{ {
cerr << "(log): " << err << endl; cerr << "(log): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(log): " << ex << endl; cerr << "(log): " << ex << endl;
} }
......
...@@ -209,7 +209,7 @@ int main( int argc, char** argv ) ...@@ -209,7 +209,7 @@ int main( int argc, char** argv )
{ {
cerr << "(logserver): " << err << endl; cerr << "(logserver): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(logserver): " << ex << endl; cerr << "(logserver): " << ex << endl;
} }
......
...@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept ...@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
ui->setValue(idHeartBeat,maxHeartBeat); ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept ...@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
updateOutputs(forceOut); updateOutputs(forceOut);
updatePreviousValues(); updatePreviousValues();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -206,7 +206,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm ...@@ -206,7 +206,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each> </xsl:for-each>
return; return;
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -267,7 +267,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si ...@@ -267,7 +267,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid); return ui->getValue(_sid);
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -321,7 +321,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) ...@@ -321,7 +321,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -356,7 +356,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) ...@@ -356,7 +356,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() ); ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -371,7 +371,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) ...@@ -371,7 +371,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() ); ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
......
...@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept ...@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
ui->setValue(idHeartBeat,maxHeartBeat); ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -100,7 +100,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept ...@@ -100,7 +100,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
// обновление списка предыдущих состояний // обновление списка предыдущих состояний
updatePreviousValues(); updatePreviousValues();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -109,7 +109,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept ...@@ -109,7 +109,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
mycrit &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: " mycrit &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl; &lt;&lt; ex.NP_minorString() &lt;&lt; endl;
} }
catch( const std::exception&amp;ex ) catch( const std::exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): catch " &lt;&lt; ex.what() &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): catch " &lt;&lt; ex.what() &lt;&lt; endl;
} }
...@@ -261,7 +261,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID() ...@@ -261,7 +261,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -296,7 +296,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID() ...@@ -296,7 +296,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() ); ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -311,7 +311,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID() ...@@ -311,7 +311,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() ); ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
......
...@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept ...@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
ui->setValue(idHeartBeat,maxHeartBeat); ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept ...@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
updateOutputs(forceOut); updateOutputs(forceOut);
updatePreviousValues(); updatePreviousValues();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -104,7 +104,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept ...@@ -104,7 +104,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
mycrit &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: " mycrit &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl; &lt;&lt; ex.NP_minorString() &lt;&lt; endl;
} }
catch( const std::exception&amp;ex ) catch( const std::exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): catch " &lt;&lt; ex.what() &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): catch " &lt;&lt; ex.what() &lt;&lt; endl;
} }
...@@ -221,7 +221,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si ...@@ -221,7 +221,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid); return ui->getValue(_sid);
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm ...@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each> </xsl:for-each>
return; return;
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
} }
......
...@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept ...@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
ui->setValue(idHeartBeat,maxHeartBeat); ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -98,7 +98,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept ...@@ -98,7 +98,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
updateOutputs(forceOut); updateOutputs(forceOut);
updatePreviousValues(); updatePreviousValues();
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
} }
...@@ -221,7 +221,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM() ...@@ -221,7 +221,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
if( <xsl:value-of select="@name"/> != DefaultObjectId ) if( <xsl:value-of select="@name"/> != DefaultObjectId )
priv_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui->getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>); priv_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui->getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -238,7 +238,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM() ...@@ -238,7 +238,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() ); ui->setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
} }
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM() ...@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() ); ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
} }
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
...@@ -273,7 +273,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM() ...@@ -273,7 +273,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si,(long)m_<xsl:value-of select="@name"/>, getId() ); ui->setValue( si,(long)m_<xsl:value-of select="@name"/>, getId() );
} }
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
mycrit &lt;&lt; myname &lt;&lt; "(setmsg): " &lt;&lt; ex &lt;&lt; endl; mycrit &lt;&lt; myname &lt;&lt; "(setmsg): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</xsl:when> </xsl:when>
<xsl:when test="$GENTYPE='CHECK'"> <xsl:when test="$GENTYPE='CHECK'">
<xsl:if test="normalize-space(@vartype)!='io'"> <xsl:if test="normalize-space(@vartype)!='io'">
<xsl:if test="normalize-space(../../@id)=''">throw SystemException("Not Found ID for <xsl:value-of select="../../@name"/>");</xsl:if> <xsl:if test="normalize-space(../../@id)=''">throw UniSetTypes::SystemError("Not Found ID for <xsl:value-of select="../../@name"/>");</xsl:if>
</xsl:if> </xsl:if>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
...@@ -672,7 +672,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te ...@@ -672,7 +672,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
// abort(); // abort();
// raise(SIGTERM); // raise(SIGTERM);
std::terminate(); std::terminate();
// throw SystemError(err.str()); // throw UniSetTypes::SystemError(err.str());
} }
if( !ui->waitWorking(_testID,wait_msec) ) if( !ui->waitWorking(_testID,wait_msec) )
...@@ -687,7 +687,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te ...@@ -687,7 +687,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
// abort(); // abort();
//raise(SIGTERM); //raise(SIGTERM);
std::terminate(); std::terminate();
// throw SystemError(err.str()); // throw UniSetTypes::SystemError(err.str());
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -864,7 +864,7 @@ forceOut(false), ...@@ -864,7 +864,7 @@ forceOut(false),
end_private(false) end_private(false)
{ {
mycrit &lt;&lt; "<xsl:value-of select="$CLASSNAME"/>: init failed!!!!!!!!!!!!!!!" &lt;&lt; endl; mycrit &lt;&lt; "<xsl:value-of select="$CLASSNAME"/>: init failed!!!!!!!!!!!!!!!" &lt;&lt; endl;
throw Exception( string(myname+": init failed!!!") ); throw UniSetTypes::Exception( string(myname+": init failed!!!") );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ( val, confval, default val ) // ( val, confval, default val )
...@@ -952,7 +952,7 @@ end_private(false) ...@@ -952,7 +952,7 @@ end_private(false)
{ {
ostringstream err; ostringstream err;
err &lt;&lt; "(<xsl:value-of select="$CLASSNAME"/>::init): Unknown ObjectID!"; err &lt;&lt; "(<xsl:value-of select="$CLASSNAME"/>::init): Unknown ObjectID!";
throw SystemError( err.str() ); throw UniSetTypes::SystemError( err.str() );
} }
mylog = make_shared&lt;DebugStream&gt;(); mylog = make_shared&lt;DebugStream&gt;();
...@@ -973,13 +973,13 @@ end_private(false) ...@@ -973,13 +973,13 @@ end_private(false)
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@no_check_id)!='1'"> <xsl:if test="normalize-space(@no_check_id)!='1'">
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") ); throw UniSetTypes::SystemError( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") );
</xsl:if> </xsl:if>
<xsl:if test="normalize-space(@no_check_id)!='1'"> <xsl:if test="normalize-space(@no_check_id)!='1'">
if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": Not found NodeID for (node='node_<xsl:value-of select="normalize-space(@name)"/>') " + conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>") ); throw UniSetTypes::SystemError( myname + ": Not found NodeID for (node='node_<xsl:value-of select="normalize-space(@name)"/>') " + conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>") );
</xsl:if> </xsl:if>
<xsl:if test="normalize-space($VARMAP)='1'"> <xsl:if test="normalize-space($VARMAP)='1'">
...@@ -999,11 +999,11 @@ end_private(false) ...@@ -999,11 +999,11 @@ end_private(false)
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
{ {
if( !conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>").empty() ) if( !conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>").empty() )
throw Exception( myname + ": Not found Message::NodeID for (node='node_<xsl:value-of select="normalize-space(@name)"/>') " + conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>") ); throw UniSetTypes::SystemError( myname + ": Not found Message::NodeID for (node='node_<xsl:value-of select="normalize-space(@name)"/>') " + conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>") );
} }
if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": Not found Message::NodeID for (node='node_<xsl:value-of select="normalize-space(@name)"/>') " + conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>") ); throw UniSetTypes::SystemError( myname + ": Not found Message::NodeID for (node='node_<xsl:value-of select="normalize-space(@name)"/>') " + conf->getProp(cnode,"node_<xsl:value-of select="normalize-space(@name)"/>") );
</xsl:for-each> </xsl:for-each>
UniXML::iterator it(cnode); UniXML::iterator it(cnode);
...@@ -1025,7 +1025,7 @@ end_private(false) ...@@ -1025,7 +1025,7 @@ end_private(false)
{ {
ostringstream err; ostringstream err;
err &lt;&lt; myname &lt;&lt; ": не найден идентификатор для датчика 'HeartBeat' " &lt;&lt; heart; err &lt;&lt; myname &lt;&lt; ": не найден идентификатор для датчика 'HeartBeat' " &lt;&lt; heart;
throw SystemError(err.str()); throw UniSetTypes::SystemError(err.str());
} }
int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime()); int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime());
...@@ -1401,7 +1401,7 @@ askPause(2000), ...@@ -1401,7 +1401,7 @@ askPause(2000),
forceOut(false) forceOut(false)
{ {
mycrit &lt;&lt; "<xsl:value-of select="$CLASSNAME"/>: init failed!!!!!!!!!!!!!!!" &lt;&lt; endl; mycrit &lt;&lt; "<xsl:value-of select="$CLASSNAME"/>: init failed!!!!!!!!!!!!!!!" &lt;&lt; endl;
throw Exception( string(myname+": init failed!!!") ); throw UniSetTypes::SystemError( string(myname+": init failed!!!") );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
<xsl:value-of select="$CLASSNAME"/>_SK::<xsl:value-of select="$CLASSNAME"/>_SK( ObjectId id, xmlNode* cnode, const string&amp; _argprefix ): <xsl:value-of select="$CLASSNAME"/>_SK::<xsl:value-of select="$CLASSNAME"/>_SK( ObjectId id, xmlNode* cnode, const string&amp; _argprefix ):
...@@ -1441,7 +1441,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -1441,7 +1441,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
{ {
ostringstream err; ostringstream err;
err &lt;&lt; "(<xsl:value-of select="$CLASSNAME"/>::init): Unknown ObjectID!"; err &lt;&lt; "(<xsl:value-of select="$CLASSNAME"/>::init): Unknown ObjectID!";
throw SystemError( err.str() ); throw UniSetTypes::SystemError( err.str() );
} }
mylog = make_shared&lt;DebugStream&gt;(); mylog = make_shared&lt;DebugStream&gt;();
...@@ -1486,7 +1486,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -1486,7 +1486,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
{ {
ostringstream err; ostringstream err;
err &lt;&lt; myname &lt;&lt; ": не найден идентификатор для датчика 'HeartBeat' " &lt;&lt; heart; err &lt;&lt; myname &lt;&lt; ": не найден идентификатор для датчика 'HeartBeat' " &lt;&lt; heart;
throw SystemError(err.str()); throw UniSetTypes::SystemError(err.str());
} }
int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime()); int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime());
......
...@@ -75,7 +75,7 @@ int main( int argc,char* argv[] ) ...@@ -75,7 +75,7 @@ int main( int argc,char* argv[] )
act-&gt;run(false); act-&gt;run(false);
return 0; return 0;
} }
catch( const Exception&amp; ex ) catch( const UniSetTypes::Exception&amp; ex )
{ {
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl; cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
} }
......
...@@ -82,7 +82,7 @@ int main( int argc, const char** argv ) ...@@ -82,7 +82,7 @@ int main( int argc, const char** argv )
act-&gt;run(false); act-&gt;run(false);
return 0; return 0;
} }
catch( const Exception&amp; ex) catch( const UniSetTypes::Exception&amp; ex)
{ {
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl; cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
} }
......
...@@ -115,7 +115,7 @@ void DBServer_MySQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem ) ...@@ -115,7 +115,7 @@ void DBServer_MySQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl; dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dbcrit << myname << "(update_confirm): " << ex << endl; dbcrit << myname << "(update_confirm): " << ex << endl;
} }
...@@ -230,7 +230,7 @@ void DBServer_MySQL::sensorInfo( const UniSetTypes::SensorMessage* si ) ...@@ -230,7 +230,7 @@ void DBServer_MySQL::sensorInfo( const UniSetTypes::SensorMessage* si )
dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl; dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dbcrit << myname << "(insert_main_history): " << ex << endl; dbcrit << myname << "(insert_main_history): " << ex << endl;
} }
......
...@@ -48,7 +48,7 @@ int main(int argc, char** argv) ...@@ -48,7 +48,7 @@ int main(int argc, char** argv)
db.close(); db.close();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(test): " << ex << endl; cerr << "(test): " << ex << endl;
} }
......
...@@ -129,7 +129,7 @@ void DBServer_PostgreSQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem ) ...@@ -129,7 +129,7 @@ void DBServer_PostgreSQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl; dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dbcrit << myname << "(update_confirm): " << ex << endl; dbcrit << myname << "(update_confirm): " << ex << endl;
} }
...@@ -222,7 +222,7 @@ void DBServer_PostgreSQL::flushInsertBuffer() ...@@ -222,7 +222,7 @@ void DBServer_PostgreSQL::flushInsertBuffer()
ibuf.erase(beg, end); ibuf.erase(beg, end);
// ibufSize - беззнаковое, так что надо аккуратно // ibufSize - беззнаковое, так что надо аккуратно
ibufSize = (delnum < ibufSize) ? (ibufSize-delnum) : 0; ibufSize = (delnum < ibufSize) ? (ibufSize - delnum) : 0;
dbwarn << myname << "(flushInsertBuffer): overflow: clear data " << delnum << " records." << endl; dbwarn << myname << "(flushInsertBuffer): overflow: clear data " << delnum << " records." << endl;
return; return;
...@@ -275,7 +275,7 @@ void DBServer_PostgreSQL::sensorInfo( const UniSetTypes::SensorMessage* si ) ...@@ -275,7 +275,7 @@ void DBServer_PostgreSQL::sensorInfo( const UniSetTypes::SensorMessage* si )
if( ibufSize >= ibufMaxSize ) if( ibufSize >= ibufMaxSize )
flushInsertBuffer(); flushInsertBuffer();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dbcrit << myname << "(insert_main_history): " << ex << endl; dbcrit << myname << "(insert_main_history): " << ex << endl;
} }
......
...@@ -26,7 +26,7 @@ int main(int argc, char** argv) ...@@ -26,7 +26,7 @@ int main(int argc, char** argv)
act->add(dbs); act->add(dbs);
act->run(false); act->run(false);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(DBServer_PosgreSQL::main): " << ex << endl; cerr << "(DBServer_PosgreSQL::main): " << ex << endl;
} }
......
...@@ -101,7 +101,7 @@ int main(int argc, char** argv) ...@@ -101,7 +101,7 @@ int main(int argc, char** argv)
db.close(); db.close();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(test): " << ex << endl; cerr << "(test): " << ex << endl;
} }
......
...@@ -112,7 +112,7 @@ void DBServer_SQLite::confirmInfo( const UniSetTypes::ConfirmMessage* cem ) ...@@ -112,7 +112,7 @@ void DBServer_SQLite::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl; dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dbcrit << myname << "(update_confirm): " << ex << endl; dbcrit << myname << "(update_confirm): " << ex << endl;
} }
...@@ -213,7 +213,7 @@ void DBServer_SQLite::sensorInfo( const UniSetTypes::SensorMessage* si ) ...@@ -213,7 +213,7 @@ void DBServer_SQLite::sensorInfo( const UniSetTypes::SensorMessage* si )
dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl; dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dbcrit << myname << "(insert_main_history): " << ex << endl; dbcrit << myname << "(insert_main_history): " << ex << endl;
} }
......
...@@ -435,7 +435,7 @@ void IOControl::execute() ...@@ -435,7 +435,7 @@ void IOControl::execute()
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iolog3 << myname << "(execute): " << ex << endl; iolog3 << myname << "(execute): " << ex << endl;
} }
...@@ -690,7 +690,7 @@ void IOControl::ioread( IOInfo* it ) ...@@ -690,7 +690,7 @@ void IOControl::ioread( IOInfo* it )
{ {
iolog3 << myname << "(iopoll): (BadRange)..." << endl; iolog3 << myname << "(iopoll): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iolog3 << myname << "(iopoll): " << ex << endl; iolog3 << myname << "(iopoll): " << ex << endl;
} }
...@@ -938,7 +938,7 @@ void IOControl::initOutputs() ...@@ -938,7 +938,7 @@ void IOControl::initOutputs()
else if( it.stype == UniversalIO::AO ) else if( it.stype == UniversalIO::AO )
card->setAnalogChannel(it.subdev, it.channel, it.defval, it.range, it.aref); card->setAnalogChannel(it.subdev, it.channel, it.defval, it.range, it.aref);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iolog3 << myname << "(initOutput): " << ex << endl; iolog3 << myname << "(initOutput): " << ex << endl;
} }
...@@ -979,7 +979,7 @@ void IOControl::initIOCard() ...@@ -979,7 +979,7 @@ void IOControl::initIOCard()
card->configureChannel(it.subdev, it.channel, ComediInterface::AO); card->configureChannel(it.subdev, it.channel, ComediInterface::AO);
} }
catch( const Exception& ex) catch( const UniSetTypes::Exception& ex)
{ {
iocrit << myname << "(initIOCard): sid=" << it.si.id << " " << ex << endl; iocrit << myname << "(initIOCard): sid=" << it.si.id << " " << ex << endl;
} }
...@@ -1005,7 +1005,7 @@ void IOControl::blink( BlinkList& lst, bool& bstate ) ...@@ -1005,7 +1005,7 @@ void IOControl::blink( BlinkList& lst, bool& bstate )
{ {
card->setDigitalChannel(io->subdev, io->channel, bstate); card->setDigitalChannel(io->subdev, io->channel, bstate);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iocrit << myname << "(blink): " << ex << endl; iocrit << myname << "(blink): " << ex << endl;
} }
...@@ -1091,7 +1091,7 @@ void IOControl::check_testmode() ...@@ -1091,7 +1091,7 @@ void IOControl::check_testmode()
card->setAnalogChannel(it.subdev, it.channel, it.safety, it.range, it.aref); card->setAnalogChannel(it.subdev, it.channel, it.safety, it.range, it.aref);
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iolog3 << myname << "(sigterm): " << ex << endl; iolog3 << myname << "(sigterm): " << ex << endl;
} }
...@@ -1100,7 +1100,7 @@ void IOControl::check_testmode() ...@@ -1100,7 +1100,7 @@ void IOControl::check_testmode()
} }
} }
catch( const Exception& ex) catch( const UniSetTypes::Exception& ex)
{ {
iocrit << myname << "(check_testmode): " << ex << endl; iocrit << myname << "(check_testmode): " << ex << endl;
} }
...@@ -1165,7 +1165,7 @@ void IOControl::check_testlamp() ...@@ -1165,7 +1165,7 @@ void IOControl::check_testlamp()
} }
} }
} }
catch( const Exception& ex) catch( const UniSetTypes::Exception& ex)
{ {
iocrit << myname << "(check_testlamp): " << ex << endl; iocrit << myname << "(check_testlamp): " << ex << endl;
} }
...@@ -1369,7 +1369,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -1369,7 +1369,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( testLamp_s != DefaultObjectId ) if( testLamp_s != DefaultObjectId )
shm->askSensor(testLamp_s, cmd); shm->askSensor(testLamp_s, cmd);
} }
catch( const Exception& ex) catch( const UniSetTypes::Exception& ex)
{ {
iocrit << myname << "(askSensors): " << ex << endl; iocrit << myname << "(askSensors): " << ex << endl;
} }
...@@ -1379,7 +1379,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -1379,7 +1379,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( testMode_as != DefaultObjectId ) if( testMode_as != DefaultObjectId )
shm->askSensor(testMode_as, cmd); shm->askSensor(testMode_as, cmd);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iocrit << myname << "(askSensors): " << ex << endl; iocrit << myname << "(askSensors): " << ex << endl;
} }
...@@ -1400,7 +1400,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -1400,7 +1400,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
{ {
shm->askSensor(it.si.id, cmd, myid); shm->askSensor(it.si.id, cmd, myid);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iocrit << myname << "(askSensors): " << ex << endl; iocrit << myname << "(askSensors): " << ex << endl;
} }
...@@ -1682,7 +1682,7 @@ void IOControl::buildCardsList() ...@@ -1682,7 +1682,7 @@ void IOControl::buildCardsList()
cards[cardnum] = new ComediInterface(iodev); cards[cardnum] = new ComediInterface(iodev);
noCards = false; noCards = false;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
iocrit << myname << "(buildCardsList): " << ex << endl; iocrit << myname << "(buildCardsList): " << ex << endl;
throw; throw;
......
...@@ -74,7 +74,7 @@ void LProcessor::execute( const std::string& lfile ) ...@@ -74,7 +74,7 @@ void LProcessor::execute( const std::string& lfile )
{ {
dcrit << logname << "(execute): " << ex << endl; dcrit << logname << "(execute): " << ex << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << logname << "(execute): " << ex << endl; dcrit << logname << "(execute): " << ex << endl;
} }
...@@ -192,7 +192,7 @@ void LProcessor::setOuts() ...@@ -192,7 +192,7 @@ void LProcessor::setOuts()
{ {
ui.setValue(it.sid, it.el->getOut(), DefaultObjectId); ui.setValue(it.sid, it.el->getOut(), DefaultObjectId);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(LProcessor::setOuts): " << ex << endl; dcrit << "(LProcessor::setOuts): " << ex << endl;
} }
......
...@@ -88,7 +88,7 @@ void PassiveLProcessor::step() ...@@ -88,7 +88,7 @@ void PassiveLProcessor::step()
{ {
LProcessor::step(); LProcessor::step();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(step): (hb) " << ex << std::endl; dcrit << myname << "(step): (hb) " << ex << std::endl;
} }
...@@ -100,7 +100,7 @@ void PassiveLProcessor::step() ...@@ -100,7 +100,7 @@ void PassiveLProcessor::step()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId()); shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(step): (hb) " << ex << std::endl; dcrit << myname << "(step): (hb) " << ex << std::endl;
} }
...@@ -120,7 +120,7 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -120,7 +120,7 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
for( auto& it : extInputs ) for( auto& it : extInputs )
shm->askSensor(it.sid, cmd); shm->askSensor(it.sid, cmd);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(askSensors): " << ex << endl; dcrit << myname << "(askSensors): " << ex << endl;
throw SystemError(myname + "(askSensors): do not ask sensors" ); throw SystemError(myname + "(askSensors): do not ask sensors" );
...@@ -236,7 +236,7 @@ void PassiveLProcessor::setOuts() ...@@ -236,7 +236,7 @@ void PassiveLProcessor::setOuts()
{ {
shm->setValue( it.sid, it.el->getOut() ); shm->setValue( it.sid, it.el->getOut() );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(setOuts): " << ex << endl; dcrit << myname << "(setOuts): " << ex << endl;
} }
...@@ -255,7 +255,7 @@ void PassiveLProcessor::sigterm( int signo ) ...@@ -255,7 +255,7 @@ void PassiveLProcessor::sigterm( int signo )
{ {
shm->setValue(it.sid, 0); shm->setValue(it.sid, 0);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(sigterm): " << ex << endl; dcrit << myname << "(sigterm): " << ex << endl;
} }
......
...@@ -58,7 +58,7 @@ int main(int argc, const char** argv) ...@@ -58,7 +58,7 @@ int main(int argc, const char** argv)
{ {
cerr << ex << endl; cerr << ex << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << ex << endl; cerr << ex << endl;
} }
......
...@@ -95,7 +95,7 @@ int main(int argc, const char** argv) ...@@ -95,7 +95,7 @@ int main(int argc, const char** argv)
{ {
cerr << ex << endl; cerr << ex << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << ex << endl; cerr << ex << endl;
} }
......
...@@ -66,7 +66,7 @@ int main(int argc, const char* argv[] ) ...@@ -66,7 +66,7 @@ int main(int argc, const char* argv[] )
{ {
cerr << "(tests): " << err << endl; cerr << "(tests): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests): " << ex << endl; cerr << "(tests): " << ex << endl;
} }
......
...@@ -319,7 +319,7 @@ void MBExchange::step() ...@@ -319,7 +319,7 @@ void MBExchange::step()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId()); shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(step): (hb) " << ex << std::endl; mbcrit << myname << "(step): (hb) " << ex << std::endl;
} }
...@@ -928,7 +928,7 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty ...@@ -928,7 +928,7 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty
{ {
mblog3 << myname << "(initSMValue): (BadRange)..." << endl; mblog3 << myname << "(initSMValue): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mblog3 << myname << "(initSMValue): " << ex << endl; mblog3 << myname << "(initSMValue): " << ex << endl;
} }
...@@ -1188,7 +1188,7 @@ void MBExchange::updateSM() ...@@ -1188,7 +1188,7 @@ void MBExchange::updateSM()
{ {
mblog3 << myname << "(updateSM): (BadRange)..." << endl; mblog3 << myname << "(updateSM): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mblog3 << myname << "(updateSM): " << ex << endl; mblog3 << myname << "(updateSM): " << ex << endl;
} }
...@@ -1236,7 +1236,7 @@ void MBExchange::updateSM() ...@@ -1236,7 +1236,7 @@ void MBExchange::updateSM()
{ {
mblog3 << myname << "(updateSM): (BadRange)..." << endl; mblog3 << myname << "(updateSM): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mblog3 << myname << "(updateSM): " << ex << endl; mblog3 << myname << "(updateSM): " << ex << endl;
} }
...@@ -1651,7 +1651,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1651,7 +1651,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{ {
mblog3 << myname << "(updateRSProperty): (BadRange)..." << endl; mblog3 << myname << "(updateRSProperty): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mblog3 << myname << "(updateRSProperty): " << ex << endl; mblog3 << myname << "(updateRSProperty): " << ex << endl;
} }
...@@ -1911,7 +1911,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit ) ...@@ -1911,7 +1911,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit )
{ {
mblog3 << myname << "(updateMTR): (BadRange)..." << endl; mblog3 << myname << "(updateMTR): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mblog3 << myname << "(updateMTR): " << ex << endl; mblog3 << myname << "(updateMTR): " << ex << endl;
} }
...@@ -2002,7 +2002,7 @@ void MBExchange::updateRTU188( RegMap::iterator& rit ) ...@@ -2002,7 +2002,7 @@ void MBExchange::updateRTU188( RegMap::iterator& rit )
{ {
mblog3 << myname << "(updateRTU188): (BadRange)..." << endl; mblog3 << myname << "(updateRTU188): (BadRange)..." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mblog3 << myname << "(updateRTU188): " << ex << endl; mblog3 << myname << "(updateRTU188): " << ex << endl;
} }
...@@ -3223,7 +3223,7 @@ void MBExchange::updateRespondSensors() ...@@ -3223,7 +3223,7 @@ void MBExchange::updateRespondSensors()
shm->localSetValue(d->resp_it, d->resp_id, ( set ? 1 : 0 ), getId()); shm->localSetValue(d->resp_it, d->resp_id, ( set ? 1 : 0 ), getId());
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(step): (respond) " << ex << std::endl; mbcrit << myname << "(step): (respond) " << ex << std::endl;
} }
...@@ -3251,7 +3251,7 @@ void MBExchange::execute() ...@@ -3251,7 +3251,7 @@ void MBExchange::execute()
{ {
step(); step();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(execute): " << ex << std::endl; mbcrit << myname << "(execute): " << ex << std::endl;
} }
......
...@@ -124,6 +124,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -124,6 +124,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
sinf->respond_force = it1.getPIntProp("force", 0); sinf->respond_force = it1.getPIntProp("force", 0);
int fn = conf->getArgPInt("--" + prefix + "-check-func", it.getProp("checkFunc"), ModbusRTU::fnUnknown); int fn = conf->getArgPInt("--" + prefix + "-check-func", it.getProp("checkFunc"), ModbusRTU::fnUnknown);
if( fn != ModbusRTU::fnUnknown && if( fn != ModbusRTU::fnUnknown &&
fn != ModbusRTU::fnReadCoilStatus && fn != ModbusRTU::fnReadCoilStatus &&
fn != ModbusRTU::fnReadInputStatus && fn != ModbusRTU::fnReadInputStatus &&
...@@ -248,7 +249,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen ) ...@@ -248,7 +249,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
{ {
// сперва надо обновить все ignore // сперва надо обновить все ignore
// т.к. фактически флаги выставляются и сбрасываются только здесь // т.к. фактически флаги выставляются и сбрасываются только здесь
for( auto&& it: mblist ) for( auto && it : mblist )
it->ignore = !it->ptIgnoreTimeout.checkTime(); it->ignore = !it->ptIgnoreTimeout.checkTime();
// если reopen=true - значит почему-то по текущему каналу связи нет (хотя соединение есть) // если reopen=true - значит почему-то по текущему каналу связи нет (хотя соединение есть)
...@@ -289,6 +290,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen ) ...@@ -289,6 +290,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
for( auto it = mblist.rbegin(); it != mblist.rend(); ++it ) for( auto it = mblist.rbegin(); it != mblist.rend(); ++it )
{ {
auto m = (*it); auto m = (*it);
if( m->respond && !m->ignore && m->init(mblog) ) if( m->respond && !m->ignore && m->init(mblog) )
{ {
mbi = it; mbi = it;
...@@ -306,6 +308,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen ) ...@@ -306,6 +308,7 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
for( auto it = mblist.rbegin(); it != mblist.rend(); ++it ) for( auto it = mblist.rbegin(); it != mblist.rend(); ++it )
{ {
auto& m = (*it); auto& m = (*it);
if( m->respond && m->check() && m->init(mblog) ) if( m->respond && m->check() && m->init(mblog) )
{ {
mbi = it; mbi = it;
...@@ -348,41 +351,42 @@ bool MBTCPMultiMaster::MBSlaveInfo::check() ...@@ -348,41 +351,42 @@ bool MBTCPMultiMaster::MBSlaveInfo::check()
if( use ) if( use )
return true; return true;
// cerr << myname << "(check): check connection..." << ip << ":" << port // cerr << myname << "(check): check connection..." << ip << ":" << port
// << " mbfunc=" << checkFunc // << " mbfunc=" << checkFunc
// << " mbaddr=" << ModbusRTU::addr2str(checkAddr) // << " mbaddr=" << ModbusRTU::addr2str(checkAddr)
// << " mbreg=" << (int)checkReg << "(" << ModbusRTU::dat2str(checkReg) << ")" // << " mbreg=" << (int)checkReg << "(" << ModbusRTU::dat2str(checkReg) << ")"
// << endl; // << endl;
try try
{ {
mbtcp->connect(ip,port,false); mbtcp->connect(ip, port, false);
switch(checkFunc) switch(checkFunc)
{ {
case ModbusRTU::fnReadCoilStatus: case ModbusRTU::fnReadCoilStatus:
{ {
auto ret = mbtcp->read01(checkAddr,checkReg,1); auto ret = mbtcp->read01(checkAddr, checkReg, 1);
return true; return true;
} }
break; break;
case ModbusRTU::fnReadInputStatus: case ModbusRTU::fnReadInputStatus:
{ {
auto ret = mbtcp->read02(checkAddr,checkReg,1); auto ret = mbtcp->read02(checkAddr, checkReg, 1);
return true; return true;
} }
break; break;
case ModbusRTU::fnReadOutputRegisters: case ModbusRTU::fnReadOutputRegisters:
{ {
auto ret = mbtcp->read03(checkAddr,checkReg,1); auto ret = mbtcp->read03(checkAddr, checkReg, 1);
return true; return true;
} }
break; break;
case ModbusRTU::fnReadInputRegisters: case ModbusRTU::fnReadInputRegisters:
{ {
auto ret = mbtcp->read04(checkAddr,checkReg,1); auto ret = mbtcp->read04(checkAddr, checkReg, 1);
return true; return true;
} }
break; break;
...@@ -391,7 +395,7 @@ bool MBTCPMultiMaster::MBSlaveInfo::check() ...@@ -391,7 +395,7 @@ bool MBTCPMultiMaster::MBSlaveInfo::check()
return mbtcp->checkConnection(ip, port, recv_timeout); return mbtcp->checkConnection(ip, port, recv_timeout);
} }
} }
catch(...){} catch(...) {}
return false; return false;
} }
...@@ -482,7 +486,7 @@ void MBTCPMultiMaster::check_thread() ...@@ -482,7 +486,7 @@ void MBTCPMultiMaster::check_thread()
{ {
while( checkProcActive() ) while( checkProcActive() )
{ {
for( auto&& it: mblist ) for( auto && it : mblist )
{ {
try try
{ {
...@@ -516,7 +520,7 @@ void MBTCPMultiMaster::check_thread() ...@@ -516,7 +520,7 @@ void MBTCPMultiMaster::check_thread()
it->respond_init = true; it->respond_init = true;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex << std::endl; mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex << std::endl;
} }
...@@ -613,6 +617,7 @@ void MBTCPMultiMaster::initCheckConnectionParameters() ...@@ -613,6 +617,7 @@ void MBTCPMultiMaster::initCheckConnectionParameters()
auto conf = uniset_conf(); auto conf = uniset_conf();
bool initFromRegMap = ( findArgParam("--" + prefix + "-check-init-from-regmap", conf->getArgc(), conf->getArgv()) != -1 ); bool initFromRegMap = ( findArgParam("--" + prefix + "-check-init-from-regmap", conf->getArgc(), conf->getArgv()) != -1 );
if( !initFromRegMap ) if( !initFromRegMap )
return; return;
...@@ -635,16 +640,17 @@ void MBTCPMultiMaster::initCheckConnectionParameters() ...@@ -635,16 +640,17 @@ void MBTCPMultiMaster::initCheckConnectionParameters()
} }
// идём по устройствам // идём по устройствам
for( const auto& d: devices ) for( const auto& d : devices )
{ {
checkAddr = d.second->mbaddr; checkAddr = d.second->mbaddr;
if( d.second->pollmap.empty() ) if( d.second->pollmap.empty() )
continue; continue;
// идём по списку опрашиваемых регистров // идём по списку опрашиваемых регистров
for( auto p = d.second->pollmap.begin(); p != d.second->pollmap.end(); ++p ) for( auto p = d.second->pollmap.begin(); p != d.second->pollmap.end(); ++p )
{ {
for( auto r = p->second->begin(); r!=p->second->end(); ++r ) for( auto r = p->second->begin(); r != p->second->end(); ++r )
{ {
if( ModbusRTU::isReadFunction(r->second->mbfunc) ) if( ModbusRTU::isReadFunction(r->second->mbfunc) )
{ {
...@@ -681,7 +687,7 @@ void MBTCPMultiMaster::initCheckConnectionParameters() ...@@ -681,7 +687,7 @@ void MBTCPMultiMaster::initCheckConnectionParameters()
<< endl; << endl;
// инициализируем.. // инициализируем..
for( auto&& m: mblist ) for( auto && m : mblist )
{ {
m->checkFunc = checkFunc; m->checkFunc = checkFunc;
m->checkAddr = checkAddr; m->checkAddr = checkAddr;
......
...@@ -160,7 +160,7 @@ std::shared_ptr<ModbusClient> RTUExchange::initMB( bool reopen ) ...@@ -160,7 +160,7 @@ std::shared_ptr<ModbusClient> RTUExchange::initMB( bool reopen )
mbinfo << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl; mbinfo << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
//if( mbrtu ) //if( mbrtu )
// delete mbrtu; // delete mbrtu;
......
...@@ -61,7 +61,7 @@ int main( int argc, const char** argv ) ...@@ -61,7 +61,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(mbtcpmaster): " << ex << std::endl; dcrit << "(mbtcpmaster): " << ex << std::endl;
} }
......
...@@ -81,7 +81,7 @@ int main( int argc, const char** argv ) ...@@ -81,7 +81,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(mbtcpmultimaster): " << ex << std::endl; cerr << "(mbtcpmultimaster): " << ex << std::endl;
} }
......
...@@ -76,7 +76,7 @@ int main( int argc, const char** argv ) ...@@ -76,7 +76,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(mbtcpmultimaster): " << ex << std::endl; dcrit << "(mbtcpmultimaster): " << ex << std::endl;
} }
......
...@@ -76,7 +76,7 @@ int main( int argc, char** argv ) ...@@ -76,7 +76,7 @@ int main( int argc, char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(rtuexchange): " << ex << std::endl; dcrit << "(rtuexchange): " << ex << std::endl;
} }
......
...@@ -74,7 +74,7 @@ int main( int argc, const char* argv[] ) ...@@ -74,7 +74,7 @@ int main( int argc, const char* argv[] )
return session.run(); return session.run();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_mbtcpmaster): " << ex << endl; cerr << "(tests_mbtcpmaster): " << ex << endl;
} }
......
...@@ -74,7 +74,7 @@ int main(int argc, const char* argv[] ) ...@@ -74,7 +74,7 @@ int main(int argc, const char* argv[] )
{ {
cerr << "(tests_mbtcpmultimaster): " << err << endl; cerr << "(tests_mbtcpmultimaster): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_mbtcpmultimaster): " << ex << endl; cerr << "(tests_mbtcpmultimaster): " << ex << endl;
} }
......
...@@ -96,7 +96,7 @@ TEST_CASE("MBTCPMaster: reconnect", "[modbus][mbmaster][mbtcpmaster]") ...@@ -96,7 +96,7 @@ TEST_CASE("MBTCPMaster: reconnect", "[modbus][mbmaster][mbtcpmaster]")
REQUIRE_FALSE(mb.isConnection()); REQUIRE_FALSE(mb.isConnection());
// нормальное подключение // нормальное подключение
REQUIRE(mb.connect(iaddr,port)); REQUIRE(mb.connect(iaddr, port));
REQUIRE(mb.isConnection()); REQUIRE(mb.isConnection());
// переподключение (при активном текущем) // переподключение (при активном текущем)
...@@ -116,7 +116,7 @@ TEST_CASE("MBTCPMaster: reconnect", "[modbus][mbmaster][mbtcpmaster]") ...@@ -116,7 +116,7 @@ TEST_CASE("MBTCPMaster: reconnect", "[modbus][mbmaster][mbtcpmaster]")
REQUIRE_FALSE(mb.isConnection()); REQUIRE_FALSE(mb.isConnection());
// нормальное подключение // нормальное подключение
REQUIRE(mb.connect(iaddr,port)); REQUIRE(mb.connect(iaddr, port));
REQUIRE(mb.isConnection()); REQUIRE(mb.isConnection());
// принудительное отключение // принудительное отключение
...@@ -130,15 +130,17 @@ TEST_CASE("MBTCPMaster: forceDisconnect", "[modbus][mbmaster][mbtcpmaster][force ...@@ -130,15 +130,17 @@ TEST_CASE("MBTCPMaster: forceDisconnect", "[modbus][mbmaster][mbtcpmaster][force
ModbusTCPMaster mb; ModbusTCPMaster mb;
mb.setTimeout(500); mb.setTimeout(500);
for( size_t i=0; i<1000; i++ ) for( size_t i = 0; i < 1000; i++ )
{ {
// подключение к несуществующему адресу // подключение к несуществующему адресу
REQUIRE_FALSE(mb.connect(iaddr, 2048)); REQUIRE_FALSE(mb.connect(iaddr, 2048));
try try
{ {
mb.read03(slaveADDR,10,1); mb.read03(slaveADDR, 10, 1);
} }
catch(...){} catch(...) {}
REQUIRE_FALSE(mb.isConnection()); REQUIRE_FALSE(mb.isConnection());
mb.forceDisconnect(); mb.forceDisconnect();
} }
...@@ -151,15 +153,17 @@ TEST_CASE("MBTCPMaster: disconnect", "[modbus][mbmaster][mbtcpmaster][disconnect ...@@ -151,15 +153,17 @@ TEST_CASE("MBTCPMaster: disconnect", "[modbus][mbmaster][mbtcpmaster][disconnect
mb.setTimeout(500); mb.setTimeout(500);
mb.setForceDisconnect(true); mb.setForceDisconnect(true);
for( size_t i=0; i<1000; i++ ) for( size_t i = 0; i < 1000; i++ )
{ {
// подключение к несуществующему адресу // подключение к несуществующему адресу
REQUIRE_FALSE(mb.connect(iaddr, 2048)); REQUIRE_FALSE(mb.connect(iaddr, 2048));
try try
{ {
mb.read03(slaveADDR,10,1); mb.read03(slaveADDR, 10, 1);
} }
catch(...){} catch(...) {}
REQUIRE_FALSE(mb.isConnection()); REQUIRE_FALSE(mb.isConnection());
mb.disconnect(); mb.disconnect();
} }
......
...@@ -683,7 +683,7 @@ void MBSlave::updateStatistics() ...@@ -683,7 +683,7 @@ void MBSlave::updateStatistics()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId()); shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(updateStatistics): (hb) " << ex << std::endl; mbcrit << myname << "(updateStatistics): (hb) " << ex << std::endl;
} }
...@@ -700,7 +700,7 @@ void MBSlave::updateStatistics() ...@@ -700,7 +700,7 @@ void MBSlave::updateStatistics()
{ {
shm->localSetValue(itRespond, respond_id, (state ? 1 : 0), getId()); shm->localSetValue(itRespond, respond_id, (state ? 1 : 0), getId());
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(updateStatistics): (respond) " << ex << std::endl; mbcrit << myname << "(updateStatistics): (respond) " << ex << std::endl;
} }
...@@ -712,7 +712,7 @@ void MBSlave::updateStatistics() ...@@ -712,7 +712,7 @@ void MBSlave::updateStatistics()
{ {
shm->localSetValue(itAskCount, askcount_id, askCount, getId()); shm->localSetValue(itAskCount, askcount_id, askCount, getId());
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(updateStatistics): (askCount) " << ex << std::endl; mbcrit << myname << "(updateStatistics): (askCount) " << ex << std::endl;
} }
...@@ -724,7 +724,7 @@ void MBSlave::updateStatistics() ...@@ -724,7 +724,7 @@ void MBSlave::updateStatistics()
{ {
shm->localSetValue(sesscount_it, sesscount_id, tcpserver->getCountSessions(), getId()); shm->localSetValue(sesscount_it, sesscount_id, tcpserver->getCountSessions(), getId());
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(updateStatistics): (sessCount) " << ex << std::endl; mbcrit << myname << "(updateStatistics): (sessCount) " << ex << std::endl;
} }
...@@ -797,7 +797,7 @@ void MBSlave::updateTCPStatistics() ...@@ -797,7 +797,7 @@ void MBSlave::updateTCPStatistics()
bool st = c.invert ? c.ptTimeout.checkTime() : !c.ptTimeout.checkTime(); bool st = c.invert ? c.ptTimeout.checkTime() : !c.ptTimeout.checkTime();
shm->localSetValue(c.respond_it, c.respond_s, st, getId()); shm->localSetValue(c.respond_it, c.respond_s, st, getId());
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(updateStatistics): " << ex << std::endl; mbcrit << myname << "(updateStatistics): " << ex << std::endl;
} }
...@@ -809,7 +809,7 @@ void MBSlave::updateTCPStatistics() ...@@ -809,7 +809,7 @@ void MBSlave::updateTCPStatistics()
{ {
shm->localSetValue(c.askcount_it, c.askcount_s, c.askCount, getId()); shm->localSetValue(c.askcount_it, c.askcount_s, c.askCount, getId());
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mbcrit << myname << "(updateStatistics): " << ex << std::endl; mbcrit << myname << "(updateStatistics): " << ex << std::endl;
} }
...@@ -1961,7 +1961,7 @@ ModbusRTU::mbErrCode MBSlave::real_write_prop( IOProperty* p, ModbusRTU::ModbusD ...@@ -1961,7 +1961,7 @@ ModbusRTU::mbErrCode MBSlave::real_write_prop( IOProperty* p, ModbusRTU::ModbusD
mbwarn << myname << "(real_write_prop): " << ex << endl; mbwarn << myname << "(real_write_prop): " << ex << endl;
return ModbusRTU::erBadDataValue; return ModbusRTU::erBadDataValue;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( pingOK ) if( pingOK )
mbcrit << myname << "(real_write_prop): " << ex << endl; mbcrit << myname << "(real_write_prop): " << ex << endl;
...@@ -2214,7 +2214,7 @@ ModbusRTU::mbErrCode MBSlave::real_read_prop( IOProperty* p, ModbusRTU::ModbusDa ...@@ -2214,7 +2214,7 @@ ModbusRTU::mbErrCode MBSlave::real_read_prop( IOProperty* p, ModbusRTU::ModbusDa
mbwarn << myname << "(real_read_prop): " << ex << endl; mbwarn << myname << "(real_read_prop): " << ex << endl;
return ModbusRTU::erBadDataValue; return ModbusRTU::erBadDataValue;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( pingOK ) if( pingOK )
mbcrit << myname << "(real_read_prop): " << ex << endl; mbcrit << myname << "(real_read_prop): " << ex << endl;
...@@ -2354,7 +2354,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query, ...@@ -2354,7 +2354,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
mbwarn << myname << "(readCoilStatus): " << ex << endl; mbwarn << myname << "(readCoilStatus): " << ex << endl;
return ModbusRTU::erBadDataAddress; return ModbusRTU::erBadDataAddress;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( pingOK ) if( pingOK )
mbcrit << myname << "(readCoilStatus): " << ex << endl; mbcrit << myname << "(readCoilStatus): " << ex << endl;
...@@ -2427,7 +2427,7 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query, ...@@ -2427,7 +2427,7 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
mbwarn << myname << "(readInputStatus): " << ex << endl; mbwarn << myname << "(readInputStatus): " << ex << endl;
return ModbusRTU::erBadDataAddress; return ModbusRTU::erBadDataAddress;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( pingOK ) if( pingOK )
mbcrit << myname << "(readInputStatus): " << ex << endl; mbcrit << myname << "(readInputStatus): " << ex << endl;
......
...@@ -84,7 +84,7 @@ int main(int argc, const char** argv) ...@@ -84,7 +84,7 @@ int main(int argc, const char** argv)
{ {
dcrit << "(mbslave): " << err << endl; dcrit << "(mbslave): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(mbslave): " << ex << endl; dcrit << "(mbslave): " << ex << endl;
} }
......
...@@ -95,7 +95,7 @@ int main(int argc, const char** argv) ...@@ -95,7 +95,7 @@ int main(int argc, const char** argv)
{ {
dcrit << "(mbmultislave): " << err << endl; dcrit << "(mbmultislave): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(mbmultislave): " << ex << endl; dcrit << "(mbmultislave): " << ex << endl;
} }
......
...@@ -80,7 +80,7 @@ int main(int argc, const char* argv[] ) ...@@ -80,7 +80,7 @@ int main(int argc, const char* argv[] )
{ {
cerr << "(tests_with_sm): " << err << endl; cerr << "(tests_with_sm): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_with_sm): " << ex << endl; cerr << "(tests_with_sm): " << ex << endl;
} }
......
...@@ -59,6 +59,7 @@ RRDServer::RRDServer(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::O ...@@ -59,6 +59,7 @@ RRDServer::RRDServer(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::O
{ {
// берём первый датчик из списка // берём первый датчик из списка
const auto& lst = rrdlist.begin()->dslist; const auto& lst = rrdlist.begin()->dslist;
if( !lst.empty() ) if( !lst.empty() )
{ {
const auto& dsi = *(lst.begin()); const auto& dsi = *(lst.begin());
...@@ -280,7 +281,7 @@ void RRDServer::help_print( int argc, const char* const* argv ) ...@@ -280,7 +281,7 @@ void RRDServer::help_print( int argc, const char* const* argv )
cout << " logfile filanme " << endl; cout << " logfile filanme " << endl;
cout << " no-debug " << endl; cout << " no-debug " << endl;
cout << " Base oprtions: " << endl; cout << " Base oprtions: " << endl;
// cout << UObject_SK::help() << endl; // cout << UObject_SK::help() << endl;
cout << " LogServer: " << endl; cout << " LogServer: " << endl;
cout << "--prefix-run-logserver - run logserver. Default: localhost:id" << endl; cout << "--prefix-run-logserver - run logserver. Default: localhost:id" << endl;
cout << "--prefix-logserver-host ip - listen ip. Default: localhost" << endl; cout << "--prefix-logserver-host ip - listen ip. Default: localhost" << endl;
......
...@@ -127,7 +127,7 @@ void SMDBServer::step() ...@@ -127,7 +127,7 @@ void SMDBServer::step()
shm->localSaveValue(aitHeartBeat, sidHeartBeat, maxHeartBeat, getId()); shm->localSaveValue(aitHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(step): (hb) " << ex << std::endl; dcrit << myname << "(step): (hb) " << ex << std::endl;
} }
...@@ -183,7 +183,7 @@ void SMDBServer::initDB( DBInterface* db ) ...@@ -183,7 +183,7 @@ void SMDBServer::initDB( DBInterface* db )
} }
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << myname << "(filling ObjectsMap): " << ex << std::endl; dcrit << myname << "(filling ObjectsMap): " << ex << std::endl;
} }
......
...@@ -71,7 +71,7 @@ int main( int argc, const char** argv ) ...@@ -71,7 +71,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(smdbserver): " << ex << std::endl; dcrit << "(smdbserver): " << ex << std::endl;
} }
......
...@@ -38,7 +38,7 @@ int main( int argc, const char** argv ) ...@@ -38,7 +38,7 @@ int main( int argc, const char** argv )
smv.run(); smv.run();
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cout << "(main):" << ex << endl; cout << "(main):" << ex << endl;
} }
......
...@@ -398,7 +398,7 @@ void SharedMemory::checkHeartBeat() ...@@ -398,7 +398,7 @@ void SharedMemory::checkHeartBeat()
} }
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
smcrit << myname << "(checkHeartBeat): " << ex << endl; smcrit << myname << "(checkHeartBeat): " << ex << endl;
} }
...@@ -973,7 +973,7 @@ bool SharedMemory::initFromSM( UniSetTypes::ObjectId sm_id, UniSetTypes::ObjectI ...@@ -973,7 +973,7 @@ bool SharedMemory::initFromSM( UniSetTypes::ObjectId sm_id, UniSetTypes::ObjectI
#endif #endif
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
smcrit << myname << "(initFromSM): " << ex << endl; smcrit << myname << "(initFromSM): " << ex << endl;
} }
......
...@@ -56,7 +56,7 @@ int main(int argc, const char** argv) ...@@ -56,7 +56,7 @@ int main(int argc, const char** argv)
{ {
dcrit << "(smemory): " << err << endl; dcrit << "(smemory): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(smemory): " << ex << endl; dcrit << "(smemory): " << ex << endl;
} }
......
...@@ -97,7 +97,7 @@ int main(int argc, const char* argv[] ) ...@@ -97,7 +97,7 @@ int main(int argc, const char* argv[] )
{ {
cerr << "(tests): " << err << endl; cerr << "(tests): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests): " << ex << endl; cerr << "(tests): " << ex << endl;
} }
......
...@@ -224,7 +224,7 @@ int main( int argc, const char** argv ) ...@@ -224,7 +224,7 @@ int main( int argc, const char** argv )
on_sigchild(SIGTERM); on_sigchild(SIGTERM);
return 0; return 0;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(smemory-plus): " << ex << endl; dcrit << "(smemory-plus): " << ex << endl;
} }
......
...@@ -85,7 +85,7 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh ...@@ -85,7 +85,7 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh
int maxProcessingCount = conf->getArgPInt("--" + prefix + "-maxprocessingcount", it.getProp("maxProcessingCount"), 100); int maxProcessingCount = conf->getArgPInt("--" + prefix + "-maxprocessingcount", it.getProp("maxProcessingCount"), 100);
int checkConnectionPause = conf->getArgPInt("--" + prefix + "-checkconnection-pause", it.getProp("checkConnectionPause"), 10000); int checkConnectionPause = conf->getArgPInt("--" + prefix + "-checkconnection-pause", it.getProp("checkConnectionPause"), 10000);
std::string updateStrategy = conf->getArg2Param("--" + prefix + "-update-strategy", it.getProp("updateStartegy"),"evloop"); std::string updateStrategy = conf->getArg2Param("--" + prefix + "-update-strategy", it.getProp("updateStartegy"), "evloop");
no_sender = conf->getArgInt("--" + prefix + "-nosender", it.getProp("nosender")); no_sender = conf->getArgInt("--" + prefix + "-nosender", it.getProp("nosender"));
...@@ -312,11 +312,12 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh ...@@ -312,11 +312,12 @@ UNetExchange::UNetExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId sh
} }
} }
UNetReceiver::UpdateStrategy r_upStrategy = UNetReceiver::strToUpdateStrategy( n_it.getProp2("unet_update_strategy",updateStrategy) ); UNetReceiver::UpdateStrategy r_upStrategy = UNetReceiver::strToUpdateStrategy( n_it.getProp2("unet_update_strategy", updateStrategy) );
if( r_upStrategy == UNetReceiver::useUpdateUnknown ) if( r_upStrategy == UNetReceiver::useUpdateUnknown )
{ {
ostringstream err; ostringstream err;
err << myname << ": Unknown update strategy!!! '" << n_it.getProp2("unet_update_startegy",updateStrategy) << "'" << endl; err << myname << ": Unknown update strategy!!! '" << n_it.getProp2("unet_update_startegy", updateStrategy) << "'" << endl;
unetcrit << myname << "(init): " << err.str() << endl; unetcrit << myname << "(init): " << err.str() << endl;
throw SystemError(err.str()); throw SystemError(err.str());
} }
......
...@@ -126,7 +126,7 @@ void UNetReceiver::setUpdatePause( timeout_t msec ) noexcept ...@@ -126,7 +126,7 @@ void UNetReceiver::setUpdatePause( timeout_t msec ) noexcept
updatepause = msec; updatepause = msec;
if( upStrategy == useUpdateEventLoop && evUpdate.is_active() ) if( upStrategy == useUpdateEventLoop && evUpdate.is_active() )
evUpdate.start(0, (float)updatepause/1000.); evUpdate.start(0, (float)updatepause / 1000.);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::setMaxProcessingCount( int set ) noexcept void UNetReceiver::setMaxProcessingCount( int set ) noexcept
...@@ -178,6 +178,7 @@ bool UNetReceiver::createConnection( bool throwEx ) ...@@ -178,6 +178,7 @@ bool UNetReceiver::createConnection( bool throwEx )
udp = make_shared<UDPReceiveU>(addr, port); udp = make_shared<UDPReceiveU>(addr, port);
udp->setBlocking(false); // делаем неблокирующее чтение (нужно для libev) udp->setBlocking(false); // делаем неблокирующее чтение (нужно для libev)
evReceive.set<UNetReceiver, &UNetReceiver::callback>(this); evReceive.set<UNetReceiver, &UNetReceiver::callback>(this);
if( upStrategy == useUpdateEventLoop ) if( upStrategy == useUpdateEventLoop )
evUpdate.set<UNetReceiver, &UNetReceiver::updateEvent>(this); evUpdate.set<UNetReceiver, &UNetReceiver::updateEvent>(this);
...@@ -241,7 +242,7 @@ void UNetReceiver::evprepare( const ev::loop_ref& eloop ) noexcept ...@@ -241,7 +242,7 @@ void UNetReceiver::evprepare( const ev::loop_ref& eloop ) noexcept
{ {
evUpdate.set(eloop); evUpdate.set(eloop);
evUpdate.start(); evUpdate.start();
evUpdate.start( 0, ((float)updatepause/1000.) ); evUpdate.start( 0, ((float)updatepause / 1000.) );
} }
if( !udp ) if( !udp )
...@@ -282,7 +283,7 @@ void UNetReceiver::evfinish( const ev::loop_ref& eloop ) noexcept ...@@ -282,7 +283,7 @@ void UNetReceiver::evfinish( const ev::loop_ref& eloop ) noexcept
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::forceUpdate() noexcept void UNetReceiver::forceUpdate() noexcept
{ {
pack_guard l(packMutex,upStrategy); pack_guard l(packMutex, upStrategy);
pnum = 0; // сбрасываем запомненый номер последнего обработанного пакета pnum = 0; // сбрасываем запомненый номер последнего обработанного пакета
// и тем самым заставляем обновить данные в SM (см. update) // и тем самым заставляем обновить данные в SM (см. update)
} }
...@@ -298,10 +299,10 @@ void UNetReceiver::statisticsEvent(ev::periodic& tm, int revents) noexcept ...@@ -298,10 +299,10 @@ void UNetReceiver::statisticsEvent(ev::periodic& tm, int revents) noexcept
statRecvPerSec = recvCount; statRecvPerSec = recvCount;
statUpPerSec = upCount; statUpPerSec = upCount;
// unetlog9 << myname << "(statisctics):" // unetlog9 << myname << "(statisctics):"
// << " recvCount=" << recvCount << "[per sec]" // << " recvCount=" << recvCount << "[per sec]"
// << " upCount=" << upCount << "[per sec]" // << " upCount=" << upCount << "[per sec]"
// << endl; // << endl;
recvCount = 0; recvCount = 0;
upCount = 0; upCount = 0;
...@@ -321,7 +322,7 @@ void UNetReceiver::update() noexcept ...@@ -321,7 +322,7 @@ void UNetReceiver::update() noexcept
{ {
{ {
// lock qpack // lock qpack
pack_guard l(packMutex,upStrategy); pack_guard l(packMutex, upStrategy);
if( qpack.empty() ) if( qpack.empty() )
return; return;
...@@ -720,7 +721,7 @@ bool UNetReceiver::receive() noexcept ...@@ -720,7 +721,7 @@ bool UNetReceiver::receive() noexcept
{ {
// lock qpack // lock qpack
pack_guard l(packMutex,upStrategy); pack_guard l(packMutex, upStrategy);
if( !waitClean ) if( !waitClean )
{ {
...@@ -878,6 +879,7 @@ string UNetReceiver::to_string( UNetReceiver::UpdateStrategy s ) noexcept ...@@ -878,6 +879,7 @@ string UNetReceiver::to_string( UNetReceiver::UpdateStrategy s ) noexcept
{ {
if( s == useUpdateThread ) if( s == useUpdateThread )
return "thread"; return "thread";
if( s == useUpdateEventLoop ) if( s == useUpdateEventLoop )
return "evloop"; return "evloop";
......
...@@ -323,7 +323,7 @@ class UNetReceiver: ...@@ -323,7 +323,7 @@ class UNetReceiver:
struct CacheInfo struct CacheInfo
{ {
CacheInfo(): CacheInfo():
cache_init_ok(false){} cache_init_ok(false) {}
bool cache_init_ok = { false }; bool cache_init_ok = { false };
CacheVec cache; CacheVec cache;
......
...@@ -146,7 +146,7 @@ bool UNetSender::createConnection( bool throwEx ) ...@@ -146,7 +146,7 @@ bool UNetSender::createConnection( bool throwEx )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetSender::updateFromSM() void UNetSender::updateFromSM()
{ {
for( auto&& it: items ) for( auto && it : items )
{ {
UItem& i = it.second; UItem& i = it.second;
long value = shm->localGetValue(i.ioit, i.id); long value = shm->localGetValue(i.ioit, i.id);
...@@ -160,6 +160,7 @@ void UNetSender::updateSensor( UniSetTypes::ObjectId id, long value ) ...@@ -160,6 +160,7 @@ void UNetSender::updateSensor( UniSetTypes::ObjectId id, long value )
return; return;
auto it = items.find(id); auto it = items.find(id);
if( it != items.end() ) if( it != items.end() )
updateItem( it->second, value ); updateItem( it->second, value );
} }
...@@ -170,6 +171,7 @@ void UNetSender::updateItem( UItem& it, long value ) ...@@ -170,6 +171,7 @@ void UNetSender::updateItem( UItem& it, long value )
auto& mypack(pk[it.pack_num]); auto& mypack(pk[it.pack_num]);
UniSetTypes::uniset_rwmutex_wrlock l(mypack.mut); UniSetTypes::uniset_rwmutex_wrlock l(mypack.mut);
if( it.iotype == UniversalIO::DI || it.iotype == UniversalIO::DO ) if( it.iotype == UniversalIO::DI || it.iotype == UniversalIO::DO )
mypack.msg.setDData(it.pack_ind, value); mypack.msg.setDData(it.pack_ind, value);
else if( it.iotype == UniversalIO::AI || it.iotype == UniversalIO::AO ) else if( it.iotype == UniversalIO::AI || it.iotype == UniversalIO::AO )
...@@ -280,6 +282,7 @@ void UNetSender::real_send( PackMessage& mypack ) noexcept ...@@ -280,6 +282,7 @@ void UNetSender::real_send( PackMessage& mypack ) noexcept
mypack.msg.num = packetnum++; mypack.msg.num = packetnum++;
lastcrc = crc; lastcrc = crc;
} }
#endif #endif
// при переходе через ноль (когда счётчик перевалит через UniSetUDP::MaxPacketNum.. // при переходе через ноль (когда счётчик перевалит через UniSetUDP::MaxPacketNum..
...@@ -482,6 +485,7 @@ bool UNetSender::initItem( UniXML::iterator& it ) ...@@ -482,6 +485,7 @@ bool UNetSender::initItem( UniXML::iterator& it )
unetinfo << myname << "(initItem): add " << p << endl; unetinfo << myname << "(initItem): add " << p << endl;
auto i = items.find(p.id); auto i = items.find(p.id);
if( i != items.end() ) if( i != items.end() )
{ {
unetcrit << myname unetcrit << myname
...@@ -535,8 +539,9 @@ const std::string UNetSender::getShortInfo() const ...@@ -535,8 +539,9 @@ const std::string UNetSender::getShortInfo() const
for( auto i = mypacks.begin(); i != mypacks.end(); ++i ) for( auto i = mypacks.begin(); i != mypacks.end(); ++i )
{ {
s << " \t[" << i->first << "]=" << i->second.size() << endl; s << " \t[" << i->first << "]=" << i->second.size() << endl;
size_t n=0; size_t n = 0;
for( const auto& p: i->second )
for( const auto& p : i->second )
{ {
//uniset_rwmutex_rlock l(p->mut); //uniset_rwmutex_rlock l(p->mut);
s << " \t\t[" << (n++) << "]=" << p.msg.sizeOf() << " bytes" s << " \t\t[" << (n++) << "]=" << p.msg.sizeOf() << " bytes"
......
...@@ -91,7 +91,7 @@ class UNetSender ...@@ -91,7 +91,7 @@ class UNetSender
friend std::ostream& operator<<( std::ostream& os, UItem& p ); friend std::ostream& operator<<( std::ostream& os, UItem& p );
}; };
typedef std::unordered_map<UniSetTypes::ObjectId,UItem> UItemMap; typedef std::unordered_map<UniSetTypes::ObjectId, UItem> UItemMap;
size_t getDataPackCount() const; size_t getDataPackCount() const;
...@@ -102,7 +102,7 @@ class UNetSender ...@@ -102,7 +102,7 @@ class UNetSender
struct PackMessage struct PackMessage
{ {
PackMessage( UniSetUDP::UDPMessage&& m ) noexcept:msg(std::move(m)){} PackMessage( UniSetUDP::UDPMessage&& m ) noexcept: msg(std::move(m)) {}
PackMessage( const UniSetUDP::UDPMessage& m ) = delete; PackMessage( const UniSetUDP::UDPMessage& m ) = delete;
PackMessage() noexcept {} PackMessage() noexcept {}
......
...@@ -187,7 +187,7 @@ TEST_CASE("[UNetUDP]: sizeOf", "[unetudp][sizeof]") ...@@ -187,7 +187,7 @@ TEST_CASE("[UNetUDP]: sizeOf", "[unetudp][sizeof]")
m.addAData(8, 70); m.addAData(8, 70);
REQUIRE( m.sizeOf() == sizeof(UniSetUDP::UDPHeader)+sizeof(UniSetUDP::UDPAData) ); REQUIRE( m.sizeOf() == sizeof(UniSetUDP::UDPHeader) + sizeof(UniSetUDP::UDPAData) );
UniSetUDP::UDPPacket p; UniSetUDP::UDPPacket p;
size_t len = m.transport_msg(p); size_t len = m.transport_msg(p);
......
...@@ -69,7 +69,7 @@ int main(int argc, char* argv[] ) ...@@ -69,7 +69,7 @@ int main(int argc, char* argv[] )
{ {
cerr << "(tests_with_sm): " << err << endl; cerr << "(tests_with_sm): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_with_sm): " << ex << endl; cerr << "(tests_with_sm): " << ex << endl;
} }
......
...@@ -74,7 +74,7 @@ int main(int argc, const char* argv[] ) ...@@ -74,7 +74,7 @@ int main(int argc, const char* argv[] )
{ {
cerr << "(tests_with_sm): " << err << endl; cerr << "(tests_with_sm): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_with_sm): " << ex << endl; cerr << "(tests_with_sm): " << ex << endl;
} }
......
...@@ -187,7 +187,7 @@ int main(int argc, char* argv[] ) ...@@ -187,7 +187,7 @@ int main(int argc, char* argv[] )
{ {
cerr << "(urecv-perf-test): " << err << endl; cerr << "(urecv-perf-test): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(urecv-perf-test): " << ex << endl; cerr << "(urecv-perf-test): " << ex << endl;
} }
......
...@@ -312,8 +312,9 @@ int main(int argc, char* argv[]) ...@@ -312,8 +312,9 @@ int main(int argc, char* argv[])
if( !a_data.empty() ) if( !a_data.empty() )
{ {
auto vlist = UniSetTypes::getSInfoList(a_data,nullptr); auto vlist = UniSetTypes::getSInfoList(a_data, nullptr);
for( const auto& v: vlist )
for( const auto& v : vlist )
{ {
UDPAData d(v.si.id, v.val); UDPAData d(v.si.id, v.val);
mypack.addAData(d); mypack.addAData(d);
...@@ -330,9 +331,10 @@ int main(int argc, char* argv[]) ...@@ -330,9 +331,10 @@ int main(int argc, char* argv[])
if( !d_data.empty() ) if( !d_data.empty() )
{ {
auto vlist = UniSetTypes::getSInfoList(d_data,nullptr); auto vlist = UniSetTypes::getSInfoList(d_data, nullptr);
for( const auto& v: vlist )
mypack.addDData(v.si.id,v.val); for( const auto& v : vlist )
mypack.addDData(v.si.id, v.val);
} }
else else
{ {
......
...@@ -60,7 +60,7 @@ int main( int argc, const char** argv ) ...@@ -60,7 +60,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
on_sigchild(SIGTERM); on_sigchild(SIGTERM);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dcrit << "(unetexchange): " << ex << std::endl; dcrit << "(unetexchange): " << ex << std::endl;
} }
......
...@@ -184,7 +184,7 @@ void UniExchange::execute() ...@@ -184,7 +184,7 @@ void UniExchange::execute()
dinfo << myname << " update sensors from id=" << it.id << " node=" << it.node << endl; dinfo << myname << " update sensors from id=" << it.id << " node=" << it.node << endl;
it.update(sseq, shm); it.update(sseq, shm);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dwarn << myname << "(execute): " << ex << endl; dwarn << myname << "(execute): " << ex << endl;
} }
...@@ -258,7 +258,7 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, con ...@@ -258,7 +258,7 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, con
*/ */
shm->localSetValue( s->ioit, m->id, m->value, shm->ID() ); shm->localSetValue( s->ioit, m->id, m->value, shm->ID() );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dwarn << "(update): " << ex << endl; dwarn << "(update): " << ex << endl;
} }
...@@ -303,7 +303,7 @@ void UniExchange::updateLocalData() ...@@ -303,7 +303,7 @@ void UniExchange::updateLocalData()
uniset_rwmutex_wrlock lock(it.val_lock); uniset_rwmutex_wrlock lock(it.val_lock);
it.val = shm->localGetValue( it.ioit, it.id ); it.val = shm->localGetValue( it.ioit, it.id );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
dwarn << "(update): " << ex << endl; dwarn << "(update): " << ex << endl;
} }
......
...@@ -77,8 +77,8 @@ class Calibration ...@@ -77,8 +77,8 @@ class Calibration
{ {
public: public:
Calibration(); Calibration();
Calibration( const std::string& name, const std::string& confile = "calibration.xml", size_t reserv=50 ); Calibration( const std::string& name, const std::string& confile = "calibration.xml", size_t reserv = 50 );
Calibration( xmlNode* node, size_t reserv=50 ); Calibration( xmlNode* node, size_t reserv = 50 );
~Calibration(); ~Calibration();
/*! Тип для хранения значения */ /*! Тип для хранения значения */
......
...@@ -244,10 +244,11 @@ namespace MTR ...@@ -244,10 +244,11 @@ namespace MTR
// ------------------------------------------ // ------------------------------------------
// конструкторы на разные случаи... // конструкторы на разные случаи...
T4(): sval(""), raw(0) {} T4(): sval(""), raw(0) {}
T4( unsigned short v1 ): raw(v1) T4( uint16_t v1 ): raw(v1)
{ {
char c[3]; char c[sizeof(v1) + 1];
memcpy(c, &v1, sizeof(c)); memcpy(c, &v1, sizeof(v1));
c[sizeof(v1)] = '\0';
sval = std::string(c); sval = std::string(c);
} }
...@@ -255,7 +256,8 @@ namespace MTR ...@@ -255,7 +256,8 @@ namespace MTR
raw(data[0]) raw(data[0])
{ {
char c[3]; char c[3];
memcpy(c, &(data[0]), sizeof(c)); memcpy(c, &(data[0]), 2);
c[2] = '\0';
sval = std::string(c); sval = std::string(c);
} }
......
...@@ -29,7 +29,7 @@ class UObject_SK: ...@@ -29,7 +29,7 @@ class UObject_SK:
public UniSetObject public UniSetObject
{ {
public: public:
UObject_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::uniset_conf()->getNode("UObject"), const std::string& argprefix="" ); UObject_SK( UniSetTypes::ObjectId id, xmlNode* node = UniSetTypes::uniset_conf()->getNode("UObject"), const std::string& argprefix = "" );
UObject_SK(); UObject_SK();
virtual ~UObject_SK(); virtual ~UObject_SK();
...@@ -43,54 +43,60 @@ class UObject_SK: ...@@ -43,54 +43,60 @@ class UObject_SK:
virtual bool setMsg( UniSetTypes::ObjectId code, bool state = true ) noexcept; virtual bool setMsg( UniSetTypes::ObjectId code, bool state = true ) noexcept;
inline std::shared_ptr<DebugStream> log() noexcept { return mylog; } inline std::shared_ptr<DebugStream> log() noexcept
inline std::shared_ptr<LogAgregator> logAgregator() noexcept { return loga; } {
return mylog;
}
inline std::shared_ptr<LogAgregator> logAgregator() noexcept
{
return loga;
}
void init_dlog( std::shared_ptr<DebugStream> d ) noexcept; void init_dlog( std::shared_ptr<DebugStream> d ) noexcept;
// "синтаксический сахар"..для логов // "синтаксический сахар"..для логов
#ifndef myinfo #ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info() #define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif #endif
#ifndef mywarn #ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn() #define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif #endif
#ifndef mycrit #ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit() #define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif #endif
#ifndef mylog1 #ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1() #define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif #endif
#ifndef mylog2 #ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2() #define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif #endif
#ifndef mylog3 #ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3() #define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif #endif
#ifndef mylog4 #ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4() #define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif #endif
#ifndef mylog5 #ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5() #define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif #endif
#ifndef mylog6 #ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6() #define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif #endif
#ifndef mylog7 #ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7() #define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif #endif
#ifndef mylog8 #ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8() #define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif #endif
#ifndef mylog9 #ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9() #define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif #endif
#ifndef mylogany #ifndef mylogany
#define mylogany log()->any() #define mylogany log()->any()
#endif #endif
#ifndef vmonit #ifndef vmonit
#define vmonit( var ) vmon.add( #var, var ) #define vmonit( var ) vmon.add( #var, var )
#endif #endif
// Вспомогательные функции для удобства логирования // Вспомогательные функции для удобства логирования
// ------------------------------------------------------------ // ------------------------------------------------------------
...@@ -107,16 +113,19 @@ class UObject_SK: ...@@ -107,16 +113,19 @@ class UObject_SK:
\param id - идентификатор датчика \param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить \param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/ */
std::string str( UniSetTypes::ObjectId id, bool showLinkName=true ) const; std::string str( UniSetTypes::ObjectId id, bool showLinkName = true ) const;
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val /*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика \param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить \param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/ */
std::string strval( UniSetTypes::ObjectId id, bool showLinkName=true ) const; std::string strval( UniSetTypes::ObjectId id, bool showLinkName = true ) const;
/*! Вывод состояния внутренних переменных */ /*! Вывод состояния внутренних переменных */
inline std::string dumpVars(){ return std::move(vmon.pretty_str()); } inline std::string dumpVars()
{
return std::move(vmon.pretty_str());
}
// ------------------------------------------------------------ // ------------------------------------------------------------
std::string help() noexcept; std::string help() noexcept;
...@@ -145,16 +154,19 @@ class UObject_SK: ...@@ -145,16 +154,19 @@ class UObject_SK:
virtual void callback() noexcept override; virtual void callback() noexcept override;
virtual void processingMessage( const UniSetTypes::VoidMessage* msg ) override; virtual void processingMessage( const UniSetTypes::VoidMessage* msg ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ){}; virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) {};
virtual void askSensors( UniversalIO::UIOCommand cmd ){} virtual void askSensors( UniversalIO::UIOCommand cmd ) {}
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override{} virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override {}
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override{} virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override {}
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
virtual bool activateObject() override; virtual bool activateObject() override;
virtual std::string getMonitInfo(){ return ""; } /*!< пользовательская информация выводимая в getInfo() */ virtual std::string getMonitInfo()
{
return ""; /*!< пользовательская информация выводимая в getInfo() */
}
// Выполнение очередного шага программы // Выполнение очередного шага программы
virtual void step(){} virtual void step() {}
void preAskSensors( UniversalIO::UIOCommand cmd ); void preAskSensors( UniversalIO::UIOCommand cmd );
void preSysCommand( const UniSetTypes::SystemMessage* sm ); void preSysCommand( const UniSetTypes::SystemMessage* sm );
...@@ -183,9 +195,15 @@ class UObject_SK: ...@@ -183,9 +195,15 @@ class UObject_SK:
xmlNode* confnode; xmlNode* confnode;
/*! получить числовое свойство из конф. файла по привязанной confnode */ /*! получить числовое свойство из конф. файла по привязанной confnode */
int getIntProp(const std::string& name) { return UniSetTypes::uniset_conf()->getIntProp(confnode, name); } int getIntProp(const std::string& name)
{
return UniSetTypes::uniset_conf()->getIntProp(confnode, name);
}
/*! получить текстовое свойство из конф. файла по привязанной confnode */ /*! получить текстовое свойство из конф. файла по привязанной confnode */
inline const std::string getProp(const std::string& name) { return UniSetTypes::uniset_conf()->getProp(confnode, name); } inline const std::string getProp(const std::string& name)
{
return UniSetTypes::uniset_conf()->getProp(confnode, name);
}
timeout_t smReadyTimeout; /*!< время ожидания готовности SM */ timeout_t smReadyTimeout; /*!< время ожидания готовности SM */
std::atomic_bool activated; std::atomic_bool activated;
......
...@@ -114,7 +114,10 @@ namespace VTypes ...@@ -114,7 +114,10 @@ namespace VTypes
// ------------------------------------------ // ------------------------------------------
// конструкторы на разные случаи... // конструкторы на разные случаи...
F2r() noexcept { raw_backorder.val = 0; } F2r() noexcept
{
raw_backorder.val = 0;
}
F2r( const float& f ) noexcept: F2(f) F2r( const float& f ) noexcept: F2(f)
{ {
...@@ -383,7 +386,10 @@ namespace VTypes ...@@ -383,7 +386,10 @@ namespace VTypes
public I2 public I2
{ {
public: public:
I2r() noexcept { raw_backorder.val = 0; } I2r() noexcept
{
raw_backorder.val = 0;
}
I2r( const int v ) noexcept: I2(v) I2r( const int v ) noexcept: I2(v)
{ {
...@@ -457,7 +463,10 @@ namespace VTypes ...@@ -457,7 +463,10 @@ namespace VTypes
public U2 public U2
{ {
public: public:
U2r() noexcept { raw_backorder.val = 0; } U2r() noexcept
{
raw_backorder.val = 0;
}
U2r( int v ) noexcept: U2(v) U2r( int v ) noexcept: U2(v)
{ {
......
...@@ -41,7 +41,7 @@ Calibration::Part::Part( const Point& pleft, const Point& pright ) noexcept: ...@@ -41,7 +41,7 @@ Calibration::Part::Part( const Point& pleft, const Point& pright ) noexcept:
k(0) k(0)
{ {
if( p_right.x < p_left.x ) if( p_right.x < p_left.x )
std::swap(p_right,p_left); std::swap(p_right, p_left);
// вычисление коэффициента наклона (один раз в конструкторе) // вычисление коэффициента наклона (один раз в конструкторе)
// k = (y2-y1)/(x2-x1) // k = (y2-y1)/(x2-x1)
......
...@@ -32,28 +32,28 @@ using namespace UniSetTypes; ...@@ -32,28 +32,28 @@ using namespace UniSetTypes;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UObject_SK::UObject_SK(): UObject_SK::UObject_SK():
// Инициализация идентификаторов (имена берутся из конф. файла) // Инициализация идентификаторов (имена берутся из конф. файла)
// Используемые идентификаторы сообщений (имена берутся из конф. файла) // Используемые идентификаторы сообщений (имена берутся из конф. файла)
// variables (public and proteced) // variables (public and proteced)
// ------------------ // ------------------
active(false), active(false),
idHeartBeat(DefaultObjectId), idHeartBeat(DefaultObjectId),
maxHeartBeat(10), maxHeartBeat(10),
confnode(0), confnode(0),
smReadyTimeout(0), smReadyTimeout(0),
activated(false), activated(false),
askPause(2000), askPause(2000),
forceOut(false), forceOut(false),
// private variables // private variables
end_private(false) end_private(false)
{ {
mycrit << "UObject: init failed!!!!!!!!!!!!!!!" << endl; mycrit << "UObject: init failed!!!!!!!!!!!!!!!" << endl;
throw Exception( string(myname+": init failed!!!") ); throw Exception( string(myname + ": init failed!!!") );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ( val, confval, default val ) // ( val, confval, default val )
...@@ -61,6 +61,7 @@ static const std::string init3_str( const std::string& s1, const std::string& s2 ...@@ -61,6 +61,7 @@ static const std::string init3_str( const std::string& s1, const std::string& s2
{ {
if( !s1.empty() ) if( !s1.empty() )
return s1; return s1;
if( !s2.empty() ) if( !s2.empty() )
return s2; return s2;
...@@ -74,41 +75,41 @@ static UniSetTypes::ObjectId init_node( xmlNode* cnode, const std::string& prop ...@@ -74,41 +75,41 @@ static UniSetTypes::ObjectId init_node( xmlNode* cnode, const std::string& prop
auto conf = uniset_conf(); auto conf = uniset_conf();
if( conf->getProp(cnode,prop).empty() ) if( conf->getProp(cnode, prop).empty() )
return conf->getLocalNode(); return conf->getLocalNode();
return conf->getNodeID(conf->getProp(cnode,prop)); return conf->getNodeID(conf->getProp(cnode, prop));
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UObject_SK::UObject_SK( ObjectId id, xmlNode* cnode, const std::string& _argprefix ): UObject_SK::UObject_SK( ObjectId id, xmlNode* cnode, const std::string& _argprefix ):
UniSetObject(id), UniSetObject(id),
// Инициализация идентификаторов (имена берутся из конф. файла) // Инициализация идентификаторов (имена берутся из конф. файла)
// Используемые идентификаторы сообщений (имена берутся из конф. файла) // Используемые идентификаторы сообщений (имена берутся из конф. файла)
// variables // variables
sleep_msec(150), sleep_msec(150),
active(true), active(true),
argprefix( (_argprefix.empty() ? myname+"-" : _argprefix) ), argprefix( (_argprefix.empty() ? myname + "-" : _argprefix) ),
idHeartBeat(DefaultObjectId), idHeartBeat(DefaultObjectId),
maxHeartBeat(10), maxHeartBeat(10),
confnode(cnode), confnode(cnode),
smReadyTimeout(0), smReadyTimeout(0),
activated(false), activated(false),
askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)), askPause(uniset_conf()->getPIntProp(cnode, "askPause", 2000)),
forceOut(false), forceOut(false),
end_private(false) end_private(false)
{ {
auto conf = uniset_conf(); auto conf = uniset_conf();
if( UniSetTypes::findArgParam("--print-id-list",uniset_conf()->getArgc(),uniset_conf()->getArgv()) != -1 ) if( UniSetTypes::findArgParam("--print-id-list", uniset_conf()->getArgc(), uniset_conf()->getArgv()) != -1 )
{ {
// abort(); // abort();
} }
...@@ -124,10 +125,10 @@ end_private(false) ...@@ -124,10 +125,10 @@ end_private(false)
{ {
ostringstream s; ostringstream s;
s << argprefix << "log"; s << argprefix << "log";
conf->initLogStream(mylog,s.str()); conf->initLogStream(mylog, s.str());
} }
loga = make_shared<LogAgregator>(myname+"-loga"); loga = make_shared<LogAgregator>(myname + "-loga");
loga->add(mylog); loga->add(mylog);
loga->add(ulog()); loga->add(ulog());
...@@ -145,12 +146,14 @@ end_private(false) ...@@ -145,12 +146,14 @@ end_private(false)
logserv_port = conf->getArgPInt("--" + argprefix + "logserver-port", it.getProp("logserverPort"), getId()); logserv_port = conf->getArgPInt("--" + argprefix + "logserver-port", it.getProp("logserverPort"), getId());
} }
forceOut = conf->getArgPInt("--" + argprefix + "force-out",it.getProp("forceOut"),false); forceOut = conf->getArgPInt("--" + argprefix + "force-out", it.getProp("forceOut"), false);
string heart = conf->getArgParam("--" + argprefix + "heartbeat-id", it.getProp("heartbeat_id"));
string heart = conf->getArgParam("--" + argprefix + "heartbeat-id",it.getProp("heartbeat_id"));
if( !heart.empty() ) if( !heart.empty() )
{ {
idHeartBeat = conf->getSensorID(heart); idHeartBeat = conf->getSensorID(heart);
if( idHeartBeat == DefaultObjectId ) if( idHeartBeat == DefaultObjectId )
{ {
ostringstream err; ostringstream err;
...@@ -158,13 +161,14 @@ end_private(false) ...@@ -158,13 +161,14 @@ end_private(false)
throw SystemError(err.str()); throw SystemError(err.str());
} }
int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf->getHeartBeatTime()); int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time", it.getProp("heartbeatTime"), conf->getHeartBeatTime());
if( heartbeatTime>0 )
if( heartbeatTime > 0 )
ptHeartBeat.setTiming(heartbeatTime); ptHeartBeat.setTiming(heartbeatTime);
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--" + argprefix + "heartbeat-max",it.getProp("heartbeat_max"), 10); maxHeartBeat = conf->getArgPInt("--" + argprefix + "heartbeat-max", it.getProp("heartbeat_max"), 10);
} }
// Инициализация значений // Инициализация значений
...@@ -173,16 +177,18 @@ end_private(false) ...@@ -173,16 +177,18 @@ end_private(false)
si.id = UniSetTypes::DefaultObjectId; si.id = UniSetTypes::DefaultObjectId;
si.node = conf->getLocalNode(); si.node = conf->getLocalNode();
sleep_msec = conf->getArgPInt("--" + argprefix + "sleep-msec","150", 150); sleep_msec = conf->getArgPInt("--" + argprefix + "sleep-msec", "150", 150);
string s_resetTime(""); string s_resetTime("");
if( s_resetTime.empty() ) if( s_resetTime.empty() )
s_resetTime = "500"; s_resetTime = "500";
resetMsgTime = uni_atoi(init3_str(conf->getArgParam("--" + argprefix + "resetMsgTime"),conf->getProp(cnode,"resetMsgTime"),s_resetTime)); resetMsgTime = uni_atoi(init3_str(conf->getArgParam("--" + argprefix + "resetMsgTime"), conf->getProp(cnode, "resetMsgTime"), s_resetTime));
ptResetMsg.setTiming(resetMsgTime); ptResetMsg.setTiming(resetMsgTime);
int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout",""); int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout", "");
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 60000; smReadyTimeout = 60000;
else if( sm_tout < 0 ) else if( sm_tout < 0 )
...@@ -190,7 +196,7 @@ end_private(false) ...@@ -190,7 +196,7 @@ end_private(false)
else else
smReadyTimeout = sm_tout; smReadyTimeout = sm_tout;
smTestID = conf->getSensorID(init3_str(conf->getArgParam("--" + argprefix + "sm-test-id"),conf->getProp(cnode,"smTestID"),"")); smTestID = conf->getSensorID(init3_str(conf->getArgParam("--" + argprefix + "sm-test-id"), conf->getProp(cnode, "smTestID"), ""));
if( smTestID == DefaultObjectId ) if( smTestID == DefaultObjectId )
...@@ -216,7 +222,7 @@ end_private(false) ...@@ -216,7 +222,7 @@ end_private(false)
// help надо выводить в конце, когда уже все переменные инициализированы по умолчанию // help надо выводить в конце, когда уже все переменные инициализированы по умолчанию
if( UniSetTypes::findArgParam("--" + argprefix + "help",uniset_conf()->getArgc(),uniset_conf()->getArgv()) != -1 ) if( UniSetTypes::findArgParam("--" + argprefix + "help", uniset_conf()->getArgc(), uniset_conf()->getArgv()) != -1 )
cout << help() << endl; cout << help() << endl;
} }
...@@ -268,7 +274,7 @@ bool UObject_SK::setMsg( UniSetTypes::ObjectId _code, bool _state ) noexcept ...@@ -268,7 +274,7 @@ bool UObject_SK::setMsg( UniSetTypes::ObjectId _code, bool _state ) noexcept
void UObject_SK::resetMsg() void UObject_SK::resetMsg()
{ {
mylog8 << myname << "(resetMsg): reset messages.." << endl; mylog8 << myname << "(resetMsg): reset messages.." << endl;
// reset messages // reset messages
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -306,19 +312,23 @@ std::string UObject_SK::dumpIO() ...@@ -306,19 +312,23 @@ std::string UObject_SK::dumpIO()
s << endl; s << endl;
int n = 0; int n = 0;
for( const auto& e: v_in )
for( const auto& e : v_in )
{ {
s << e; s << e;
if( (n++)%2 )
if( (n++) % 2 )
s << std::endl; s << std::endl;
} }
s << endl; s << endl;
n = 0; n = 0;
for( const auto& e: v_out )
for( const auto& e : v_out )
{ {
s << e; s << e;
if( (n++)%2 )
if( (n++) % 2 )
s << std::endl; s << std::endl;
} }
...@@ -382,11 +392,13 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm ) ...@@ -382,11 +392,13 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm )
{ {
case SystemMessage::WatchDog: case SystemMessage::WatchDog:
myinfo << myname << "(preSysCommand): WatchDog" << endl; myinfo << myname << "(preSysCommand): WatchDog" << endl;
if( !active || !ptStartUpTimeout.checkTime() ) if( !active || !ptStartUpTimeout.checkTime() )
{ {
mywarn << myname << "(preSysCommand): игнорируем WatchDog, потому-что только-что стартанули" << endl; mywarn << myname << "(preSysCommand): игнорируем WatchDog, потому-что только-что стартанули" << endl;
break; break;
} }
case SystemMessage::StartUp: case SystemMessage::StartUp:
{ {
if( !logserv_host.empty() && logserv_port != 0 && !logserv->isRunning() ) if( !logserv_host.empty() && logserv_port != 0 && !logserv->isRunning() )
...@@ -419,9 +431,10 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm ) ...@@ -419,9 +431,10 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm )
// переоткрываем логи // переоткрываем логи
mylogany << myname << "(preSysCommand): logRotate" << endl; mylogany << myname << "(preSysCommand): logRotate" << endl;
string fname( log()->getLogFile() ); string fname( log()->getLogFile() );
if( !fname.empty() ) if( !fname.empty() )
{ {
mylog->logFile(fname.c_str(),true); mylog->logFile(fname.c_str(), true);
mylogany << myname << "(preSysCommand): ***************** mylog LOG ROTATE *****************" << endl; mylogany << myname << "(preSysCommand): ***************** mylog LOG ROTATE *****************" << endl;
} }
...@@ -445,6 +458,7 @@ UniSetTypes::SimpleInfo* UObject_SK::getInfo( CORBA::Long userparam ) ...@@ -445,6 +458,7 @@ UniSetTypes::SimpleInfo* UObject_SK::getInfo( CORBA::Long userparam )
ostringstream inf; ostringstream inf;
inf << i->info << endl; inf << i->info << endl;
if( logserv /* && userparam < 0 */ ) if( logserv /* && userparam < 0 */ )
{ {
inf << "LogServer: " << logserv_host << ":" << logserv_port inf << "LogServer: " << logserv_host << ":" << logserv_port
...@@ -459,14 +473,16 @@ UniSetTypes::SimpleInfo* UObject_SK::getInfo( CORBA::Long userparam ) ...@@ -459,14 +473,16 @@ UniSetTypes::SimpleInfo* UObject_SK::getInfo( CORBA::Long userparam )
inf << endl; inf << endl;
auto timers = getTimersList(); auto timers = getTimersList();
inf << "Timers[" << timers.size() << "]:" << endl; inf << "Timers[" << timers.size() << "]:" << endl;
for( const auto& t: timers )
for( const auto& t : timers )
{ {
inf << " " << setw(15) << getTimerName(t.id) << "[" << t.id << "]: msec=" inf << " " << setw(15) << getTimerName(t.id) << "[" << t.id << "]: msec="
<< setw(6) << t.tmr.getInterval() << setw(6) << t.tmr.getInterval()
<< " timeleft=" << setw(6) << t.curTimeMS << " timeleft=" << setw(6) << t.curTimeMS
<< " tick=" << setw(3) << ( t.curTick>=0 ? t.curTick : -1 ) << " tick=" << setw(3) << ( t.curTick >= 0 ? t.curTick : -1 )
<< endl; << endl;
} }
inf << endl; inf << endl;
inf << vmon.pretty_str() << endl; inf << vmon.pretty_str() << endl;
inf << endl; inf << endl;
...@@ -520,7 +536,7 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID ) ...@@ -520,7 +536,7 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
<< " testID=" << _testID << endl; << " testID=" << _testID << endl;
// waitReady можно использовать т.к. датчик это по сути IONotifyController // waitReady можно использовать т.к. датчик это по сути IONotifyController
if( !ui->waitReady(_testID,wait_msec) ) if( !ui->waitReady(_testID, wait_msec) )
{ {
ostringstream err; ostringstream err;
err << myname err << myname
...@@ -528,14 +544,14 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID ) ...@@ -528,14 +544,14 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
<< wait_msec << " мсек"; << wait_msec << " мсек";
mycrit << err.str() << endl; mycrit << err.str() << endl;
// terminate(); // terminate();
// abort(); // abort();
raise(SIGTERM); raise(SIGTERM);
terminate(); terminate();
// throw SystemError(err.str()); // throw SystemError(err.str());
} }
if( !ui->waitWorking(_testID,wait_msec) ) if( !ui->waitWorking(_testID, wait_msec) )
{ {
ostringstream err; ostringstream err;
err << myname err << myname
...@@ -543,10 +559,10 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID ) ...@@ -543,10 +559,10 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
<< wait_msec << " мсек"; << wait_msec << " мсек";
mycrit << err.str() << endl; mycrit << err.str() << endl;
// terminate(); // terminate();
// abort(); // abort();
raise(SIGTERM); raise(SIGTERM);
// throw SystemError(err.str()); // throw SystemError(err.str());
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -582,39 +598,42 @@ void UObject_SK::callback() noexcept ...@@ -582,39 +598,42 @@ void UObject_SK::callback() noexcept
{ {
if( !active ) if( !active )
return; return;
try try
{ {
// проверка таймеров // проверка таймеров
checkTimers(this); checkTimers(this);
if( resetMsgTime>0 && trResetMsg.hi(ptResetMsg.checkTime()) ) if( resetMsgTime > 0 && trResetMsg.hi(ptResetMsg.checkTime()) )
{ {
// cout << myname << ": ********* reset messages *********" << endl; // cout << myname << ": ********* reset messages *********" << endl;
resetMsg(); resetMsg();
} }
// обработка сообщений (таймеров и т.п.) // обработка сообщений (таймеров и т.п.)
for( unsigned int i=0; i<20; i++ ) for( unsigned int i = 0; i < 20; i++ )
{ {
auto m = receiveMessage(); auto m = receiveMessage();
if( !m ) if( !m )
break; break;
processingMessage(m.get()); processingMessage(m.get());
updateOutputs(forceOut); updateOutputs(forceOut);
// updatePreviousValues(); // updatePreviousValues();
} }
// Выполнение шага программы // Выполнение шага программы
step(); step();
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() ) if( idHeartBeat != DefaultObjectId && ptHeartBeat.checkTime() )
{ {
try try
{ {
ui->setValue(idHeartBeat,maxHeartBeat); ui->setValue(idHeartBeat, maxHeartBeat);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const Exception& ex ) catch( const Exception& ex )
...@@ -636,7 +655,7 @@ void UObject_SK::callback() noexcept ...@@ -636,7 +655,7 @@ void UObject_SK::callback() noexcept
mycrit << myname << "(execute): СORBA::SystemException: " mycrit << myname << "(execute): СORBA::SystemException: "
<< ex.NP_minorString() << endl; << ex.NP_minorString() << endl;
} }
catch( const std::exception&ex ) catch( const std::exception& ex )
{ {
mycrit << myname << "(execute): catch " << ex.what() << endl; mycrit << myname << "(execute): catch " << ex.what() << endl;
} }
...@@ -654,7 +673,7 @@ void UObject_SK::setValue( UniSetTypes::ObjectId _sid, long _val ) ...@@ -654,7 +673,7 @@ void UObject_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
ui->setValue(_sid,_val); ui->setValue(_sid, _val);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UObject_SK::updateOutputs( bool _force ) void UObject_SK::updateOutputs( bool _force )
...@@ -676,7 +695,7 @@ void UObject_SK::initFromSM() ...@@ -676,7 +695,7 @@ void UObject_SK::initFromSM()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UObject_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node ) void UObject_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{ {
ui->askRemoteSensor(_sid,_cmd,_node,getId()); ui->askRemoteSensor(_sid, _cmd, _node, getId());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
long UObject_SK::getValue( UniSetTypes::ObjectId _sid ) long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
...@@ -687,7 +706,7 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid ) ...@@ -687,7 +706,7 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
return ui->getValue(_sid); return ui->getValue(_sid);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mycrit << myname << "(getValue): " << ex << endl; mycrit << myname << "(getValue): " << ex << endl;
throw; throw;
...@@ -698,10 +717,12 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid ) ...@@ -698,10 +717,12 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
void UObject_SK::preAskSensors( UniversalIO::UIOCommand _cmd ) void UObject_SK::preAskSensors( UniversalIO::UIOCommand _cmd )
{ {
PassiveTimer ptAct(activateTimeout); PassiveTimer ptAct(activateTimeout);
while( !activated && !ptAct.checkTime() ) while( !activated && !ptAct.checkTime() )
{ {
cout << myname << "(preAskSensors): wait activate..." << endl; cout << myname << "(preAskSensors): wait activate..." << endl;
msleep(300); msleep(300);
if( activated ) if( activated )
break; break;
} }
...@@ -717,11 +738,11 @@ void UObject_SK::preAskSensors( UniversalIO::UIOCommand _cmd ) ...@@ -717,11 +738,11 @@ void UObject_SK::preAskSensors( UniversalIO::UIOCommand _cmd )
return; return;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mycrit << myname << "(preAskSensors): " << ex << endl; mycrit << myname << "(preAskSensors): " << ex << endl;
} }
catch( const std::exception&ex ) catch( const std::exception& ex )
{ {
mycrit << myname << "(execute): catch " << ex.what() << endl; mycrit << myname << "(execute): catch " << ex.what() << endl;
} }
......
...@@ -200,7 +200,7 @@ void TestProc::test_thresholds() ...@@ -200,7 +200,7 @@ void TestProc::test_thresholds()
ti = ui->getThresholdInfo(t_set_c, tid); ti = ui->getThresholdInfo(t_set_c, tid);
cerr << myname << ": ask ON threshold: " << ( ti.state == IONotifyController_i::HiThreshold ? "ok" : "FAIL" ) << endl; cerr << myname << ": ask ON threshold: " << ( ti.state == IONotifyController_i::HiThreshold ? "ok" : "FAIL" ) << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mylog2 << myname << ": CHECK 'ask and get threshold' FAILED: " << ex << endl; mylog2 << myname << ": CHECK 'ask and get threshold' FAILED: " << ex << endl;
} }
......
...@@ -36,8 +36,8 @@ class TestProc: ...@@ -36,8 +36,8 @@ class TestProc:
void test_loglevel(); void test_loglevel();
private: private:
bool state; bool state = { false };
bool undef; bool undef = { false };
std::vector<Debug::type> loglevels; std::vector<Debug::type> loglevels;
std::vector<Debug::type>::iterator lit; std::vector<Debug::type>::iterator lit;
......
...@@ -50,11 +50,11 @@ int main(int argc, const char** argv) ...@@ -50,11 +50,11 @@ int main(int argc, const char** argv)
return 0; return 0;
} }
catch( const SystemError& err ) catch( const UniSetTypes::SystemError& err )
{ {
ucrit << "(smemory): " << err << endl; ucrit << "(smemory): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << "(smemory): " << ex << endl; ucrit << "(smemory): " << ex << endl;
} }
......
...@@ -49,11 +49,11 @@ int main(int argc, const char** argv) ...@@ -49,11 +49,11 @@ int main(int argc, const char** argv)
return 0; return 0;
} }
catch( const SystemError& err ) catch( const UniSetTypes::SystemError& err )
{ {
cerr << "(mq-test): " << err << endl; cerr << "(mq-test): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(mq-test): " << ex << endl; cerr << "(mq-test): " << ex << endl;
} }
......
...@@ -53,8 +53,8 @@ void TestProc::sysCommand( const UniSetTypes::SystemMessage* sm ) ...@@ -53,8 +53,8 @@ void TestProc::sysCommand( const UniSetTypes::SystemMessage* sm )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
string TestProc::getMonitInfo() string TestProc::getMonitInfo()
{ {
// int* p = 0; // int* p = 0;
// (*p) = 10; // (*p) = 10;
return ""; return "";
} }
...@@ -176,7 +176,7 @@ void TestProc::test_thresholds() ...@@ -176,7 +176,7 @@ void TestProc::test_thresholds()
ti = ui->getThresholdInfo(t_set_c, tid); ti = ui->getThresholdInfo(t_set_c, tid);
cerr << myname << ": ask ON threshold: " << ( ti.state == IONotifyController_i::HiThreshold ? "ok" : "FAIL" ) << endl; cerr << myname << ": ask ON threshold: " << ( ti.state == IONotifyController_i::HiThreshold ? "ok" : "FAIL" ) << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
mylog2 << myname << ": CHECK 'ask and get threshold' FAILED: " << ex << endl; mylog2 << myname << ": CHECK 'ask and get threshold' FAILED: " << ex << endl;
} }
......
...@@ -54,7 +54,7 @@ int main(int argc, const char** argv) ...@@ -54,7 +54,7 @@ int main(int argc, const char** argv)
{ {
ucrit << "(smemory): " << err << endl; ucrit << "(smemory): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << "(smemory): " << ex << endl; ucrit << "(smemory): " << ex << endl;
} }
......
...@@ -117,11 +117,11 @@ int main(int argc, char* argv[] ) ...@@ -117,11 +117,11 @@ int main(int argc, char* argv[] )
std::cerr << "elapsed time: " << elapsed_seconds << " ms\n"; std::cerr << "elapsed time: " << elapsed_seconds << " ms\n";
return 0; return 0;
} }
catch( const SystemError& err ) catch( const UniSetTypes::SystemError& err )
{ {
cerr << "(tests_with_sm): " << err << endl; cerr << "(tests_with_sm): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_with_sm): " << ex << endl; cerr << "(tests_with_sm): " << ex << endl;
} }
......
...@@ -92,11 +92,11 @@ int main(int argc, const char* argv[] ) ...@@ -92,11 +92,11 @@ int main(int argc, const char* argv[] )
return session.run(); return session.run();
} }
catch( const SystemError& err ) catch( const UniSetTypes::SystemError& err )
{ {
cerr << "(tests_with_sm): " << err << endl; cerr << "(tests_with_sm): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(tests_with_sm): " << ex << endl; cerr << "(tests_with_sm): " << ex << endl;
} }
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
class DelayTimer class DelayTimer
{ {
public: public:
DelayTimer(){} DelayTimer() {}
DelayTimer( timeout_t on_msec, timeout_t off_msec ) noexcept: DelayTimer( timeout_t on_msec, timeout_t off_msec ) noexcept:
onDelay(on_msec), offDelay(off_msec){} onDelay(on_msec), offDelay(off_msec) {}
~DelayTimer() noexcept {} ~DelayTimer() noexcept {}
......
...@@ -260,7 +260,7 @@ class IOController: ...@@ -260,7 +260,7 @@ class IOController:
USensorInfo( USensorInfo&& ) = default; USensorInfo( USensorInfo&& ) = default;
USensorInfo& operator=(USensorInfo&& ) = default; USensorInfo& operator=(USensorInfo&& ) = default;
USensorInfo(): d_value(0), d_off_value(0) USensorInfo(): d_value(1), d_off_value(0)
{ {
d_si.id = UniSetTypes::DefaultObjectId; d_si.id = UniSetTypes::DefaultObjectId;
d_si.node = UniSetTypes::DefaultObjectId; d_si.node = UniSetTypes::DefaultObjectId;
...@@ -298,8 +298,8 @@ class IOController: ...@@ -298,8 +298,8 @@ class IOController:
ChangeUndefinedStateSignal sigUndefChange; ChangeUndefinedStateSignal sigUndefChange;
IOController_i::SensorInfo d_si; /*!< идентификатор датчика, от которого зависит данный */ IOController_i::SensorInfo d_si; /*!< идентификатор датчика, от которого зависит данный */
long d_value; /*!< разрешающее работу значение датчика от которого зависит данный */ long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */
long d_off_value; /*!< блокирующее значение */ long d_off_value = { 0 }; /*!< блокирующее значение */
std::shared_ptr<USensorInfo> d_usi; // shared_ptr на датчик от которого зависит этот. std::shared_ptr<USensorInfo> d_usi; // shared_ptr на датчик от которого зависит этот.
// функция обработки информации об изменении состояния датчика, от которого зависит данный // функция обработки информации об изменении состояния датчика, от которого зависит данный
......
...@@ -139,8 +139,8 @@ class LT_Object ...@@ -139,8 +139,8 @@ class LT_Object
/*! Информация о таймере */ /*! Информация о таймере */
struct TimerInfo struct TimerInfo
{ {
TimerInfo(): id(0), curTimeMS(0), priority(UniSetTypes::Message::High) {}; TimerInfo() {};
TimerInfo(UniSetTypes::TimerId id, timeout_t timeMS, clock_t cnt, UniSetTypes::Message::Priority p): TimerInfo( UniSetTypes::TimerId id, timeout_t timeMS, clock_t cnt, UniSetTypes::Message::Priority p ):
id(id), id(id),
curTimeMS(timeMS), curTimeMS(timeMS),
priority(p), priority(p),
...@@ -155,15 +155,15 @@ class LT_Object ...@@ -155,15 +155,15 @@ class LT_Object
tmr.reset(); tmr.reset();
} }
UniSetTypes::TimerId id; /*!< идентификатор таймера */ UniSetTypes::TimerId id = { 0 }; /*!< идентификатор таймера */
timeout_t curTimeMS; /*!< остаток времени */ timeout_t curTimeMS = { 0 }; /*!< остаток времени */
UniSetTypes::Message::Priority priority; /*!< приоритет посылаемого сообщения */ UniSetTypes::Message::Priority priority = { UniSetTypes::Message::High }; /*!< приоритет посылаемого сообщения */
/*! /*!
* текущий такт * текущий такт
* \note Если задано количество -1 то сообщения будут поылатся постоянно * \note Если задано количество -1 то сообщения будут посылатся постоянно
*/ */
clock_t curTick; clock_t curTick = { -1 };
// таймер с меньшим временем ожидания имеет больший приоритет // таймер с меньшим временем ожидания имеет больший приоритет
bool operator < ( const TimerInfo& ti ) const bool operator < ( const TimerInfo& ti ) const
......
...@@ -178,12 +178,12 @@ class NCRestorer_XML: ...@@ -178,12 +178,12 @@ class NCRestorer_XML:
static xmlNode* bind_node( const std::shared_ptr<UniXML>& xml, xmlNode* root, const std::string& nodename, const std::string& nm = ""); static xmlNode* bind_node( const std::shared_ptr<UniXML>& xml, xmlNode* root, const std::string& nodename, const std::string& nm = "");
static xmlNode* rebind_node( const std::shared_ptr<UniXML>& xml, xmlNode* root, const std::string& nodename, const std::string& nm = ""); static xmlNode* rebind_node( const std::shared_ptr<UniXML>& xml, xmlNode* root, const std::string& nodename, const std::string& nm = "");
std::string s_filterField; std::string s_filterField = { "" };
std::string s_filterValue; std::string s_filterValue = { "" };
std::string t_filterField; std::string t_filterField = { "" };
std::string t_filterValue; std::string t_filterValue = { "" };
std::string fname; std::string fname = { "" };
std::shared_ptr<UniXML> uxml; std::shared_ptr<UniXML> uxml;
ReaderSlot rtslot; ReaderSlot rtslot;
NCReaderSlot ncrslot; NCReaderSlot ncrslot;
......
...@@ -62,11 +62,11 @@ class PassiveObject ...@@ -62,11 +62,11 @@ class PassiveObject
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) {} virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) {}
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) {} virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) {}
std::string myname; std::string myname = { "" };
ProxyManager* mngr = { nullptr };
ProxyManager* mngr;
private: private:
UniSetTypes::ObjectId id; UniSetTypes::ObjectId id = { UniSetTypes::DefaultObjectId };
}; };
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -55,7 +55,7 @@ class UniSetTimer ...@@ -55,7 +55,7 @@ class UniSetTimer
// некоторые классы могут не иметь подобных // некоторые классы могут не иметь подобных
// свойств. // свойств.
virtual bool wait(timeout_t timeMS); /*!< заснуть ожидая наступления времени */ virtual bool wait(timeout_t timeMS); /*!< заснуть ожидая наступления времени */
virtual void terminate(){} /*!< прервать работу таймера */ virtual void terminate() {} /*!< прервать работу таймера */
/*! завершить работу таймера */ /*! завершить работу таймера */
virtual void stop() noexcept; virtual void stop() noexcept;
......
...@@ -105,10 +105,10 @@ class Restorer_XML ...@@ -105,10 +105,10 @@ class Restorer_XML
ReaderSlot rslot; ReaderSlot rslot;
ReaderSlot cslot; ReaderSlot cslot;
std::string i_filterField; std::string i_filterField = { "" };
std::string i_filterValue; std::string i_filterValue = { "" };
std::string c_filterField; std::string c_filterField = { "" };
std::string c_filterValue; std::string c_filterValue = { "" };
}; };
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#endif #endif
......
...@@ -279,8 +279,8 @@ class UInterface ...@@ -279,8 +279,8 @@ class UInterface
typedef std::unordered_map<UniSetTypes::KeyType, Item> CacheMap; typedef std::unordered_map<UniSetTypes::KeyType, Item> CacheMap;
mutable CacheMap mcache; mutable CacheMap mcache;
mutable UniSetTypes::uniset_rwmutex cmutex; mutable UniSetTypes::uniset_rwmutex cmutex;
size_t MaxSize; /*!< максимальный размер кэша */ size_t MaxSize = { 20 }; /*!< максимальный размер кэша */
size_t minCallCount; /*!< минимальное количество вызовов, меньше которого ссылка считается устаревшей */ size_t minCallCount = { 20 }; /*!< минимальное количество вызовов, меньше которого ссылка считается устаревшей */
}; };
void initBackId( UniSetTypes::ObjectId backid ); void initBackId( UniSetTypes::ObjectId backid );
......
...@@ -114,7 +114,7 @@ class UniSetActivator: ...@@ -114,7 +114,7 @@ class UniSetActivator:
TerminateEvent_Signal s_term; TerminateEvent_Signal s_term;
std::atomic_bool omDestroy; std::atomic_bool omDestroy;
pid_t thid; // id orb потока pid_t thid = { 0 }; // id orb потока
bool _noUseGdbForStackTrace = { false }; bool _noUseGdbForStackTrace = { false };
......
...@@ -18,8 +18,8 @@ class ModbusTCPMaster: ...@@ -18,8 +18,8 @@ class ModbusTCPMaster:
ModbusTCPMaster(); ModbusTCPMaster();
virtual ~ModbusTCPMaster(); virtual ~ModbusTCPMaster();
bool connect( const std::string& addr, int port, bool closeOldConnection=true ) noexcept; bool connect( const std::string& addr, int port, bool closeOldConnection = true ) noexcept;
bool connect( const Poco::Net::SocketAddress& addr, int _port, bool closeOldConnection=true ) noexcept; bool connect( const Poco::Net::SocketAddress& addr, int _port, bool closeOldConnection = true ) noexcept;
void disconnect(); void disconnect();
void forceDisconnect(); void forceDisconnect();
......
...@@ -191,7 +191,7 @@ size_t ComPort485F::sendBlock(unsigned char* msg, size_t len ) ...@@ -191,7 +191,7 @@ size_t ComPort485F::sendBlock(unsigned char* msg, size_t len )
m_read(2000); m_read(2000);
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( tmit_ctrl_on ) if( tmit_ctrl_on )
{ {
...@@ -234,7 +234,7 @@ void ComPort485F::sendByte( unsigned char x ) ...@@ -234,7 +234,7 @@ void ComPort485F::sendByte( unsigned char x )
wq.push(x); wq.push(x);
m_read(2000); m_read(2000);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
if( tmit_ctrl_on ) if( tmit_ctrl_on )
{ {
......
...@@ -391,7 +391,7 @@ mbErrCode ModbusClient::recv( ModbusAddr addr, ModbusByte qfunc, ...@@ -391,7 +391,7 @@ mbErrCode ModbusClient::recv( ModbusAddr addr, ModbusByte qfunc,
cleanupChannel(); cleanupChannel();
return erTimeOut; return erTimeOut;
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
if( dlog->is_crit() ) if( dlog->is_crit() )
dlog->crit() << "(recv): " << ex << endl; dlog->crit() << "(recv): " << ex << endl;
...@@ -1326,7 +1326,7 @@ mbErrCode ModbusClient::recv_pdu( ModbusByte qfunc, ModbusMessage& rbuf, timeout ...@@ -1326,7 +1326,7 @@ mbErrCode ModbusClient::recv_pdu( ModbusByte qfunc, ModbusMessage& rbuf, timeout
return erTimeOut; return erTimeOut;
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
if( dlog->is_crit() ) if( dlog->is_crit() )
dlog->crit() << "(recv): " << ex << endl; dlog->crit() << "(recv): " << ex << endl;
...@@ -1367,7 +1367,7 @@ mbErrCode ModbusClient::send( ModbusMessage& msg ) ...@@ -1367,7 +1367,7 @@ mbErrCode ModbusClient::send( ModbusMessage& msg )
msg.swapHead(); msg.swapHead();
return ex.err; return ex.err;
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
if( dlog->is_crit() ) if( dlog->is_crit() )
dlog->crit() << "(send): " << ex << endl; dlog->crit() << "(send): " << ex << endl;
......
...@@ -142,7 +142,7 @@ mbErrCode ModbusRTUMaster::sendData(unsigned char* buf, size_t len ) ...@@ -142,7 +142,7 @@ mbErrCode ModbusRTUMaster::sendData(unsigned char* buf, size_t len )
{ {
port->sendBlock(buf, len); port->sendBlock(buf, len);
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
dlog->crit() << "(send): " << ex << endl; dlog->crit() << "(send): " << ex << endl;
return erHardwareError; return erHardwareError;
......
...@@ -120,7 +120,7 @@ mbErrCode ModbusRTUSlave::sendData( unsigned char* buf, int len ) ...@@ -120,7 +120,7 @@ mbErrCode ModbusRTUSlave::sendData( unsigned char* buf, int len )
{ {
port->sendBlock(buf, len); port->sendBlock(buf, len);
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
if( dlog->is_crit() ) if( dlog->is_crit() )
dlog->crit() << "(send): " << ex << endl; dlog->crit() << "(send): " << ex << endl;
......
...@@ -63,7 +63,7 @@ void ModbusServer::setRecvTimeout( timeout_t msec ) ...@@ -63,7 +63,7 @@ void ModbusServer::setRecvTimeout( timeout_t msec )
timeout_t ModbusServer::setReplyTimeout( timeout_t msec ) timeout_t ModbusServer::setReplyTimeout( timeout_t msec )
{ {
// #warning "Why msec can be 0?" // #warning "Why msec can be 0?"
assert(msec>0); assert(msec > 0);
if( msec == UniSetTimer::WaitUpTime ) if( msec == UniSetTimer::WaitUpTime )
return replyTimeout_ms; return replyTimeout_ms;
...@@ -638,7 +638,7 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v ...@@ -638,7 +638,7 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v
cleanupChannel(); cleanupChannel();
return erSessionClosed; return erSessionClosed;
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
dlog->crit() << "(recv): " << ex << endl; dlog->crit() << "(recv): " << ex << endl;
cleanupChannel(); cleanupChannel();
...@@ -1775,7 +1775,7 @@ mbErrCode ModbusServer::send( ModbusMessage& msg ) ...@@ -1775,7 +1775,7 @@ mbErrCode ModbusServer::send( ModbusMessage& msg )
sendData(msg.buf(), len); sendData(msg.buf(), len);
msg.swapHead(); // обратно, т.к. потом ещё будет post_send_request msg.swapHead(); // обратно, т.к. потом ещё будет post_send_request
} }
catch( const Exception& ex ) // SystemError catch( const UniSetTypes::Exception& ex ) // SystemError
{ {
if( dlog->is_crit() ) if( dlog->is_crit() )
dlog->crit() << "(ModbusServer::send): " << ex << endl; dlog->crit() << "(ModbusServer::send): " << ex << endl;
......
...@@ -186,11 +186,11 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg, ...@@ -186,11 +186,11 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
{ {
try try
{ {
Poco::Net::SocketAddress iaddr = tcp->peerAddress(); Poco::Net::SocketAddress ia = tcp->peerAddress();
dlog->warn() << "(ModbusTCPMaster::query): ret=" << ret dlog->warn() << "(ModbusTCPMaster::query): ret=" << ret
<< " < rmh=" << sizeof(reply.aduhead) << " < rmh=" << sizeof(reply.aduhead)
<< " perr: " << iaddr.host().toString() << ":" << iaddr.port() << " perr: " << ia.host().toString() << ":" << ia.port()
<< endl; << endl;
} }
catch( const Poco::Net::NetException& ex ) catch( const Poco::Net::NetException& ex )
...@@ -201,8 +201,10 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg, ...@@ -201,8 +201,10 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
} }
cleanInputStream(); cleanInputStream();
if( tcp ) if( tcp )
tcp->forceDisconnect(); tcp->forceDisconnect();
return erTimeOut; // return erHardwareError; return erTimeOut; // return erHardwareError;
} }
......
...@@ -427,7 +427,7 @@ void ReadCoilMessage::init( const ModbusMessage& m ) ...@@ -427,7 +427,7 @@ void ReadCoilMessage::init( const ModbusMessage& m )
assert( m.pduhead.func == fnReadCoilStatus ); assert( m.pduhead.func == fnReadCoilStatus );
// memset(this, 0, sizeof(*this)); // memset(this, 0, sizeof(*this));
memcpy(this, &m.pduhead, sizeof(m.pduhead)); memcpy(this, &m.pduhead, sizeof(m.pduhead));
memcpy(&start, m.data, szData()); memcpy(&start, &(m.data[0]), szData());
// переворачиваем слова // переворачиваем слова
start = SWAPSHORT(start); start = SWAPSHORT(start);
...@@ -2273,7 +2273,7 @@ void DiagnosticMessage::init( const ModbusMessage& m ) ...@@ -2273,7 +2273,7 @@ void DiagnosticMessage::init( const ModbusMessage& m )
func = m.pduhead.func; func = m.pduhead.func;
memcpy( &subf, &(m.data[0]), sizeof(subf) ); memcpy( &subf, &(m.data[0]), sizeof(subf) );
int last = sizeof(subf); size_t last = sizeof(subf);
subf = SWAPSHORT(subf); subf = SWAPSHORT(subf);
count = szRequestDiagnosticData((DiagnosticsSubFunction)subf ); count = szRequestDiagnosticData((DiagnosticsSubFunction)subf );
...@@ -2281,15 +2281,15 @@ void DiagnosticMessage::init( const ModbusMessage& m ) ...@@ -2281,15 +2281,15 @@ void DiagnosticMessage::init( const ModbusMessage& m )
if( count > MAXDATALEN ) if( count > MAXDATALEN )
throw mbException(erPacketTooLong); throw mbException(erPacketTooLong);
if( count < 0 ) if( count > 0 )
throw mbException(erBadDataValue); {
memcpy(&data, &(m.data[last]), sizeof(ModbusData)*count); memcpy(&data, &(m.data[last]), sizeof(ModbusData)*count);
last += sizeof(ModbusData) * count; last += sizeof(ModbusData) * count;
// переворачиваем данные // переворачиваем данные
for( size_t i = 0; i < count; i++ ) for( size_t i = 0; i < count; i++ )
data[i] = SWAPSHORT(data[i]); data[i] = SWAPSHORT(data[i]);
}
memcpy(&crc, &(m.data[last]), szCRC); memcpy(&crc, &(m.data[last]), szCRC);
} }
...@@ -3111,7 +3111,7 @@ ModbusMessage SetDateTimeMessage::transport_msg() ...@@ -3111,7 +3111,7 @@ ModbusMessage SetDateTimeMessage::transport_msg()
mm.data[6] = century; mm.data[6] = century;
*/ */
size_t bcnt = 7; size_t bcnt = 7;
memcpy( mm.data, &hour, bcnt ); memcpy( mm.data, &hour, bcnt ); // копируем начиная с адреса 'hour' 7 байт.
// пересчитываем CRC // пересчитываем CRC
ModbusData crc = checkCRC( (ModbusByte*)(&mm.pduhead), szModbusHeader + bcnt ); ModbusData crc = checkCRC( (ModbusByte*)(&mm.pduhead), szModbusHeader + bcnt );
...@@ -3175,7 +3175,7 @@ ModbusMessage SetDateTimeRetMessage::transport_msg() ...@@ -3175,7 +3175,7 @@ ModbusMessage SetDateTimeRetMessage::transport_msg()
// копируем заголовок и данные // копируем заголовок и данные
memcpy(&mm.pduhead, this, szModbusHeader); memcpy(&mm.pduhead, this, szModbusHeader);
/* size_t bcnt = 7;
mm.data[0] = hour; mm.data[0] = hour;
mm.data[1] = min; mm.data[1] = min;
mm.data[2] = sec; mm.data[2] = sec;
...@@ -3183,9 +3183,6 @@ ModbusMessage SetDateTimeRetMessage::transport_msg() ...@@ -3183,9 +3183,6 @@ ModbusMessage SetDateTimeRetMessage::transport_msg()
mm.data[4] = mon; mm.data[4] = mon;
mm.data[5] = year; mm.data[5] = year;
mm.data[6] = century; mm.data[6] = century;
*/
size_t bcnt = 7;
memcpy( mm.data, &hour, bcnt );
// пересчитываем CRC // пересчитываем CRC
ModbusData crc = checkCRC( (ModbusByte*)(&mm.pduhead), szModbusHeader + bcnt ); ModbusData crc = checkCRC( (ModbusByte*)(&mm.pduhead), szModbusHeader + bcnt );
...@@ -3508,8 +3505,7 @@ FileTransferRetMessage::FileTransferRetMessage( ModbusAddr _from ): ...@@ -3508,8 +3505,7 @@ FileTransferRetMessage::FileTransferRetMessage( ModbusAddr _from ):
bool FileTransferRetMessage::set( ModbusData nfile, ModbusData fpacks, bool FileTransferRetMessage::set( ModbusData nfile, ModbusData fpacks,
ModbusData pack, ModbusByte* buf, ModbusByte len ) ModbusData pack, ModbusByte* buf, ModbusByte len )
{ {
if( len > sizeof(data) ) assert( std::numeric_limits<ModbusByte>::max() <= sizeof(data) );
return false;
clear(); clear();
memcpy(data, buf, len); memcpy(data, buf, len);
......
...@@ -89,7 +89,7 @@ class TGuard ...@@ -89,7 +89,7 @@ class TGuard
public: public:
TGuard( T* m, typename ThreadCreator<T>::Action a ): TGuard( T* m, typename ThreadCreator<T>::Action a ):
t(m,a) t(m, a)
{ {
t.start(); t.start();
} }
......
...@@ -9,7 +9,7 @@ USocket::~USocket() ...@@ -9,7 +9,7 @@ USocket::~USocket()
{ {
close(); close();
} }
catch(...){} catch(...) {}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
USocket::USocket( int sock ) USocket::USocket( int sock )
......
...@@ -53,7 +53,7 @@ UTCPCore::Buffer::~Buffer() ...@@ -53,7 +53,7 @@ UTCPCore::Buffer::~Buffer()
delete [] data; delete [] data;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
unsigned char*UTCPCore::Buffer::dpos() noexcept unsigned char* UTCPCore::Buffer::dpos() noexcept
{ {
return data + pos; return data + pos;
} }
......
...@@ -16,7 +16,7 @@ UTCPSocket::~UTCPSocket() ...@@ -16,7 +16,7 @@ UTCPSocket::~UTCPSocket()
{ {
Poco::Net::ServerSocket::close(); Poco::Net::ServerSocket::close();
} }
catch(...){} catch(...) {}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
UTCPSocket::UTCPSocket() UTCPSocket::UTCPSocket()
......
...@@ -65,7 +65,7 @@ void UTCPStream::forceDisconnect() ...@@ -65,7 +65,7 @@ void UTCPStream::forceDisconnect()
setLinger(false, 0); setLinger(false, 0);
} }
// catch( Poco::Net::NetException& ex ){} // catch( Poco::Net::NetException& ex ){}
catch( std::exception& ex ){} catch( std::exception& ex ) {}
try try
{ {
...@@ -73,7 +73,7 @@ void UTCPStream::forceDisconnect() ...@@ -73,7 +73,7 @@ void UTCPStream::forceDisconnect()
//shutdown(); //shutdown();
} }
// catch( Poco::Net::NetException& ex ){} // catch( Poco::Net::NetException& ex ){}
catch( std::exception& ex ){} catch( std::exception& ex ) {}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void UTCPStream::disconnect() void UTCPStream::disconnect()
...@@ -82,15 +82,15 @@ void UTCPStream::disconnect() ...@@ -82,15 +82,15 @@ void UTCPStream::disconnect()
{ {
shutdown(); shutdown();
} }
// catch( Poco::Net::NetException& ex ){} // catch( Poco::Net::NetException& ex ){}
catch( std::exception& ex ){} catch( std::exception& ex ) {}
try try
{ {
close(); close();
} }
// catch( Poco::Net::NetException& ex ){} // catch( Poco::Net::NetException& ex ){}
catch( std::exception& ex ){} catch( std::exception& ex ) {}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
int UTCPStream::getSocket() const int UTCPStream::getSocket() const
...@@ -116,7 +116,7 @@ void UTCPStream::create( const std::string& hname, int port, timeout_t tout_msec ...@@ -116,7 +116,7 @@ void UTCPStream::create( const std::string& hname, int port, timeout_t tout_msec
bool UTCPStream::isConnected() noexcept bool UTCPStream::isConnected() noexcept
{ {
return ( Poco::Net::StreamSocket::sockfd() != POCO_INVALID_SOCKET ); return ( Poco::Net::StreamSocket::sockfd() != POCO_INVALID_SOCKET );
/* /*
try try
{ {
// Вариант 1 // Вариант 1
...@@ -126,14 +126,14 @@ bool UTCPStream::isConnected() noexcept ...@@ -126,14 +126,14 @@ bool UTCPStream::isConnected() noexcept
return ( Poco::Net::StreamSocket::peerAddress().port() != 0 ); return ( Poco::Net::StreamSocket::peerAddress().port() != 0 );
// Вариант 3 // Вариант 3
// if( poll({0, 5}, Poco::Net::Socket::SELECT_READ) ) // if( poll({0, 5}, Poco::Net::Socket::SELECT_READ) )
// return (tcp->available() > 0); // return (tcp->available() > 0);
} }
catch( Poco::Net::NetException& ex ) catch( Poco::Net::NetException& ex )
{ {
} }
return false; return false;
*/ */
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace omni; using namespace omni;
using namespace UniversalIO; using namespace UniversalIO;
using namespace UniSetTypes; // using namespace UniSetTypes;
using namespace std; using namespace std;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UInterface::UInterface( const std::shared_ptr<UniSetTypes::Configuration>& _uconf ): UInterface::UInterface( const std::shared_ptr<UniSetTypes::Configuration>& _uconf ):
...@@ -47,7 +47,7 @@ UInterface::UInterface( const std::shared_ptr<UniSetTypes::Configuration>& _ucon ...@@ -47,7 +47,7 @@ UInterface::UInterface( const std::shared_ptr<UniSetTypes::Configuration>& _ucon
init(); init();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UInterface::UInterface( const ObjectId backid, CORBA::ORB_var orb, const shared_ptr<ObjectIndex> _oind ): UInterface::UInterface( const UniSetTypes::ObjectId backid, CORBA::ORB_var orb, const shared_ptr<UniSetTypes::ObjectIndex> _oind ):
rep(UniSetTypes::uniset_conf()), rep(UniSetTypes::uniset_conf()),
myid(backid), myid(backid),
orb(orb), orb(orb),
...@@ -85,7 +85,7 @@ void UInterface::init() ...@@ -85,7 +85,7 @@ void UInterface::init()
else else
localctx = ORepHelpers::getRootNamingContext( orb, s.str() ); localctx = ORepHelpers::getRootNamingContext( orb, s.str() );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
// if( !uconf->isLocalIOR() ) // if( !uconf->isLocalIOR() )
// throw ex; // throw ex;
...@@ -112,17 +112,17 @@ void UInterface::initBackId( const UniSetTypes::ObjectId backid ) ...@@ -112,17 +112,17 @@ void UInterface::initBackId( const UniSetTypes::ObjectId backid )
* \exception IOBadParam - генерируется если указано неправильное имя датчика или секции * \exception IOBadParam - генерируется если указано неправильное имя датчика или секции
* \exception IOTimeOut - генерируется если в течение времени timeout небыл получен ответ * \exception IOTimeOut - генерируется если в течение времени timeout небыл получен ответ
*/ */
long UInterface::getValue( const ObjectId id, const ObjectId node ) const long UInterface::getValue( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const
throw(UI_THROW_EXCEPTIONS) throw(UI_THROW_EXCEPTIONS)
{ {
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getValue): error id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getValue): error id=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getValue): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getValue): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -133,7 +133,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -133,7 +133,7 @@ throw(UI_THROW_EXCEPTIONS)
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -164,11 +164,11 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -164,11 +164,11 @@ throw(UI_THROW_EXCEPTIONS)
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(getValue): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getValue): " + string(ex.err));
} }
catch( const ORepFailed& ) catch( const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
throw UniSetTypes::IOBadParam(set_err("UI(getValue): ORepFailed", id, node)); throw UniSetTypes::IOBadParam(set_err("UI(getValue): UniSetTypes::ORepFailed", id, node));
} }
catch( const CORBA::NO_IMPLEMENT& ) catch( const CORBA::NO_IMPLEMENT& )
{ {
...@@ -194,7 +194,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -194,7 +194,7 @@ throw(UI_THROW_EXCEPTIONS)
throw UniSetTypes::TimeOut(set_err("UI(getValue): TimeOut", id, node)); throw UniSetTypes::TimeOut(set_err("UI(getValue): TimeOut", id, node));
} }
long UInterface::getValue( const ObjectId name ) const long UInterface::getValue( const UniSetTypes::ObjectId name ) const
{ {
return getValue(name, uconf->getLocalNode()); return getValue(name, uconf->getLocalNode());
} }
...@@ -203,13 +203,13 @@ long UInterface::getValue( const ObjectId name ) const ...@@ -203,13 +203,13 @@ long UInterface::getValue( const ObjectId name ) const
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId sup_id ) void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId sup_id )
{ {
if( si.id == DefaultObjectId ) if( si.id == UniSetTypes::DefaultObjectId )
{ {
uwarn << "UI(setUndefinedState): ID=UniSetTypes::DefaultObjectId" << endl; uwarn << "UI(setUndefinedState): ID=UniSetTypes::DefaultObjectId" << endl;
return; return;
} }
if( sup_id == DefaultObjectId ) if( sup_id == UniSetTypes::DefaultObjectId )
sup_id = myid; sup_id = myid;
try try
...@@ -220,7 +220,7 @@ void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool u ...@@ -220,7 +220,7 @@ void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool u
{ {
oref = rcache.resolve(si.id, si.node); oref = rcache.resolve(si.id, si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -252,7 +252,7 @@ void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool u ...@@ -252,7 +252,7 @@ void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool u
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
throw UniSetTypes::IOBadParam("UI(setUndefinedState): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(setUndefinedState): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -282,26 +282,27 @@ void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool u ...@@ -282,26 +282,27 @@ void UInterface::setUndefinedState( const IOController_i::SensorInfo& si, bool u
* \return текущее значение датчика * \return текущее значение датчика
* \exception IOBadParam - генерируется если указано неправильное имя вывода или секции * \exception IOBadParam - генерируется если указано неправильное имя вывода или секции
*/ */
void UInterface::setValue( const ObjectId id, long value, const ObjectId node, const UniSetTypes::ObjectId sup_id ) const void UInterface::setValue( const UniSetTypes::ObjectId id, long value, const UniSetTypes::ObjectId node, const UniSetTypes::ObjectId sup_id ) const
throw(UI_THROW_EXCEPTIONS) throw(UI_THROW_EXCEPTIONS)
{ {
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(setValue): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(setValue): error: id=UniSetTypes::DefaultObjectId");
if ( node == DefaultObjectId ) if ( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(setValue): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(setValue): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
/*
if ( sup_id == DefaultObjectId ) /*
if ( sup_id == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(setValue): id='" << id << "' error: supplier=UniSetTypes::DefaultObjectId"; err << "UI(setValue): id='" << id << "' error: supplier=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
*/ */
try try
{ {
CORBA::Object_var oref; CORBA::Object_var oref;
...@@ -310,7 +311,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -310,7 +311,7 @@ throw(UI_THROW_EXCEPTIONS)
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -335,14 +336,14 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -335,14 +336,14 @@ throw(UI_THROW_EXCEPTIONS)
catch(const IOController_i::NameNotFound& ex) catch(const IOController_i::NameNotFound& ex)
{ {
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::NameNotFound(set_err("UI(setValue): const NameNotFound& для объекта", id, node)); throw UniSetTypes::NameNotFound(set_err("UI(setValue): const UniSetTypes::NameNotFound& для объекта", id, node));
} }
catch(const IOController_i::IOBadParam& ex) catch(const IOController_i::IOBadParam& ex)
{ {
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(setValue): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(setValue): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -370,7 +371,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -370,7 +371,7 @@ throw(UI_THROW_EXCEPTIONS)
throw UniSetTypes::TimeOut(set_err("UI(setValue): Timeout", id, node)); throw UniSetTypes::TimeOut(set_err("UI(setValue): Timeout", id, node));
} }
void UInterface::setValue( const ObjectId name, long value ) const void UInterface::setValue( const UniSetTypes::ObjectId name, long value ) const
{ {
setValue(name, value, uconf->getLocalNode(), myid); setValue(name, value, uconf->getLocalNode(), myid);
} }
...@@ -378,20 +379,20 @@ void UInterface::setValue( const ObjectId name, long value ) const ...@@ -378,20 +379,20 @@ void UInterface::setValue( const ObjectId name, long value ) const
void UInterface::setValue( const IOController_i::SensorInfo& si, long value, const UniSetTypes::ObjectId sup_id ) const void UInterface::setValue( const IOController_i::SensorInfo& si, long value, const UniSetTypes::ObjectId sup_id ) const
{ {
setValue(si.id, value, si.node,sup_id); setValue(si.id, value, si.node, sup_id);
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
// функция не вырабатывает исключий! // функция не вырабатывает исключий!
void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value, UniSetTypes::ObjectId sup_id ) const void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value, UniSetTypes::ObjectId sup_id ) const
{ {
if ( si.id == DefaultObjectId ) if ( si.id == UniSetTypes::DefaultObjectId )
{ {
uwarn << "UI(fastSetValue): ID=UniSetTypes::DefaultObjectId" << endl; uwarn << "UI(fastSetValue): ID=UniSetTypes::DefaultObjectId" << endl;
return; return;
} }
if( sup_id == DefaultObjectId ) if( sup_id == UniSetTypes::DefaultObjectId )
sup_id = myid; sup_id = myid;
try try
...@@ -402,7 +403,7 @@ void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value, ...@@ -402,7 +403,7 @@ void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value,
{ {
oref = rcache.resolve(si.id, si.node); oref = rcache.resolve(si.id, si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -427,14 +428,14 @@ void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value, ...@@ -427,14 +428,14 @@ void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value,
catch(const IOController_i::NameNotFound& ex) catch(const IOController_i::NameNotFound& ex)
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
uwarn << set_err("UI(fastSetValue): const NameNotFound& для объекта", si.id, si.node) << endl; uwarn << set_err("UI(fastSetValue): const UniSetTypes::NameNotFound& для объекта", si.id, si.node) << endl;
} }
catch(const IOController_i::IOBadParam& ex) catch(const IOController_i::IOBadParam& ex)
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
throw UniSetTypes::IOBadParam("UI(fastSetValue): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(fastSetValue): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -473,7 +474,8 @@ void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value, ...@@ -473,7 +474,8 @@ void UInterface::fastSetValue( const IOController_i::SensorInfo& si, long value,
* \param cmd - команда см. \ref UniversalIO::UIOCommand * \param cmd - команда см. \ref UniversalIO::UIOCommand
* \param backid - обратный адрес (идентификатор заказчика) * \param backid - обратный адрес (идентификатор заказчика)
*/ */
void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd, const ObjectId node, void UInterface::askRemoteSensor( const UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
const UniSetTypes::ObjectId node,
UniSetTypes::ObjectId backid ) const throw(UI_THROW_EXCEPTIONS) UniSetTypes::ObjectId backid ) const throw(UI_THROW_EXCEPTIONS)
{ {
if( backid == UniSetTypes::DefaultObjectId ) if( backid == UniSetTypes::DefaultObjectId )
...@@ -482,14 +484,14 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd ...@@ -482,14 +484,14 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd
if( backid == UniSetTypes::DefaultObjectId ) if( backid == UniSetTypes::DefaultObjectId )
throw UniSetTypes::IOBadParam("UI(askRemoteSensor): unknown back ID"); throw UniSetTypes::IOBadParam("UI(askRemoteSensor): unknown back ID");
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(askRemoteSensor): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(askRemoteSensor): error: id=UniSetTypes::DefaultObjectId");
if ( node == DefaultObjectId ) if ( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(askRemoteSensor): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(askRemoteSensor): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -500,7 +502,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd ...@@ -500,7 +502,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -510,7 +512,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd ...@@ -510,7 +512,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd
oref = resolve( id, node ); oref = resolve( id, node );
IONotifyController_i_var inc = IONotifyController_i::_narrow(oref); IONotifyController_i_var inc = IONotifyController_i::_narrow(oref);
ConsumerInfo_var ci; UniSetTypes::ConsumerInfo_var ci;
ci->id = backid; ci->id = backid;
ci->node = uconf->getLocalNode(); ci->node = uconf->getLocalNode();
inc->askSensor(id, ci, cmd ); inc->askSensor(id, ci, cmd );
...@@ -535,7 +537,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd ...@@ -535,7 +537,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(askSensor): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(askSensor): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -566,7 +568,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd ...@@ -566,7 +568,7 @@ void UInterface::askRemoteSensor( const ObjectId id, UniversalIO::UIOCommand cmd
throw UniSetTypes::TimeOut(set_err("UI(askSensor): Timeout", id, node)); throw UniSetTypes::TimeOut(set_err("UI(askSensor): Timeout", id, node));
} }
void UInterface::askSensor( const ObjectId name, UniversalIO::UIOCommand cmd, const UniSetTypes::ObjectId backid ) const void UInterface::askSensor( const UniSetTypes::ObjectId name, UniversalIO::UIOCommand cmd, const UniSetTypes::ObjectId backid ) const
{ {
askRemoteSensor(name, cmd, uconf->getLocalNode(), backid); askRemoteSensor(name, cmd, uconf->getLocalNode(), backid);
} }
...@@ -576,17 +578,17 @@ void UInterface::askSensor( const ObjectId name, UniversalIO::UIOCommand cmd, co ...@@ -576,17 +578,17 @@ void UInterface::askSensor( const ObjectId name, UniversalIO::UIOCommand cmd, co
* \param id - идентификатор объекта * \param id - идентификатор объекта
* \param node - идентификатор узла * \param node - идентификатор узла
*/ */
IOType UInterface::getIOType( const ObjectId id, const ObjectId node ) const IOType UInterface::getIOType( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const
throw(UI_THROW_EXCEPTIONS) throw(UI_THROW_EXCEPTIONS)
{ {
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getIOType): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getIOType): error: id=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getIOType): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getIOType): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -597,7 +599,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -597,7 +599,7 @@ throw(UI_THROW_EXCEPTIONS)
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -627,7 +629,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -627,7 +629,7 @@ throw(UI_THROW_EXCEPTIONS)
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(getIOType): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getIOType): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -658,7 +660,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -658,7 +660,7 @@ throw(UI_THROW_EXCEPTIONS)
throw UniSetTypes::TimeOut(set_err("UI(getIOType): Timeout", id, node)); throw UniSetTypes::TimeOut(set_err("UI(getIOType): Timeout", id, node));
} }
IOType UInterface::getIOType( const ObjectId id ) const IOType UInterface::getIOType( const UniSetTypes::ObjectId id ) const
{ {
return getIOType(id, uconf->getLocalNode() ); return getIOType(id, uconf->getLocalNode() );
} }
...@@ -667,17 +669,17 @@ IOType UInterface::getIOType( const ObjectId id ) const ...@@ -667,17 +669,17 @@ IOType UInterface::getIOType( const ObjectId id ) const
* \param id - идентификатор объекта * \param id - идентификатор объекта
* \param node - идентификатор узла * \param node - идентификатор узла
*/ */
ObjectType UInterface::getType(const ObjectId name, const ObjectId node) const UniSetTypes::ObjectType UInterface::getType( const UniSetTypes::ObjectId name, const UniSetTypes::ObjectId node) const
throw(UI_THROW_EXCEPTIONS) throw(UI_THROW_EXCEPTIONS)
{ {
if ( name == DefaultObjectId ) if ( name == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getType): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getType): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getType): id='" << name << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getType): id='" << name << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -688,7 +690,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -688,7 +690,7 @@ throw(UI_THROW_EXCEPTIONS)
{ {
oref = rcache.resolve(name, node); oref = rcache.resolve(name, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -718,7 +720,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -718,7 +720,7 @@ throw(UI_THROW_EXCEPTIONS)
rcache.erase(name, node); rcache.erase(name, node);
throw UniSetTypes::IOBadParam("UI(getType): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getType): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(name, node); rcache.erase(name, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -750,13 +752,13 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -750,13 +752,13 @@ throw(UI_THROW_EXCEPTIONS)
throw UniSetTypes::TimeOut(set_err("UI(getType): Timeout", name, node)); throw UniSetTypes::TimeOut(set_err("UI(getType): Timeout", name, node));
} }
ObjectType UInterface::getType( const ObjectId name ) const UniSetTypes::ObjectType UInterface::getType( const UniSetTypes::ObjectId name ) const
{ {
return getType(name, uconf->getLocalNode()); return getType(name, uconf->getLocalNode());
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
void UInterface::registered( const ObjectId id, const ObjectPtr oRef, bool force ) const throw(UniSetTypes::ORepFailed) void UInterface::registered( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectPtr oRef, bool force ) const throw(UniSetTypes::ORepFailed)
{ {
// если влючён режим использования локальных файлов // если влючён режим использования локальных файлов
// то пишем IOR в файл // то пишем IOR в файл
...@@ -773,14 +775,14 @@ void UInterface::registered( const ObjectId id, const ObjectPtr oRef, bool force ...@@ -773,14 +775,14 @@ void UInterface::registered( const ObjectId id, const ObjectPtr oRef, bool force
{ {
rep.registration( oind->getNameById(id), oRef, force ); rep.registration( oind->getNameById(id), oRef, force );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
throw; throw;
} }
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
void UInterface::unregister( const ObjectId id )throw(ORepFailed) void UInterface::unregister( const UniSetTypes::ObjectId id )throw(UniSetTypes::ORepFailed)
{ {
if( uconf->isLocalIOR() ) if( uconf->isLocalIOR() )
{ {
...@@ -792,24 +794,24 @@ void UInterface::unregister( const ObjectId id )throw(ORepFailed) ...@@ -792,24 +794,24 @@ void UInterface::unregister( const ObjectId id )throw(ORepFailed)
{ {
rep.unregistration( oind->getNameById(id) ); rep.unregistration( oind->getNameById(id) );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
throw; throw;
} }
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
ObjectPtr UInterface::resolve( const ObjectId rid , const ObjectId node ) const UniSetTypes::ObjectPtr UInterface::resolve( const UniSetTypes::ObjectId rid , const UniSetTypes::ObjectId node ) const
throw(ResolveNameError, UniSetTypes::TimeOut ) throw(UniSetTypes::ResolveNameError, UniSetTypes::TimeOut )
{ {
if ( rid == DefaultObjectId ) if ( rid == UniSetTypes::DefaultObjectId )
throw ResolveNameError("UI(resolve): ID=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ResolveNameError("UI(resolve): ID=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(resolve): id='" << rid << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(resolve): id='" << rid << "' error: node=UniSetTypes::DefaultObjectId";
throw ResolveNameError(err.str()); throw UniSetTypes::ResolveNameError(err.str());
} }
CosNaming::NamingContext_var ctx; CosNaming::NamingContext_var ctx;
...@@ -858,7 +860,7 @@ throw(ResolveNameError, UniSetTypes::TimeOut ) ...@@ -858,7 +860,7 @@ throw(ResolveNameError, UniSetTypes::TimeOut )
break; break;
} }
// catch( const CORBA::COMM_FAILURE& ex ) // catch( const CORBA::COMM_FAILURE& ex )
catch( const ORepFailed& ex ) catch( const UniSetTypes::ORepFailed& ex )
{ {
// нет связи с этим узлом // нет связи с этим узлом
// пробуем связатся по другой сети // пробуем связатся по другой сети
...@@ -872,7 +874,7 @@ throw(ResolveNameError, UniSetTypes::TimeOut ) ...@@ -872,7 +874,7 @@ throw(ResolveNameError, UniSetTypes::TimeOut )
if( CORBA::is_nil(ctx) ) if( CORBA::is_nil(ctx) )
{ {
// uwarn << "NameService недоступен на узле "<< node << endl; // uwarn << "NameService недоступен на узле "<< node << endl;
throw NSResolveError(); throw UniSetTypes::NSResolveError();
} }
} }
else else
...@@ -940,17 +942,17 @@ throw(ResolveNameError, UniSetTypes::TimeOut ) ...@@ -940,17 +942,17 @@ throw(ResolveNameError, UniSetTypes::TimeOut )
} }
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
void UInterface::send( const ObjectId name, const TransportMessage& msg, const ObjectId node ) void UInterface::send( const UniSetTypes::ObjectId name, const UniSetTypes::TransportMessage& msg, const UniSetTypes::ObjectId node )
throw(UI_THROW_EXCEPTIONS) throw(UI_THROW_EXCEPTIONS)
{ {
if ( name == DefaultObjectId ) if ( name == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(send): ERROR: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(send): ERROR: id=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(send): id='" << name << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(send): id='" << name << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -961,7 +963,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -961,7 +963,7 @@ throw(UI_THROW_EXCEPTIONS)
{ {
oref = rcache.resolve(name, node); oref = rcache.resolve(name, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -982,7 +984,7 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -982,7 +984,7 @@ throw(UI_THROW_EXCEPTIONS)
oref = CORBA::Object::_nil(); oref = CORBA::Object::_nil();
} }
} }
catch( const ORepFailed ) catch( const UniSetTypes::ORepFailed )
{ {
rcache.erase(name, node); rcache.erase(name, node);
throw UniSetTypes::IOBadParam(set_err("UI(send): resolve failed ", name, node)); throw UniSetTypes::IOBadParam(set_err("UI(send): resolve failed ", name, node));
...@@ -1012,22 +1014,22 @@ throw(UI_THROW_EXCEPTIONS) ...@@ -1012,22 +1014,22 @@ throw(UI_THROW_EXCEPTIONS)
throw UniSetTypes::TimeOut(set_err("UI(send): Timeout", name, node)); throw UniSetTypes::TimeOut(set_err("UI(send): Timeout", name, node));
} }
void UInterface::send( const ObjectId name, const TransportMessage& msg ) void UInterface::send( const UniSetTypes::ObjectId name, const UniSetTypes::TransportMessage& msg )
{ {
send(name, msg, uconf->getLocalNode()); send(name, msg, uconf->getLocalNode());
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const ObjectId node ) const IOController_i::ShortIOInfo UInterface::getChangedTime( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const
{ {
if( id == DefaultObjectId ) if( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getChangedTime): Unknown id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getChangedTime): Unknown id=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getChangedTime): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getChangedTime): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1038,7 +1040,7 @@ IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const ...@@ -1038,7 +1040,7 @@ IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1069,7 +1071,7 @@ IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const ...@@ -1069,7 +1071,7 @@ IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(getChangedTime): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getChangedTime): " + string(ex.err));
} }
catch( const ORepFailed& ) catch( const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
uwarn << set_err("UI(getChangedTime): resolve failed ", id, node) << endl; uwarn << set_err("UI(getChangedTime): resolve failed ", id, node) << endl;
...@@ -1100,12 +1102,12 @@ IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const ...@@ -1100,12 +1102,12 @@ IOController_i::ShortIOInfo UInterface::getChangedTime( const ObjectId id, const
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
ObjectPtr UInterface::CacheOfResolve::resolve( const ObjectId id, const ObjectId node ) const UniSetTypes::ObjectPtr UInterface::CacheOfResolve::resolve( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const
throw(NameNotFound) throw(UniSetTypes::NameNotFound)
{ {
UniSetTypes::uniset_rwmutex_rlock l(cmutex); UniSetTypes::uniset_rwmutex_rlock l(cmutex);
auto it = mcache.find( key(id, node) ); auto it = mcache.find( UniSetTypes::key(id, node) );
if( it == mcache.end() ) if( it == mcache.end() )
throw UniSetTypes::NameNotFound(); throw UniSetTypes::NameNotFound();
...@@ -1122,11 +1124,11 @@ throw(NameNotFound) ...@@ -1122,11 +1124,11 @@ throw(NameNotFound)
throw UniSetTypes::NameNotFound(); throw UniSetTypes::NameNotFound();
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
void UInterface::CacheOfResolve::cache( const ObjectId id, const ObjectId node, ObjectVar& ptr ) const void UInterface::CacheOfResolve::cache( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node, UniSetTypes::ObjectVar& ptr ) const
{ {
UniSetTypes::uniset_rwmutex_wrlock l(cmutex); UniSetTypes::uniset_rwmutex_wrlock l(cmutex);
UniSetTypes::KeyType k( key(id, node) ); UniSetTypes::KeyType k( UniSetTypes::key(id, node) );
auto it = mcache.find(k); auto it = mcache.find(k);
...@@ -1153,7 +1155,7 @@ bool UInterface::CacheOfResolve::clean() noexcept ...@@ -1153,7 +1155,7 @@ bool UInterface::CacheOfResolve::clean() noexcept
{ {
mcache.erase(it++); mcache.erase(it++);
} }
catch(...){} catch(...) {}
} }
else else
++it; ++it;
...@@ -1169,14 +1171,15 @@ bool UInterface::CacheOfResolve::clean() noexcept ...@@ -1169,14 +1171,15 @@ bool UInterface::CacheOfResolve::clean() noexcept
void UInterface::CacheOfResolve::erase( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const noexcept void UInterface::CacheOfResolve::erase( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const noexcept
{ {
UniSetTypes::uniset_rwmutex_wrlock l(cmutex); UniSetTypes::uniset_rwmutex_wrlock l(cmutex);
try try
{ {
auto it = mcache.find( key(id, node) ); auto it = mcache.find( UniSetTypes::key(id, node) );
if( it != mcache.end() ) if( it != mcache.end() )
mcache.erase(it); mcache.erase(it);
} }
catch(...){} catch(...) {}
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
...@@ -1224,7 +1227,7 @@ bool UInterface::isExist( const UniSetTypes::ObjectId id, const UniSetTypes::Obj ...@@ -1224,7 +1227,7 @@ bool UInterface::isExist( const UniSetTypes::ObjectId id, const UniSetTypes::Obj
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
if( CORBA::is_nil(oref) ) if( CORBA::is_nil(oref) )
oref = resolve(id, node); oref = resolve(id, node);
...@@ -1236,10 +1239,10 @@ bool UInterface::isExist( const UniSetTypes::ObjectId id, const UniSetTypes::Obj ...@@ -1236,10 +1239,10 @@ bool UInterface::isExist( const UniSetTypes::ObjectId id, const UniSetTypes::Obj
return false; return false;
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
string UInterface::set_err( const std::string& pre, const ObjectId id, const ObjectId node ) const string UInterface::set_err( const std::string& pre, const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const
{ {
if( id == UniSetTypes::DefaultObjectId ) if( id == UniSetTypes::DefaultObjectId )
return string(pre + " DefaultObjectId"); return string(pre + " UniSetTypes::DefaultObjectId");
string nm( oind->getNameById(node) ); string nm( oind->getNameById(node) );
...@@ -1251,18 +1254,18 @@ string UInterface::set_err( const std::string& pre, const ObjectId id, const Obj ...@@ -1251,18 +1254,18 @@ string UInterface::set_err( const std::string& pre, const ObjectId id, const Obj
return s.str(); return s.str();
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
void UInterface::askThreshold( const ObjectId sid, const ThresholdId tid, void UInterface::askThreshold( const UniSetTypes::ObjectId sid, const UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd, UniversalIO::UIOCommand cmd,
long low, long hi, bool invert, long low, long hi, bool invert,
const ObjectId backid ) const const UniSetTypes::ObjectId backid ) const
{ {
askRemoteThreshold(sid, uconf->getLocalNode(), tid, cmd, low, hi, invert, backid); askRemoteThreshold(sid, uconf->getLocalNode(), tid, cmd, low, hi, invert, backid);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node, void UInterface::askRemoteThreshold( const UniSetTypes::ObjectId sid, const UniSetTypes::ObjectId node,
ThresholdId tid, UniversalIO::UIOCommand cmd, UniSetTypes::ThresholdId tid, UniversalIO::UIOCommand cmd,
long lowLimit, long hiLimit, bool invert, long lowLimit, long hiLimit, bool invert,
ObjectId backid ) const UniSetTypes::ObjectId backid ) const
{ {
if( backid == UniSetTypes::DefaultObjectId ) if( backid == UniSetTypes::DefaultObjectId )
backid = myid; backid = myid;
...@@ -1270,14 +1273,14 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node, ...@@ -1270,14 +1273,14 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node,
if( backid == UniSetTypes::DefaultObjectId ) if( backid == UniSetTypes::DefaultObjectId )
throw UniSetTypes::IOBadParam("UI(askRemoteThreshold): unknown back ID"); throw UniSetTypes::IOBadParam("UI(askRemoteThreshold): unknown back ID");
if ( sid == DefaultObjectId ) if ( sid == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(askRemoteThreshold): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(askRemoteThreshold): error: id=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(askRemoteThreshold): id='" << sid << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(askRemoteThreshold): id='" << sid << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1288,7 +1291,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node, ...@@ -1288,7 +1291,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node,
{ {
oref = rcache.resolve(sid, node); oref = rcache.resolve(sid, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for (unsigned int i = 0; i < uconf->getRepeatCount(); i++) for (unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1298,7 +1301,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node, ...@@ -1298,7 +1301,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node,
oref = resolve( sid, node ); oref = resolve( sid, node );
IONotifyController_i_var inc = IONotifyController_i::_narrow(oref); IONotifyController_i_var inc = IONotifyController_i::_narrow(oref);
ConsumerInfo_var ci; UniSetTypes::ConsumerInfo_var ci;
ci->id = backid; ci->id = backid;
ci->node = uconf->getLocalNode(); ci->node = uconf->getLocalNode();
...@@ -1324,7 +1327,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node, ...@@ -1324,7 +1327,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node,
rcache.erase(sid, node); rcache.erase(sid, node);
throw UniSetTypes::IOBadParam("UI(askThreshold): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(askThreshold): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(sid, node); rcache.erase(sid, node);
throw UniSetTypes::IOBadParam(set_err("UI(askThreshold): resolve failed ", sid, node)); throw UniSetTypes::IOBadParam(set_err("UI(askThreshold): resolve failed ", sid, node));
...@@ -1356,7 +1359,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node, ...@@ -1356,7 +1359,7 @@ void UInterface::askRemoteThreshold( const ObjectId sid, const ObjectId node,
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
IONotifyController_i::ThresholdInfo IONotifyController_i::ThresholdInfo
UInterface::getThresholdInfo( const ObjectId sid, const ThresholdId tid ) const UInterface::getThresholdInfo( const UniSetTypes::ObjectId sid, const UniSetTypes::ThresholdId tid ) const
{ {
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
si.id = sid; si.id = sid;
...@@ -1367,14 +1370,14 @@ UInterface::getThresholdInfo( const ObjectId sid, const ThresholdId tid ) const ...@@ -1367,14 +1370,14 @@ UInterface::getThresholdInfo( const ObjectId sid, const ThresholdId tid ) const
IONotifyController_i::ThresholdInfo IONotifyController_i::ThresholdInfo
UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSetTypes::ThresholdId tid ) const UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSetTypes::ThresholdId tid ) const
{ {
if ( si.id == DefaultObjectId ) if ( si.id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getThresholdInfo): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getThresholdInfo): error: id=UniSetTypes::DefaultObjectId");
if( si.node == DefaultObjectId ) if( si.node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getThresholdInfo): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getThresholdInfo): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1385,7 +1388,7 @@ UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSet ...@@ -1385,7 +1388,7 @@ UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSet
{ {
oref = rcache.resolve(si.id, si.node); oref = rcache.resolve(si.id, si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1416,7 +1419,7 @@ UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSet ...@@ -1416,7 +1419,7 @@ UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSet
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
throw UniSetTypes::IOBadParam("UI(getThresholdInfo): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getThresholdInfo): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1448,14 +1451,14 @@ UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSet ...@@ -1448,14 +1451,14 @@ UInterface::getThresholdInfo( const IOController_i::SensorInfo& si, const UniSet
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
long UInterface::getRawValue( const IOController_i::SensorInfo& si ) long UInterface::getRawValue( const IOController_i::SensorInfo& si )
{ {
if ( si.id == DefaultObjectId ) if ( si.id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getRawValue): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getRawValue): error: id=UniSetTypes::DefaultObjectId");
if( si.node == DefaultObjectId ) if( si.node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getRawValue): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getRawValue): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1466,7 +1469,7 @@ long UInterface::getRawValue( const IOController_i::SensorInfo& si ) ...@@ -1466,7 +1469,7 @@ long UInterface::getRawValue( const IOController_i::SensorInfo& si )
{ {
oref = rcache.resolve(si.id, si.node); oref = rcache.resolve(si.id, si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1497,7 +1500,7 @@ long UInterface::getRawValue( const IOController_i::SensorInfo& si ) ...@@ -1497,7 +1500,7 @@ long UInterface::getRawValue( const IOController_i::SensorInfo& si )
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
throw UniSetTypes::IOBadParam("UI(getRawValue): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getRawValue): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1537,14 +1540,14 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si, ...@@ -1537,14 +1540,14 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si,
// if( admId==UniSetTypes::DefaultObjectId ) // if( admId==UniSetTypes::DefaultObjectId )
// throw UniSetTypes::IOBadParam("UI(askTreshold): неизвестен ID администратора"); // throw UniSetTypes::IOBadParam("UI(askTreshold): неизвестен ID администратора");
if( si.id == DefaultObjectId ) if( si.id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(calibrate): error: id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(calibrate): error: id=UniSetTypes::DefaultObjectId");
if( si.node == DefaultObjectId ) if( si.node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(calibrate): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(calibrate): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1555,7 +1558,7 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si, ...@@ -1555,7 +1558,7 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si,
{ {
oref = rcache.resolve(si.id, si.node); oref = rcache.resolve(si.id, si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1587,7 +1590,7 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si, ...@@ -1587,7 +1590,7 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si,
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
throw UniSetTypes::IOBadParam("UI(calibrate): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(calibrate): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1619,14 +1622,14 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si, ...@@ -1619,14 +1622,14 @@ void UInterface::calibrate(const IOController_i::SensorInfo& si,
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i::SensorInfo& si ) IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i::SensorInfo& si )
{ {
if ( si.id == DefaultObjectId ) if ( si.id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getCalibrateInfo): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getCalibrateInfo): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId");
if( si.node == DefaultObjectId ) if( si.node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getCalibrateInfo): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getCalibrateInfo): id='" << si.id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1637,7 +1640,7 @@ IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i ...@@ -1637,7 +1640,7 @@ IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i
{ {
oref = rcache.resolve(si.id, si.node); oref = rcache.resolve(si.id, si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1668,7 +1671,7 @@ IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i ...@@ -1668,7 +1671,7 @@ IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
throw UniSetTypes::IOBadParam("UI(getCalibrateInfo): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getCalibrateInfo): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(si.id, si.node); rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1703,10 +1706,10 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I ...@@ -1703,10 +1706,10 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I
if( lst.empty() ) if( lst.empty() )
return IOController_i::SensorInfoSeq_var(); return IOController_i::SensorInfoSeq_var();
ObjectId sid = lst.getFirst(); UniSetTypes::ObjectId sid = lst.getFirst();
if ( sid == DefaultObjectId ) if ( sid == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getSensorSeq): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getSensorSeq): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId");
try try
{ {
...@@ -1716,7 +1719,7 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I ...@@ -1716,7 +1719,7 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I
{ {
oref = rcache.resolve(sid, uconf->getLocalNode()); oref = rcache.resolve(sid, uconf->getLocalNode());
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1749,7 +1752,7 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I ...@@ -1749,7 +1752,7 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I
rcache.erase(sid, uconf->getLocalNode()); rcache.erase(sid, uconf->getLocalNode());
throw UniSetTypes::IOBadParam("UI(getSensorSeq): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getSensorSeq): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(sid, uconf->getLocalNode()); rcache.erase(sid, uconf->getLocalNode());
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1780,14 +1783,14 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I ...@@ -1780,14 +1783,14 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( const UniSetTypes::I
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTypes::ObjectId sup_id ) UniSetTypes::IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTypes::ObjectId sup_id )
{ {
if( lst.length() == 0 ) if( lst.length() == 0 )
return UniSetTypes::IDSeq_var(); return UniSetTypes::IDSeq_var();
if ( lst[0].si.id == DefaultObjectId ) if ( lst[0].si.id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(setOutputSeq): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(setOutputSeq): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId");
try try
{ {
...@@ -1797,7 +1800,7 @@ IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTyp ...@@ -1797,7 +1800,7 @@ IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTyp
{ {
oref = rcache.resolve(lst[0].si.id, lst[0].si.node); oref = rcache.resolve(lst[0].si.id, lst[0].si.node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1828,7 +1831,7 @@ IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTyp ...@@ -1828,7 +1831,7 @@ IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTyp
rcache.erase(lst[0].si.id, lst[0].si.node); rcache.erase(lst[0].si.id, lst[0].si.node);
throw UniSetTypes::IOBadParam("UI(setOutputSeq): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(setOutputSeq): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(lst[0].si.id, lst[0].si.node); rcache.erase(lst[0].si.id, lst[0].si.node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1870,10 +1873,10 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst ...@@ -1870,10 +1873,10 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst
if( backid == UniSetTypes::DefaultObjectId ) if( backid == UniSetTypes::DefaultObjectId )
throw UniSetTypes::IOBadParam("UI(askSensorSeq): unknown back ID"); throw UniSetTypes::IOBadParam("UI(askSensorSeq): unknown back ID");
ObjectId sid = lst.getFirst(); UniSetTypes::ObjectId sid = lst.getFirst();
if ( sid == DefaultObjectId ) if ( sid == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(askSensorSeq): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(askSensorSeq): попытка обратиться к объекту с id=UniSetTypes::DefaultObjectId");
try try
{ {
...@@ -1883,7 +1886,7 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst ...@@ -1883,7 +1886,7 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst
{ {
oref = rcache.resolve(sid, uconf->getLocalNode()); oref = rcache.resolve(sid, uconf->getLocalNode());
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -1894,7 +1897,7 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst ...@@ -1894,7 +1897,7 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst
IONotifyController_i_var iom = IONotifyController_i::_narrow(oref); IONotifyController_i_var iom = IONotifyController_i::_narrow(oref);
ConsumerInfo_var ci; UniSetTypes::ConsumerInfo_var ci;
ci->id = backid; ci->id = backid;
ci->node = uconf->getLocalNode(); ci->node = uconf->getLocalNode();
UniSetTypes::IDSeq_var seq = lst.getIDSeq(); UniSetTypes::IDSeq_var seq = lst.getIDSeq();
...@@ -1920,7 +1923,7 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst ...@@ -1920,7 +1923,7 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst
rcache.erase(sid, uconf->getLocalNode()); rcache.erase(sid, uconf->getLocalNode());
throw UniSetTypes::IOBadParam("UI(getSensorSeq): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getSensorSeq): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(sid, uconf->getLocalNode()); rcache.erase(sid, uconf->getLocalNode());
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -1952,14 +1955,14 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst ...@@ -1952,14 +1955,14 @@ UniSetTypes::IDSeq_var UInterface::askSensorsSeq( const UniSetTypes::IDList& lst
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId id, UniSetTypes::ObjectId node ) IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId id, UniSetTypes::ObjectId node )
{ {
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getSensors): error node=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getSensors): error node=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getSensors): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getSensors): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -1970,7 +1973,7 @@ IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId ...@@ -1970,7 +1973,7 @@ IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -2001,7 +2004,7 @@ IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId ...@@ -2001,7 +2004,7 @@ IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(getSensors): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getSensors): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -2033,14 +2036,14 @@ IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId ...@@ -2033,14 +2036,14 @@ IOController_i::ShortMapSeq* UInterface::getSensors( const UniSetTypes::ObjectId
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node )
{ {
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getSensorsMap): error node=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getSensorsMap): error node=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getSensorsMap): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getSensorsMap): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -2051,7 +2054,7 @@ IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::Obj ...@@ -2051,7 +2054,7 @@ IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::Obj
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -2082,7 +2085,7 @@ IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::Obj ...@@ -2082,7 +2085,7 @@ IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::Obj
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(getSensorsMap): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getSensorsMap): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -2113,14 +2116,14 @@ IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::Obj ...@@ -2113,14 +2116,14 @@ IOController_i::SensorInfoSeq* UInterface::getSensorsMap( const UniSetTypes::Obj
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node )
{ {
if ( id == DefaultObjectId ) if ( id == UniSetTypes::DefaultObjectId )
throw ORepFailed("UI(getThresholdsList): error node=UniSetTypes::DefaultObjectId"); throw UniSetTypes::ORepFailed("UI(getThresholdsList): error node=UniSetTypes::DefaultObjectId");
if( node == DefaultObjectId ) if( node == UniSetTypes::DefaultObjectId )
{ {
ostringstream err; ostringstream err;
err << "UI(getThresholdsList): id='" << id << "' error: node=UniSetTypes::DefaultObjectId"; err << "UI(getThresholdsList): id='" << id << "' error: node=UniSetTypes::DefaultObjectId";
throw ORepFailed(err.str()); throw UniSetTypes::ORepFailed(err.str());
} }
try try
...@@ -2131,7 +2134,7 @@ IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const Un ...@@ -2131,7 +2134,7 @@ IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const Un
{ {
oref = rcache.resolve(id, node); oref = rcache.resolve(id, node);
} }
catch( const NameNotFound& ) {} catch( const UniSetTypes::NameNotFound& ) {}
for( unsigned int i = 0; i < uconf->getRepeatCount(); i++) for( unsigned int i = 0; i < uconf->getRepeatCount(); i++)
{ {
...@@ -2162,7 +2165,7 @@ IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const Un ...@@ -2162,7 +2165,7 @@ IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const Un
rcache.erase(id, node); rcache.erase(id, node);
throw UniSetTypes::IOBadParam("UI(getThresholdsList): " + string(ex.err)); throw UniSetTypes::IOBadParam("UI(getThresholdsList): " + string(ex.err));
} }
catch(const ORepFailed& ) catch(const UniSetTypes::ORepFailed& )
{ {
rcache.erase(id, node); rcache.erase(id, node);
// не смогли получить ссылку на объект // не смогли получить ссылку на объект
...@@ -2191,7 +2194,7 @@ IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const Un ...@@ -2191,7 +2194,7 @@ IONotifyController_i::ThresholdsListSeq* UInterface::getThresholdsList( const Un
throw UniSetTypes::TimeOut(set_err("UI(getThresholdsList): Timeout", id, node)); throw UniSetTypes::TimeOut(set_err("UI(getThresholdsList): Timeout", id, node));
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool UInterface::waitReady( const ObjectId id, int msec, int pmsec, const ObjectId node ) noexcept bool UInterface::waitReady( const UniSetTypes::ObjectId id, int msec, int pmsec, const UniSetTypes::ObjectId node ) noexcept
{ {
if( msec < 0 ) if( msec < 0 )
msec = 0; msec = 0;
...@@ -2228,7 +2231,7 @@ bool UInterface::waitReady( const ObjectId id, int msec, int pmsec, const Object ...@@ -2228,7 +2231,7 @@ bool UInterface::waitReady( const ObjectId id, int msec, int pmsec, const Object
return ready; return ready;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool UInterface::waitWorking( const ObjectId id, int msec, int pmsec, const ObjectId node ) noexcept bool UInterface::waitWorking( const UniSetTypes::ObjectId id, int msec, int pmsec, const UniSetTypes::ObjectId node ) noexcept
{ {
if( msec < 0 ) if( msec < 0 )
msec = 0; msec = 0;
......
...@@ -80,10 +80,11 @@ Debug::type Debug::value(string const& val) ...@@ -80,10 +80,11 @@ Debug::type Debug::value(string const& val)
break; break;
bool del = false; bool del = false;
if( tmp[0] == '-' ) if( tmp[0] == '-' )
{ {
del = true; del = true;
tmp = tmp.substr(1,tmp.size()); tmp = tmp.substr(1, tmp.size());
} }
for (int i = 0 ; i < numErrorTags ; ++i) for (int i = 0 ; i < numErrorTags ; ++i)
...@@ -128,7 +129,7 @@ void Debug::showTags(ostream& os) noexcept ...@@ -128,7 +129,7 @@ void Debug::showTags(ostream& os) noexcept
{ {
os.flush(); os.flush();
} }
catch(...){} catch(...) {}
} }
std::ostream& operator<<(std::ostream& os, Debug::type level ) noexcept std::ostream& operator<<(std::ostream& os, Debug::type level ) noexcept
...@@ -174,7 +175,7 @@ std::string Debug::str( Debug::type level ) noexcept ...@@ -174,7 +175,7 @@ std::string Debug::str( Debug::type level ) noexcept
{ {
return s.str(); return s.str();
} }
catch(...){} catch(...) {}
return ""; return "";
} }
......
...@@ -79,7 +79,7 @@ void DebugStream::sbuf_overflow( const std::string& s ) noexcept ...@@ -79,7 +79,7 @@ void DebugStream::sbuf_overflow( const std::string& s ) noexcept
{ {
s_stream.emit(s); s_stream.emit(s);
} }
catch(...){} catch(...) {}
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
DebugStream::~DebugStream() DebugStream::~DebugStream()
......
...@@ -36,13 +36,14 @@ LogServer::~LogServer() noexcept ...@@ -36,13 +36,14 @@ LogServer::~LogServer() noexcept
if( isrunning ) if( isrunning )
loop.evstop(this); loop.evstop(this);
} }
catch(...){} catch(...) {}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
LogServer::LogServer( std::shared_ptr<LogAgregator> log ): LogServer::LogServer( std::shared_ptr<LogAgregator> log ):
LogServer() LogServer()
{ {
elog = dynamic_pointer_cast<DebugStream>(log); elog = dynamic_pointer_cast<DebugStream>(log);
if( !elog ) if( !elog )
{ {
ostringstream err; ostringstream err;
...@@ -137,7 +138,7 @@ bool LogServer::check( bool restart_if_fail ) ...@@ -137,7 +138,7 @@ bool LogServer::check( bool restart_if_fail )
s.close(); s.close();
return true; return true;
} }
catch(...){} catch(...) {}
if( !restart_if_fail ) if( !restart_if_fail )
return false; return false;
...@@ -247,6 +248,7 @@ void LogServer::ioAccept( ev::io& watcher, int revents ) ...@@ -247,6 +248,7 @@ void LogServer::ioAccept( ev::io& watcher, int revents )
{ {
uniset_rwmutex_wrlock l(mutSList); uniset_rwmutex_wrlock l(mutSList);
slist.push_back(s); slist.push_back(s);
// на первой сессии запоминаем состояние логов // на первой сессии запоминаем состояние логов
if( slist.size() == 1 ) if( slist.size() == 1 )
saveDefaultLogLevels("ALL"); saveDefaultLogLevels("ALL");
......
...@@ -137,12 +137,14 @@ void LogSession::logOnEvent( const std::string& s ) noexcept ...@@ -137,12 +137,14 @@ void LogSession::logOnEvent( const std::string& s ) noexcept
if( logbuf.size() >= maxRecordsNum ) if( logbuf.size() >= maxRecordsNum )
{ {
numLostMsg++; numLostMsg++;
if( numLostMsg > maxRecordsNum ) if( numLostMsg > maxRecordsNum )
{ {
// видимо клиент отвалился или совсем не успевает читать // видимо клиент отвалился или совсем не успевает читать
// разрываем сессию.. // разрываем сессию..
if( mylog.is_info() ) if( mylog.is_info() )
mylog.info() << peername << "(LogSession::onEvent): too many lost messages. Close session.." << endl; mylog.info() << peername << "(LogSession::onEvent): too many lost messages. Close session.." << endl;
cancelled = true; cancelled = true;
} }
...@@ -160,7 +162,7 @@ void LogSession::logOnEvent( const std::string& s ) noexcept ...@@ -160,7 +162,7 @@ void LogSession::logOnEvent( const std::string& s ) noexcept
lostMsg = false; lostMsg = false;
logbuf.emplace(new UTCPCore::Buffer(s)); logbuf.emplace(new UTCPCore::Buffer(s));
} }
catch(...){} catch(...) {}
if( asyncEvent.is_active() ) if( asyncEvent.is_active() )
asyncEvent.send(); asyncEvent.send();
...@@ -238,7 +240,7 @@ void LogSession::callback( ev::io& watcher, int revents ) noexcept ...@@ -238,7 +240,7 @@ void LogSession::callback( ev::io& watcher, int revents ) noexcept
{ {
readEvent(watcher); readEvent(watcher);
} }
catch(...){} catch(...) {}
} }
if (revents & EV_WRITE) if (revents & EV_WRITE)
...@@ -247,7 +249,7 @@ void LogSession::callback( ev::io& watcher, int revents ) noexcept ...@@ -247,7 +249,7 @@ void LogSession::callback( ev::io& watcher, int revents ) noexcept
{ {
writeEvent(watcher); writeEvent(watcher);
} }
catch(...){} catch(...) {}
} }
if( cancelled.load() ) if( cancelled.load() )
...@@ -257,13 +259,14 @@ void LogSession::callback( ev::io& watcher, int revents ) noexcept ...@@ -257,13 +259,14 @@ void LogSession::callback( ev::io& watcher, int revents ) noexcept
io.stop(); io.stop();
cmdTimer.stop(); cmdTimer.stop();
try try
{ {
std::unique_lock<std::mutex> lk(logbuf_mutex); std::unique_lock<std::mutex> lk(logbuf_mutex);
asyncEvent.stop(); asyncEvent.stop();
conn.disconnect(); conn.disconnect();
} }
catch(...){} catch(...) {}
final(); final();
} }
...@@ -410,7 +413,7 @@ void LogSession::readEvent( ev::io& watcher ) noexcept ...@@ -410,7 +413,7 @@ void LogSession::readEvent( ev::io& watcher ) noexcept
if( mylog.is_warn() ) if( mylog.is_warn() )
mylog.warn() << peername << "(LogSession::readEvent): " << ex.what() << endl; mylog.warn() << peername << "(LogSession::readEvent): " << ex.what() << endl;
} }
catch(...){} catch(...) {}
#if 0 #if 0
// Выводим итоговый получившийся список (с учётом выполненных команд) // Выводим итоговый получившийся список (с учётом выполненных команд)
...@@ -604,7 +607,7 @@ void LogSession::onCheckConnectionTimer( ev::timer& watcher, int revents ) noexc ...@@ -604,7 +607,7 @@ void LogSession::onCheckConnectionTimer( ev::timer& watcher, int revents ) noexc
// //
logbuf.emplace(new UTCPCore::Buffer(" \b")); logbuf.emplace(new UTCPCore::Buffer(" \b"));
} }
catch(...){} catch(...) {}
io.set(ev::WRITE); io.set(ev::WRITE);
checkConnectionTimer.start( checkConnectionTime ); // restart timer checkConnectionTimer.start( checkConnectionTime ); // restart timer
...@@ -616,7 +619,7 @@ void LogSession::final() noexcept ...@@ -616,7 +619,7 @@ void LogSession::final() noexcept
{ {
slFin(this); slFin(this);
} }
catch(...){} catch(...) {}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void LogSession::connectFinalSession( FinalSlot sl ) noexcept void LogSession::connectFinalSession( FinalSlot sl ) noexcept
......
...@@ -43,7 +43,7 @@ std::string ObjectIndex::getBaseName( const std::string& fname ) noexcept ...@@ -43,7 +43,7 @@ std::string ObjectIndex::getBaseName( const std::string& fname ) noexcept
if( pos != string::npos ) if( pos != string::npos )
return fname.substr(pos + 1); return fname.substr(pos + 1);
} }
catch(...){} catch(...) {}
return fname; return fname;
} }
......
...@@ -56,7 +56,8 @@ ObjectId ObjectIndex_XML::getIdByName( const string& name ) const noexcept ...@@ -56,7 +56,8 @@ ObjectId ObjectIndex_XML::getIdByName( const string& name ) const noexcept
if( it != mok.end() ) if( it != mok.end() )
return it->second; return it->second;
} }
catch(...){} catch(...) {}
return DefaultObjectId; return DefaultObjectId;
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
...@@ -293,7 +294,7 @@ const ObjectInfo* ObjectIndex_XML::getObjectInfo( const std::string& name ) cons ...@@ -293,7 +294,7 @@ const ObjectInfo* ObjectIndex_XML::getObjectInfo( const std::string& name ) cons
if( it != mok.end() ) if( it != mok.end() )
return &(omap[it->second]); return &(omap[it->second]);
} }
catch(...){} catch(...) {}
return nullptr; return nullptr;
} }
......
...@@ -52,7 +52,7 @@ ObjectId ObjectIndex_idXML::getIdByName( const string& name ) const noexcept ...@@ -52,7 +52,7 @@ ObjectId ObjectIndex_idXML::getIdByName( const string& name ) const noexcept
if( it != mok.end() ) if( it != mok.end() )
return it->second; return it->second;
} }
catch(...){} catch(...) {}
return DefaultObjectId; return DefaultObjectId;
} }
...@@ -66,7 +66,8 @@ string ObjectIndex_idXML::getMapName( const ObjectId id ) const noexcept ...@@ -66,7 +66,8 @@ string ObjectIndex_idXML::getMapName( const ObjectId id ) const noexcept
if( it != omap.end() ) if( it != omap.end() )
return it->second.repName; return it->second.repName;
} }
catch(...){} catch(...) {}
return ""; return "";
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
...@@ -79,7 +80,7 @@ string ObjectIndex_idXML::getTextName( const ObjectId id ) const noexcept ...@@ -79,7 +80,7 @@ string ObjectIndex_idXML::getTextName( const ObjectId id ) const noexcept
if( it != omap.end() ) if( it != omap.end() )
return it->second.textName; return it->second.textName;
} }
catch(...){} catch(...) {}
return ""; return "";
} }
...@@ -255,7 +256,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id ) const no ...@@ -255,7 +256,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id ) const no
if( it != omap.end() ) if( it != omap.end() )
return &(it->second); return &(it->second);
} }
catch(...){} catch(...) {}
return nullptr; return nullptr;
} }
...@@ -269,7 +270,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const std::string& name ) co ...@@ -269,7 +270,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const std::string& name ) co
if( it != mok.end() ) if( it != mok.end() )
return getObjectInfo(it->second); return getObjectInfo(it->second);
} }
catch(...){} catch(...) {}
return nullptr; return nullptr;
} }
......
...@@ -101,7 +101,7 @@ void PassiveObject::processingMessage( const UniSetTypes::VoidMessage* msg ) ...@@ -101,7 +101,7 @@ void PassiveObject::processingMessage( const UniSetTypes::VoidMessage* msg )
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(processingMessage): " << ex << endl; ucrit << myname << "(processingMessage): " << ex << endl;
} }
......
...@@ -97,14 +97,14 @@ bool ProxyManager::activateObject() ...@@ -97,14 +97,14 @@ bool ProxyManager::activateObject()
{ {
ui->unregister(it.first); ui->unregister(it.first);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(unregistered): " << ex << endl; ucrit << myname << "(unregistered): " << ex << endl;
} }
} }
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(activate): " << ex << endl; ucrit << myname << "(activate): " << ex << endl;
} }
...@@ -121,7 +121,7 @@ bool ProxyManager::deactivateObject() ...@@ -121,7 +121,7 @@ bool ProxyManager::deactivateObject()
{ {
ui->unregister(it->first); ui->unregister(it->first);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(activate): " << ex << endl; ucrit << myname << "(activate): " << ex << endl;
} }
...@@ -153,7 +153,7 @@ void ProxyManager::processingMessage( const UniSetTypes::VoidMessage* msg ) ...@@ -153,7 +153,7 @@ void ProxyManager::processingMessage( const UniSetTypes::VoidMessage* msg )
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(processingMessage): " << ex << endl; ucrit << myname << "(processingMessage): " << ex << endl;
} }
...@@ -167,7 +167,7 @@ void ProxyManager::allMessage( const UniSetTypes::VoidMessage* msg ) ...@@ -167,7 +167,7 @@ void ProxyManager::allMessage( const UniSetTypes::VoidMessage* msg )
{ {
o.second->processingMessage(msg); o.second->processingMessage(msg);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(allMessage): " << ex << endl; ucrit << myname << "(allMessage): " << ex << endl;
} }
......
...@@ -962,7 +962,7 @@ void UniSetActivator::term( int signo ) ...@@ -962,7 +962,7 @@ void UniSetActivator::term( int signo )
s_term.emit(signo); s_term.emit(signo);
ulogsys << myname << "(term): sigterm() ok." << endl; ulogsys << myname << "(term): sigterm() ok." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(term): " << ex << endl; ucrit << myname << "(term): " << ex << endl;
} }
......
...@@ -206,7 +206,7 @@ bool UniSetManager::removeObject( const std::shared_ptr<UniSetObject>& obj ) ...@@ -206,7 +206,7 @@ bool UniSetManager::removeObject( const std::shared_ptr<UniSetObject>& obj )
if(obj) if(obj)
obj->deactivate(); obj->deactivate();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(removeObject): " << ex << endl; uwarn << myname << "(removeObject): " << ex << endl;
} }
...@@ -275,7 +275,7 @@ void UniSetManager::managers( OManagerCommand cmd ) ...@@ -275,7 +275,7 @@ void UniSetManager::managers( OManagerCommand cmd )
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(managers): " << ex << endl ucrit << myname << "(managers): " << ex << endl
<< " Не смог зарегистрировать (разрегистрировать) объект -->" << li->getName() << endl; << " Не смог зарегистрировать (разрегистрировать) объект -->" << li->getName() << endl;
...@@ -339,10 +339,11 @@ void UniSetManager::objects(OManagerCommand cmd) ...@@ -339,10 +339,11 @@ void UniSetManager::objects(OManagerCommand cmd)
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(objects): " << ex << endl; ucrit << myname << "(objects): " << ex << endl;
ucrit << myname << "(objects): не смог зарегистрировать (разрегистрировать) объект -->" << li->getName() << endl; ucrit << myname << "(objects): не смог зарегистрировать (разрегистрировать) объект -->" << li->getName() << endl;
if( cmd == activ ) if( cmd == activ )
std::terminate(); std::terminate();
} }
......
...@@ -277,7 +277,7 @@ void UniSetObject::registered() ...@@ -277,7 +277,7 @@ void UniSetObject::registered()
string err(myname + ": don`t registration in object reposotory"); string err(myname + ": don`t registration in object reposotory");
throw ORepFailed(err); throw ORepFailed(err);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(registered): " << ex << endl; uwarn << myname << "(registered): " << ex << endl;
string err(myname + ": don`t registration in object reposotory"); string err(myname + ": don`t registration in object reposotory");
...@@ -501,7 +501,7 @@ bool UniSetObject::deactivate() ...@@ -501,7 +501,7 @@ bool UniSetObject::deactivate()
{ {
uwarn << myname << "(deactivate): " << "поймали CORBA::Exception." << endl; uwarn << myname << "(deactivate): " << "поймали CORBA::Exception." << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(deactivate): " << ex << endl; uwarn << myname << "(deactivate): " << ex << endl;
} }
...@@ -636,7 +636,7 @@ void UniSetObject::callback() ...@@ -636,7 +636,7 @@ void UniSetObject::callback()
sleepTime = checkTimers(this); sleepTime = checkTimers(this);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(callback): " << ex << endl; ucrit << myname << "(callback): " << ex << endl;
} }
...@@ -664,7 +664,7 @@ void UniSetObject::processingMessage( const UniSetTypes::VoidMessage* msg ) ...@@ -664,7 +664,7 @@ void UniSetObject::processingMessage( const UniSetTypes::VoidMessage* msg )
break; break;
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(processingMessage): " << ex << endl; ucrit << myname << "(processingMessage): " << ex << endl;
} }
......
...@@ -83,7 +83,7 @@ void IOController::sensorsUnregistration() ...@@ -83,7 +83,7 @@ void IOController::sensorsUnregistration()
{ {
ioUnRegistration( li.second->si.id ); ioUnRegistration( li.second->si.id );
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(sensorsUnregistration): " << ex << endl; ucrit << myname << "(sensorsUnregistration): " << ex << endl;
} }
...@@ -115,7 +115,7 @@ void IOController::activateInit() ...@@ -115,7 +115,7 @@ void IOController::activateInit()
sigInit.emit(s, this); sigInit.emit(s, this);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(activateInit): " << ex << endl; ucrit << myname << "(activateInit): " << ex << endl;
} }
...@@ -420,7 +420,7 @@ void IOController::ioRegistration( std::shared_ptr<USensorInfo>& usi, bool force ...@@ -420,7 +420,7 @@ void IOController::ioRegistration( std::shared_ptr<USensorInfo>& usi, bool force
} }
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << myname << "(ioRegistration): " << ex << endl; ucrit << myname << "(ioRegistration): " << ex << endl;
} }
......
...@@ -246,7 +246,7 @@ void IONotifyController::askSensor(const UniSetTypes::ObjectId sid, ...@@ -246,7 +246,7 @@ void IONotifyController::askSensor(const UniSetTypes::ObjectId sid,
{ {
ui->send(ci.id, std::move(smsg.transport_msg()), ci.node); ui->send(ci.id, std::move(smsg.transport_msg()), ci.node);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(askSensor): " << uniset_conf()->oind->getNameById(sid) << " error: " << ex << endl; uwarn << myname << "(askSensor): " << uniset_conf()->oind->getNameById(sid) << " error: " << ex << endl;
} }
...@@ -283,7 +283,7 @@ void IONotifyController::ask( AskMap& askLst, const UniSetTypes::ObjectId sid, ...@@ -283,7 +283,7 @@ void IONotifyController::ask( AskMap& askLst, const UniSetTypes::ObjectId sid,
{ {
dumpOrdersList(sid, lst); dumpOrdersList(sid, lst);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << " не смогли сделать dump: " << ex << endl; uwarn << myname << " не смогли сделать dump: " << ex << endl;
} }
...@@ -533,7 +533,7 @@ void IONotifyController::dumpOrdersList( const UniSetTypes::ObjectId sid, ...@@ -533,7 +533,7 @@ void IONotifyController::dumpOrdersList( const UniSetTypes::ObjectId sid,
auto sinf = make_shared<NCRestorer::SInfo>( std::move(tmp) ); auto sinf = make_shared<NCRestorer::SInfo>( std::move(tmp) );
restorer->dump(this, sinf, lst); restorer->dump(this, sinf, lst);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(IONotifyController::dumpOrderList): " << ex << endl; uwarn << myname << "(IONotifyController::dumpOrderList): " << ex << endl;
} }
...@@ -551,7 +551,7 @@ void IONotifyController::dumpThresholdList( const UniSetTypes::ObjectId sid, con ...@@ -551,7 +551,7 @@ void IONotifyController::dumpThresholdList( const UniSetTypes::ObjectId sid, con
auto sinf = make_shared<NCRestorer::SInfo>( std::move(ainf) ); auto sinf = make_shared<NCRestorer::SInfo>( std::move(ainf) );
restorer->dumpThreshold(this, sinf, lst); restorer->dumpThreshold(this, sinf, lst);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(IONotifyController::dumpThresholdList): " << ex << endl; uwarn << myname << "(IONotifyController::dumpThresholdList): " << ex << endl;
} }
...@@ -609,7 +609,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp ...@@ -609,7 +609,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
{ {
dumpThresholdList(sid, tli.list); dumpThresholdList(sid, tli.list);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << " не смогли сделать dump: " << ex << endl; uwarn << myname << " не смогли сделать dump: " << ex << endl;
} }
...@@ -625,7 +625,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp ...@@ -625,7 +625,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
{ {
dumpThresholdList(sid, it->second.list); dumpThresholdList(sid, it->second.list);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(askThreshold): dump: " << ex << endl; uwarn << myname << "(askThreshold): dump: " << ex << endl;
} }
...@@ -670,7 +670,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp ...@@ -670,7 +670,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
ref->push( std::move(sm.transport_msg()) ); ref->push( std::move(sm.transport_msg()) );
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(askThreshod): " << ex << endl; uwarn << myname << "(askThreshod): " << ex << endl;
} }
...@@ -692,7 +692,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp ...@@ -692,7 +692,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
{ {
dumpThresholdList(sid, it->second.list); dumpThresholdList(sid, it->second.list);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(askThreshold): dump: " << ex << endl; uwarn << myname << "(askThreshold): dump: " << ex << endl;
} }
...@@ -943,7 +943,7 @@ IONotifyController_i::ThresholdList* IONotifyController::getThresholds( UniSetTy ...@@ -943,7 +943,7 @@ IONotifyController_i::ThresholdList* IONotifyController::getThresholds( UniSetTy
res->value = IOController::localGetValue(it->second.usi); res->value = IOController::localGetValue(it->second.usi);
res->type = it->second.type; res->type = it->second.type;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << myname << "(getThresholds): для датчика " uwarn << myname << "(getThresholds): для датчика "
<< uniset_conf()->oind->getNameById(it->second.si.id) << uniset_conf()->oind->getNameById(it->second.si.id)
......
...@@ -151,7 +151,7 @@ void NCRestorer_XML::read_list( const std::shared_ptr<UniXML>& xml, xmlNode* nod ...@@ -151,7 +151,7 @@ void NCRestorer_XML::read_list( const std::shared_ptr<UniXML>& xml, xmlNode* nod
{ {
ioRegistration(ic, uinf, true); ioRegistration(ic, uinf, true);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
uwarn << "(read_list): " << ex << endl; uwarn << "(read_list): " << ex << endl;
} }
......
...@@ -44,7 +44,7 @@ void PassiveCondTimer::terminate() noexcept ...@@ -44,7 +44,7 @@ void PassiveCondTimer::terminate() noexcept
std::unique_lock<std::mutex> lk(m_working); std::unique_lock<std::mutex> lk(m_working);
terminated = true; terminated = true;
} }
catch(...){} catch(...) {}
cv_working.notify_all(); cv_working.notify_all();
} }
...@@ -72,7 +72,7 @@ bool PassiveCondTimer::wait( timeout_t time_msec ) noexcept ...@@ -72,7 +72,7 @@ bool PassiveCondTimer::wait( timeout_t time_msec ) noexcept
terminated = true; terminated = true;
return true; return true;
} }
catch(...){} catch(...) {}
return false; return false;
} }
......
...@@ -114,17 +114,17 @@ void UniSetTimer::stop() noexcept ...@@ -114,17 +114,17 @@ void UniSetTimer::stop() noexcept
const Poco::Timespan UniSetTimer::millisecToPoco( const timeout_t msec ) noexcept const Poco::Timespan UniSetTimer::millisecToPoco( const timeout_t msec ) noexcept
{ {
if( msec == WaitUpTime ) if( msec == WaitUpTime )
return Poco::Timespan(-1,0); return Poco::Timespan(-1, 0);
// msec --> usec // msec --> usec
return Poco::Timespan( long(msec/1000), long((msec*1000)%1000000) ); return Poco::Timespan( long(msec / 1000), long((msec * 1000) % 1000000) );
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
const Poco::Timespan UniSetTimer::microsecToPoco( const timeout_t usec ) noexcept const Poco::Timespan UniSetTimer::microsecToPoco( const timeout_t usec ) noexcept
{ {
if( usec == WaitUpTime ) if( usec == WaitUpTime )
return Poco::Timespan(-1,0); return Poco::Timespan(-1, 0);
return Poco::Timespan( long(usec/1000000), long(usec%1000000) ); return Poco::Timespan( long(usec / 1000000), long(usec % 1000000) );
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -254,7 +254,7 @@ namespace UniSetTypes ...@@ -254,7 +254,7 @@ namespace UniSetTypes
oind = static_pointer_cast<ObjectIndex>(oi); oind = static_pointer_cast<ObjectIndex>(oi);
} }
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << "(Configuration:init): INIT FAILED! from " << fileConfName << endl; ucrit << "(Configuration:init): INIT FAILED! from " << fileConfName << endl;
throw; throw;
...@@ -447,7 +447,7 @@ namespace UniSetTypes ...@@ -447,7 +447,7 @@ namespace UniSetTypes
// --------------------------------------- // ---------------------------------------
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << "Configuration:" << ex << endl; ucrit << "Configuration:" << ex << endl;
throw; throw;
...@@ -1005,6 +1005,8 @@ namespace UniSetTypes ...@@ -1005,6 +1005,8 @@ namespace UniSetTypes
secServices = makeSecName(secRoot, getRepSectionName("services", xmlServicesSec)); secServices = makeSecName(secRoot, getRepSectionName("services", xmlServicesSec));
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// второй параметр намеренно передаётся и переопредеяется
// это просто такой способ вернуть и строку и указатель на узел (одним махом)
string Configuration::getRepSectionName( const string& sec, xmlNode* secnode ) string Configuration::getRepSectionName( const string& sec, xmlNode* secnode )
{ {
secnode = unixml->findNode(unixml->getFirstNode(), sec); secnode = unixml->findNode(unixml->getFirstNode(), sec);
......
...@@ -115,7 +115,7 @@ timeout_t LT_Object::checkTimers( UniSetObject* obj ) ...@@ -115,7 +115,7 @@ timeout_t LT_Object::checkTimers( UniSetObject* obj )
tmLast.reset(); tmLast.reset();
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
ucrit << "(checkTimers): " << ex << endl; ucrit << "(checkTimers): " << ex << endl;
} }
......
...@@ -141,11 +141,12 @@ void MQAtomic::setMaxSizeOfMessageQueue( size_t s ) ...@@ -141,11 +141,12 @@ void MQAtomic::setMaxSizeOfMessageQueue( size_t s )
if( s != SizeOfMessageQueue ) if( s != SizeOfMessageQueue )
{ {
SizeOfMessageQueue = s; SizeOfMessageQueue = s;
try try
{ {
mqFill(nullptr); mqFill(nullptr);
} }
catch(...){} catch(...) {}
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -68,7 +68,7 @@ VoidMessagePtr MQMutex::top() noexcept ...@@ -68,7 +68,7 @@ VoidMessagePtr MQMutex::top() noexcept
mqueue.pop_front(); mqueue.pop_front();
return m; return m;
} }
catch(...){} catch(...) {}
return nullptr; return nullptr;
} }
......
...@@ -71,7 +71,7 @@ void SMonitor::sysCommand( const SystemMessage* sm ) ...@@ -71,7 +71,7 @@ void SMonitor::sysCommand( const SystemMessage* sm )
if( it.si.id != DefaultObjectId ) if( it.si.id != DefaultObjectId )
ui->askRemoteSensor(it.si.id, UniversalIO::UIONotify, it.si.node); ui->askRemoteSensor(it.si.id, UniversalIO::UIONotify, it.si.node);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << myname << ":(askSensor): " << ex << endl; cerr << myname << ":(askSensor): " << ex << endl;
raise(SIGTERM); raise(SIGTERM);
......
...@@ -61,7 +61,7 @@ void SViewer::view() ...@@ -61,7 +61,7 @@ void SViewer::view()
{ {
readSection(csec, ""); readSection(csec, "");
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << ex << endl; cerr << ex << endl;
} }
...@@ -139,7 +139,7 @@ void SViewer::readSection( const string& section, const string& secRoot ) ...@@ -139,7 +139,7 @@ void SViewer::readSection( const string& section, const string& secRoot )
else else
getInfo(id); getInfo(id);
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cout << "(readSection): " << ex << endl; cout << "(readSection): " << ex << endl;
} }
...@@ -187,7 +187,7 @@ void SViewer::getInfo( ObjectId id ) ...@@ -187,7 +187,7 @@ void SViewer::getInfo( ObjectId id )
return; return;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cout << "(getInfo):" << ex << endl; cout << "(getInfo):" << ex << endl;
} }
...@@ -218,6 +218,7 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType ...@@ -218,6 +218,7 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType
name = ORepHelpers::getShortName(name); name = ORepHelpers::getShortName(name);
string supplier = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(amap[i].supplier)); string supplier = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(amap[i].supplier));
if( amap[i].supplier == UniSetTypes::AdminID ) if( amap[i].supplier == UniSetTypes::AdminID )
supplier = "uniset-admin"; supplier = "uniset-admin";
...@@ -242,6 +243,7 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType ...@@ -242,6 +243,7 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType
name = ORepHelpers::getShortName(name); name = ORepHelpers::getShortName(name);
string supplier = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(amap[i].supplier)); string supplier = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(amap[i].supplier));
if( amap[i].supplier == UniSetTypes::AdminID ) if( amap[i].supplier == UniSetTypes::AdminID )
supplier = "uniset-admin"; supplier = "uniset-admin";
......
...@@ -83,6 +83,7 @@ void UniXML::newDoc(const string& root_node, const string& xml_ver) ...@@ -83,6 +83,7 @@ void UniXML::newDoc(const string& root_node, const string& xml_ver)
xmlKeepBlanksDefault(0); xmlKeepBlanksDefault(0);
xmlDoc* d = xmlNewDoc((const xmlChar*)xml_ver.c_str()); xmlDoc* d = xmlNewDoc((const xmlChar*)xml_ver.c_str());
if( d == NULL ) if( d == NULL )
throw NameNotFound("UniXML(open): не смогли создать doc=" + root_node); throw NameNotFound("UniXML(open): не смогли создать doc=" + root_node);
...@@ -130,7 +131,7 @@ void UniXML::open( const string& _filename ) ...@@ -130,7 +131,7 @@ void UniXML::open( const string& _filename )
if( d == NULL ) if( d == NULL )
throw NameNotFound("UniXML(open): NotFound file=" + _filename); throw NameNotFound("UniXML(open): NotFound file=" + _filename);
doc = std::shared_ptr<xmlDoc>(d,UniXMLDocDeleter()); doc = std::shared_ptr<xmlDoc>(d, UniXMLDocDeleter());
// Support for XInclude (see eterbug #6304) // Support for XInclude (see eterbug #6304)
// main tag must to have follow property: xmlns:xi="http://www.w3.org/2001/XInclude" // main tag must to have follow property: xmlns:xi="http://www.w3.org/2001/XInclude"
...@@ -142,7 +143,7 @@ void UniXML::open( const string& _filename ) ...@@ -142,7 +143,7 @@ void UniXML::open( const string& _filename )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UniXML::close() void UniXML::close()
{ {
doc= nullptr; doc = nullptr;
filename = ""; filename = "";
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -157,10 +158,11 @@ string UniXML::getProp2(const xmlNode* node, const string& name, const string& d ...@@ -157,10 +158,11 @@ string UniXML::getProp2(const xmlNode* node, const string& name, const string& d
try try
{ {
string s(getProp(node, name)); string s(getProp(node, name));
if( !s.empty() ) if( !s.empty() )
return std::move(s); return std::move(s);
} }
catch(...){} catch(...) {}
return defval; return defval;
} }
...@@ -182,7 +184,7 @@ string UniXML::getProp(const xmlNode* node, const string& name) noexcept ...@@ -182,7 +184,7 @@ string UniXML::getProp(const xmlNode* node, const string& name) noexcept
xmlFree( (xmlChar*) text ); xmlFree( (xmlChar*) text );
return std::move(t); return std::move(t);
} }
catch(...){} catch(...) {}
xmlFree( (xmlChar*) text ); xmlFree( (xmlChar*) text );
return ""; return "";
...@@ -470,7 +472,7 @@ bool UniXML_iterator::goChildren() noexcept ...@@ -470,7 +472,7 @@ bool UniXML_iterator::goChildren() noexcept
return true; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
xmlNode*UniXML_iterator::getCurrent() noexcept xmlNode* UniXML_iterator::getCurrent() noexcept
{ {
return curNode; return curNode;
} }
...@@ -524,7 +526,7 @@ void UniXML_iterator::goEnd() noexcept ...@@ -524,7 +526,7 @@ void UniXML_iterator::goEnd() noexcept
} }
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
UniXML_iterator::operator xmlNode*() const noexcept UniXML_iterator::operator xmlNode* () const noexcept
{ {
//ulog.< "current\n"; //ulog.< "current\n";
return curNode; return curNode;
......
...@@ -95,11 +95,11 @@ int main(int argc, const char** argv) ...@@ -95,11 +95,11 @@ int main(int argc, const char** argv)
return 0; return 0;
} }
catch( const SystemError& err ) catch( const UniSetTypes::SystemError& err )
{ {
cerr << "(mq-test): " << err << endl; cerr << "(mq-test): " << err << endl;
} }
catch( const Exception& ex ) catch( const UniSetTypes::Exception& ex )
{ {
cerr << "(mq-test): " << ex << endl; cerr << "(mq-test): " << ex << endl;
} }
......
...@@ -28,11 +28,20 @@ class PtrMapHashFn ...@@ -28,11 +28,20 @@ class PtrMapHashFn
return std::hash<long>()((long)key); return std::hash<long>()((long)key);
} }
}; };
struct struct_t
{
unsigned char hour = { 0 }; /*!< часы [0..23] */
unsigned char min = { 0 }; /*!< минуты [0..59] */
unsigned char sec = { 0 }; /*!< секунды [0..59] */
unsigned char day = { 1 }; /*!< день [1..31] */
unsigned char mon = { 1 }; /*!< месяц [1..12] */
unsigned char year = { 0 }; /*!< год [0..99] */
unsigned char century = { 20 }; /*!<*/
} __attribute__((packed));
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
cerr << "2000%1000000=" << int(2000%1000000) << endl; cerr << "2000%1000000=" << int(2000 % 1000000) << endl;
return 0; return 0;
unordered_map<const long*, const long*, PtrMapHashFn> vmap; unordered_map<const long*, const long*, PtrMapHashFn> vmap;
......
...@@ -82,6 +82,7 @@ bool readlog_thread2() ...@@ -82,6 +82,7 @@ bool readlog_thread2()
while( !g_read_cancel ) while( !g_read_cancel )
lr.readlogs(ip, port); // ,LogServerTypes::cmdNOP,0,"",true); lr.readlogs(ip, port); // ,LogServerTypes::cmdNOP,0,"",true);
return true; return true;
} }
catch( std::exception& ex ) catch( std::exception& ex )
......
...@@ -30,7 +30,7 @@ bool run_test_server() ...@@ -30,7 +30,7 @@ bool run_test_server()
return true; return true;
} }
catch(...){} catch(...) {}
return false; return false;
} }
......
...@@ -24,3 +24,4 @@ Utilities/codegen/tests ...@@ -24,3 +24,4 @@ Utilities/codegen/tests
Utilities/MBTester Utilities/MBTester
Utilities/NullController Utilities/NullController
/usr/include/sigc++-2.0 /usr/include/sigc++-2.0
/usr/include/omniORB4
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