Commit e6b637c7 authored by Pavel Vainerman's avatar Pavel Vainerman

(travis-ci): added "compile matrix"

fix warning after clang and gcc compile
parent c1f75ad9
language: c++
language: cpp
# group: deprecated-2017Q4
compiler:
# - clang
- gcc
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "KrqAnUjd5+AjMOGnWvtyt0BF0BIkJMwJ0i/4X+VdI3sWYDy4rKZETh4uZLfgQmxBFHbQqCGLSdhM+Mbjt2LF/F5L1GqJELjXMYPxfiaXy2o1KJPZGYAn8Lm/FeTh2GPBkvHAOYrNpY758zKibZeTuIrr7fTiei8iRxELdtXRx/zNKyF3AacuqULrlziaQaUjJWaamwtbLuXWxJ2SsKq0cWNVwhp/SYLBvn4oZ5d6hWZWHav4mGo793nANKN4b6/0iLxOZVxBwdxE8o4bAgqs8Q+mTAeqJ19STCgq9unIMU8QvE5xu/PlR3Z1qJJRBTl3l8eiitW5y92DoJHj6AR3vit7YTTaXSD570CW+p5ZV9e+u/5s3nAZa5S1Qyk4mlEzDxDYv/3HoItC4Llqz3LqBhMHRf0i6ELBzOmsHRoWrG8ANSu5QhilepNbi73NQgp9mOoV7WtlfN/q1Vn3RCCWOb4ZIXEQPhmI9yLbDHOigzKvr2Oe/WSN5aitFBb49alaWzLsObuSVsPOnKfCBKQqqmai7O8asCIWA+FhSeKev7LKgKicK+dGF/Rwdp309MPghBXCiN5uH1AN4D350hIyvOHhC2ZrWgHqXPOjaRwo+J26oX9SFahOopZ/dfLxGyf1R3uX2Ao2AIm2gN0VSTuh41obocVE1pV8SOgF0olzRU8="
# - MAKEFLAGS="-j 2"
branches:
only:
- master
cache:
apt: true
matrix:
include:
- os: linux
# dist: precise
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8']
env:
- MATRIX_EVAL="CXX=g++-4.8 CC=gcc-4.8"
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
env:
- MATRIX_EVAL="CXX=g++-4.9 CC=gcc-4.9"
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5']
env:
- MATRIX_EVAL="CXX=g++-5 CC=gcc-5"
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6']
env:
- MATRIX_EVAL="CXX=g++-6 CC=gcc-6"
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7']
env:
- MATRIX_EVAL="CXX=g++-7 CC=gcc-7"
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-8']
env:
- MATRIX_EVAL="CXX=g++-8 CC=gcc-8"
- os: linux
compiler: clang
addons:
apt:
sources: ['llvm-toolchain-trusty-5.0']
packages: ['clang-5.0']
env:
- MATRIX_EVAL="CXX=clang++-5.0 CC=clang-5.0 COMPILER_NAME=clang"
- os: linux
compiler: clang
addons:
apt:
sources: ['llvm-toolchain-trusty-6.0', 'ubuntu-toolchain-r-test']
packages: ['clang-6.0']
env:
- MATRIX_EVAL="CXX=clang++-6.0 CC=clang-6.0 COMPILER_NAME=clang"
- os: linux
compiler: clang
addons:
apt:
sources: ['llvm-toolchain-trusty-7', 'ubuntu-toolchain-r-test']
packages: ['clang-7']
env:
- MATRIX_EVAL="CXX=clang++-7 CC=clang-7 COMPILER_NAME=clang"
# Disallowing packages: libcomedi-dev, libpoco-dev, libomniorb4-dev, libpqxx-dev, libev-dev
# If you require these packages, please review the package approval process at: https://github.com/travis-ci/apt-package-whitelist#package-approval-process
#sudo: false
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "KrqAnUjd5+AjMOGnWvtyt0BF0BIkJMwJ0i/4X+VdI3sWYDy4rKZETh4uZLfgQmxBFHbQqCGLSdhM+Mbjt2LF/F5L1GqJELjXMYPxfiaXy2o1KJPZGYAn8Lm/FeTh2GPBkvHAOYrNpY758zKibZeTuIrr7fTiei8iRxELdtXRx/zNKyF3AacuqULrlziaQaUjJWaamwtbLuXWxJ2SsKq0cWNVwhp/SYLBvn4oZ5d6hWZWHav4mGo793nANKN4b6/0iLxOZVxBwdxE8o4bAgqs8Q+mTAeqJ19STCgq9unIMU8QvE5xu/PlR3Z1qJJRBTl3l8eiitW5y92DoJHj6AR3vit7YTTaXSD570CW+p5ZV9e+u/5s3nAZa5S1Qyk4mlEzDxDYv/3HoItC4Llqz3LqBhMHRf0i6ELBzOmsHRoWrG8ANSu5QhilepNbi73NQgp9mOoV7WtlfN/q1Vn3RCCWOb4ZIXEQPhmI9yLbDHOigzKvr2Oe/WSN5aitFBb49alaWzLsObuSVsPOnKfCBKQqqmai7O8asCIWA+FhSeKev7LKgKicK+dGF/Rwdp309MPghBXCiN5uH1AN4D350hIyvOHhC2ZrWgHqXPOjaRwo+J26oX9SFahOopZ/dfLxGyf1R3uX2Ao2AIm2gN0VSTuh41obocVE1pV8SOgF0olzRU8="
before_install:
- eval "${MATRIX_EVAL}"
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8 libstdc++-4.8-dev; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
install:
# have no catch package
......@@ -35,15 +118,20 @@ install:
before_script:
- export CXXFLAGS='-pipe -O2 -pedantic -Wall'
- if [ "${COMPILER_NAME}" == "clang" ]; then export BUILD_TESTS="--disable-tests"; else export BUILD_TESTS="--enable-tests"; fi
# due broken comedi
- export CXXFLAGS="$CXXFLAGS -Wl,--unresolved-symbols=ignore-in-shared-libs"
- autoreconf -fiv
- ./configure --enable-tests --enable-mysql --enable-sqlite --enable-rrd --enable-io --disable-python --disable-mqtt --disable-pgsql --disable-api --disable-pkgchecklibev --disable-netdata --disable-logdb
- ./configure $BUILD_TESTS --enable-mysql --enable-sqlite --enable-rrd --enable-io --disable-python --disable-mqtt --disable-pgsql --disable-api --disable-netdata --disable-logdb
script:
- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then make ; fi
- if [ "${COVERITY_SCAN_BRANCH}" != "1" ]; then make ; fi
#- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then make check ; fi
notifications:
email:
recipients:
- pv@etersoft.ru
addons:
# apt:
......
......@@ -563,7 +563,7 @@ static bool commandToAll(const string& section, std::shared_ptr<ObjectRepository
}
}
}
catch( ORepFailed )
catch( const ORepFailed& ex )
{
if( !quiet )
cerr << "..ORepFailed.." << endl;
......@@ -972,7 +972,7 @@ int logRotate( const string& arg, UInterface& ui )
}
TransportMessage tm( std::move(SystemMessage(SystemMessage::LogRotate).transport_msg()) );
TransportMessage tm( SystemMessage(SystemMessage::LogRotate).transport_msg() );
ui.send(id, tm);
if( verb )
......@@ -1013,7 +1013,7 @@ int configure( const string& arg, UInterface& ui )
return 1;
}
TransportMessage tm( std::move( SystemMessage(SystemMessage::ReConfiguration).transport_msg() ));
TransportMessage tm( SystemMessage(SystemMessage::ReConfiguration).transport_msg() );
ui.send(id, tm);
if( verb )
......
......@@ -671,7 +671,7 @@ int main( int argc, char** argv )
ModbusRTU::ModbusAddr a = ModbusHelpers::autodetectSlave(&mb, beg, end, reg, fn);
cout << "autodetect modbus slave: " << ModbusRTU::addr2str(a) << endl;
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
cout << "slave not autodetect..." << endl;
}
......@@ -695,7 +695,7 @@ int main( int argc, char** argv )
cout << "autodetect: slaveaddr=" << ModbusRTU::addr2str(slaveaddr)
<< " speed=" << ComPort::getSpeed(s) << endl;
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
cout << "speed not autodetect for slaveaddr="
<< ModbusRTU::addr2str(slaveaddr) << endl;
......
......@@ -274,10 +274,10 @@
<xsl:template name="COMMON-HEAD-PROTECTED">
virtual void callback() noexcept override;
virtual void processingMessage( const uniset::VoidMessage* msg ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ){};
virtual void askSensors( UniversalIO::UIOCommand cmd ){}
virtual void sensorInfo( const uniset::SensorMessage* sm ) override{}
virtual void timerInfo( const uniset::TimerMessage* tm ) override{}
virtual void sysCommand( const uniset::SystemMessage* sm ) override {}
virtual void askSensors( UniversalIO::UIOCommand cmd ) {}
virtual void sensorInfo( const uniset::SensorMessage* sm ) override {}
virtual void timerInfo( const uniset::TimerMessage* tm ) override {}
virtual bool activateObject() override;
virtual bool deactivateObject() override;
virtual std::string getMonitInfo() const { return ""; } /*!&lt; пользовательская информация выводимая в getInfo() */
......
......@@ -55,9 +55,9 @@ namespace uniset
protected:
PassiveLProcessor(): shm(0), maxHeartBeat(0) {};
virtual void step();
virtual void getInputs();
virtual void setOuts();
virtual void step() override;
virtual void getInputs() override;
virtual void setOuts() override;
void sysCommand( const uniset::SystemMessage* msg ) override;
void sensorInfo( const uniset::SensorMessage* sm ) override;
......
......@@ -963,7 +963,7 @@ namespace uniset
{
mblog3 << myname << "(initSMValue):(IOBadParam) " << ex.err << endl;
}
catch(IONotifyController_i::BadRange )
catch(IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(initSMValue): (BadRange)..." << endl;
}
......@@ -1223,7 +1223,7 @@ namespace uniset
{
mblog3 << myname << "(updateSM):(IOBadParam) " << ex.err << endl;
}
catch( IONotifyController_i::BadRange )
catch( IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(updateSM): (BadRange)..." << endl;
}
......@@ -1261,7 +1261,7 @@ namespace uniset
{
mblog3 << myname << "(updateSM):(IOBadParam) " << ex.err << endl;
}
catch( IONotifyController_i::BadRange )
catch( IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(updateSM): (BadRange)..." << endl;
}
......@@ -1309,7 +1309,7 @@ namespace uniset
{
mblog3 << myname << "(updateSM):(IOBadParam) " << ex.err << endl;
}
catch(IONotifyController_i::BadRange )
catch(IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(updateSM): (BadRange)..." << endl;
}
......@@ -1774,7 +1774,7 @@ namespace uniset
{
mblog3 << myname << "(updateRSProperty):(IOBadParam) " << ex.err << endl;
}
catch(IONotifyController_i::BadRange )
catch(IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(updateRSProperty): (BadRange)..." << endl;
}
......@@ -2114,7 +2114,7 @@ namespace uniset
{
mblog3 << myname << "(updateMTR):(IOBadParam) " << ex.err << endl;
}
catch(IONotifyController_i::BadRange )
catch(IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(updateMTR): (BadRange)..." << endl;
}
......@@ -2181,7 +2181,7 @@ namespace uniset
{
mblog3 << myname << "(updateRTU188):(IOBadParam) " << ex.err << endl;
}
catch(IONotifyController_i::BadRange )
catch(IONotifyController_i::BadRange& ex )
{
mblog3 << myname << "(updateRTU188): (BadRange)..." << endl;
}
......@@ -3372,7 +3372,7 @@ namespace uniset
{
ostringstream s;
s << "number of calls is " << poll_count << " (poll time: " << stat_time << " sec)";
statInfo = std::move(s.str());
statInfo = s.str();
mblog9 << myname << "(stat): " << statInfo << endl;
ptStatistic.reset();
poll_count = 0;
......
......@@ -361,7 +361,7 @@ int main( int argc, char** argv )
ModbusRTU::ModbusAddr a = ModbusHelpers::autodetectSlave(mb, beg, end, reg, fn);
cout << "(mtr-setup): autodetect modbus slave: " << ModbusRTU::addr2str(a) << endl;
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
cout << "(mtr-setup): slave not autodetect..." << endl;
}
......@@ -393,7 +393,7 @@ int main( int argc, char** argv )
cout << "(mtr-setup): autodetect: slaveaddr=" << ModbusRTU::addr2str(slaveaddr)
<< " speed=" << ComPort::getSpeed(s) << endl;
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
cout << "(mtr-setup): speed not autodetect for slaveaddr="
<< ModbusRTU::addr2str(slaveaddr) << endl;
......
......@@ -599,7 +599,7 @@ namespace uniset
// -----------------------------------------------------------------------------
void SharedMemory::sendEvent( uniset::SystemMessage& sm )
{
TransportMessage tm( std::move(sm.transport_msg()) );
TransportMessage tm( sm.transport_msg() );
for( const auto& it : elst )
{
......
......@@ -294,7 +294,7 @@ namespace uniset
// если нет данных(?) просто возвращаем номер пакета
return num;
}
// -----------------------------------------------------------------------------
size_t UniSetUDP::UDPMessage::sizeOf() const noexcept
{
// биты которые не уместились в очередной байт, добавляют ещё один байт
......
......@@ -63,10 +63,11 @@ namespace uniset
size_t dcount; /*!< количество булевых величин */
size_t acount; /*!< количество аналоговых величин */
friend std::ostream& operator<<( std::ostream& os, UDPHeader& p );
friend std::ostream& operator<<( std::ostream& os, UDPHeader* p );
} __attribute__((packed));
std::ostream& operator<<( std::ostream& os, UDPHeader& p );
std::ostream& operator<<( std::ostream& os, UDPHeader* p );
const size_t MaxPacketNum = std::numeric_limits<size_t>::max();
struct UDPAData
......@@ -77,9 +78,9 @@ namespace uniset
long id;
long val;
friend std::ostream& operator<<( std::ostream& os, UDPAData& p );
} __attribute__((packed));
std::ostream& operator<<( std::ostream& os, UDPAData& p );
// Теоретический размер данных в UDP пакете (исключая заголовки) 65507
// Фактически желательно не вылезать за размер MTU (обычно 1500) - заголовки = 1432 байта
......@@ -178,10 +179,10 @@ namespace uniset
UDPAData a_dat[MaxACount]; /*!< аналоговые величины */
long d_id[MaxDCount]; /*!< список дискретных ID */
uint8_t d_dat[MaxDDataCount]; /*!< битовые значения */
friend std::ostream& operator<<( std::ostream& os, UDPMessage& p );
};
std::ostream& operator<<( std::ostream& os, UDPMessage& p );
uint16_t makeCRC( unsigned char* buf, size_t len ) noexcept;
}
// --------------------------------------------------------------------------
......
......@@ -387,7 +387,7 @@ void UNetReceiver::update() noexcept
return;
p = qpack.top();
size_t sub = labs(p.num - pnum);
size_t sub = labs( (long int)(p.num - pnum) );
if( pnum > 0 )
{
......@@ -762,7 +762,7 @@ bool UNetReceiver::receive() noexcept
return false;
}
if( rnum > 0 && labs(pack.num - rnum) > maxDifferens )
if( rnum > 0 && labs( (long int)(pack.num - rnum) ) > maxDifferens )
{
/* А что делать если мы уже ждём и ещё не "разгребли предыдущее".. а тут уже повторный "разрыв"
* Можно откинуть всё.. что сложили во временную очередь и заново "копить" (но тогда теряем информацию)
......
......@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2018-05-18+03:00
// generate timestamp: 2018-10-16+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......@@ -29,7 +29,7 @@ class UObject_SK:
public uniset::UniSetObject
{
public:
UObject_SK( uniset::ObjectId id, xmlNode* node = uniset::uniset_conf()->getNode("UObject"), const std::string& argprefix = "" );
UObject_SK( uniset::ObjectId id, xmlNode* node=uniset::uniset_conf()->getNode("UObject"), const std::string& argprefix="" );
UObject_SK();
virtual ~UObject_SK();
......@@ -43,60 +43,54 @@ class UObject_SK:
virtual bool setMsg( uniset::ObjectId code, bool state = true ) noexcept;
inline std::shared_ptr<DebugStream> log() noexcept
{
return mylog;
}
inline std::shared_ptr<uniset::LogAgregator> logAgregator() noexcept
{
return loga;
}
inline std::shared_ptr<DebugStream> log() noexcept { return mylog; }
inline std::shared_ptr<uniset::LogAgregator> logAgregator() noexcept { return loga; }
void init_dlog( std::shared_ptr<DebugStream> d ) noexcept;
// "синтаксический сахар"..для логов
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#ifndef mylogany
#define mylogany log()->any()
#endif
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#ifndef mylogany
#define mylogany log()->any()
#endif
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
// Вспомогательные функции для удобства логирования
// ------------------------------------------------------------
......@@ -113,26 +107,23 @@ class UObject_SK:
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std::string str( uniset::ObjectId id, bool showLinkName = true ) const;
std::string str( uniset::ObjectId id, bool showLinkName=true ) const;
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std::string strval( uniset::ObjectId id, bool showLinkName = true ) const;
std::string strval( uniset::ObjectId id, bool showLinkName=true ) const;
/*! Вывод в строку названия датчика-сообщения: xxx(SensorName)
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std::string msgstr( uniset::ObjectId id, bool showLinkName = true ) const;
std::string msgstr( uniset::ObjectId id, bool showLinkName=true ) const;
/*! Вывод состояния внутренних переменных */
inline std::string dumpVars()
{
return vmon.pretty_str();
}
inline std::string dumpVars(){ return vmon.pretty_str(); }
// ------------------------------------------------------------
std::string help() const noexcept;
......@@ -168,29 +159,23 @@ class UObject_SK:
virtual void callback() noexcept override;
virtual void processingMessage( const uniset::VoidMessage* msg ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) {};
virtual void sysCommand( const uniset::SystemMessage* sm ) override {}
virtual void askSensors( UniversalIO::UIOCommand cmd ) {}
virtual void sensorInfo( const uniset::SensorMessage* sm ) override {}
virtual void timerInfo( const uniset::TimerMessage* tm ) override {}
virtual bool activateObject() override;
virtual bool deactivateObject() override;
virtual std::string getMonitInfo() const
{
return ""; /*!< пользовательская информация выводимая в getInfo() */
}
virtual std::string getTypeOfMessage( int t ) const
{
return uniset::strTypeOfMessage(t); /*!< получение названия типа сообщения. Используется в getInfo() */
}
virtual std::string getMonitInfo() const { return ""; } /*!< пользовательская информация выводимая в getInfo() */
virtual std::string getTypeOfMessage( int t ) const { return uniset::strTypeOfMessage(t); } /*!< получение названия типа сообщения. Используется в getInfo() */
#ifndef DISABLE_REST_API
virtual void httpGetUserData( Poco::JSON::Object::Ptr& jdata ) {} /*!< для пользовательских данных в httpGet() */
virtual void httpGetUserData( Poco::JSON::Object::Ptr& jdata ){} /*!< для пользовательских данных в httpGet() */
virtual Poco::JSON::Object::Ptr httpDumpIO();
virtual Poco::JSON::Object::Ptr httpRequestLog( const Poco::URI::QueryParameters& p );
#endif
// Выполнение очередного шага программы
virtual void step() {}
virtual void step(){}
void preAskSensors( UniversalIO::UIOCommand cmd );
void preSysCommand( const uniset::SystemMessage* sm );
......@@ -219,15 +204,9 @@ class UObject_SK:
xmlNode* confnode;
/*! получить числовое свойство из конф. файла по привязанной confnode */
int getIntProp(const std::string& name)
{
return uniset::uniset_conf()->getIntProp(confnode, name);
}
int getIntProp(const std::string& name) { return uniset::uniset_conf()->getIntProp(confnode, name); }
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline const std::string getProp(const std::string& name)
{
return uniset::uniset_conf()->getProp(confnode, name);
}
inline const std::string getProp(const std::string& name) { return uniset::uniset_conf()->getProp(confnode, name); }
uniset::timeout_t smReadyTimeout; /*!< время ожидания готовности SM */
std::atomic_bool activated = { false };
......@@ -279,10 +258,10 @@ class UObject_SK:
}
};
std::unordered_map<const uniset::ObjectId, size_t, StatHashFn> smStat; /*!< количество сообщений по датчикам */
std::unordered_map<const uniset::ObjectId,size_t, StatHashFn> smStat; /*!< количество сообщений по датчикам */
size_t processingMessageCatchCount = { 0 }; /*!< количество исключений пойманных в processingMessage */
std::unordered_map<long, size_t> msgTypeStat; /*!< количество сообщений по типам */
std::unordered_map<long,size_t> msgTypeStat; /*!< количество сообщений по типам */
std::string ostate = { "" }; /*!< состояние процесса (выводится в getInfo()) */
......
......@@ -160,6 +160,7 @@ namespace uniset
F4( const float& f ) noexcept
{
memset(raw.v, 0, sizeof(raw.v));
raw.val = f;
}
F4( const ModbusRTU::ModbusData* data, size_t size ) noexcept
......
......@@ -24,7 +24,7 @@ int main(int argc, const char** argv)
act->run(true);
SensorMessage smsg(100, 2);
TransportMessage tm( std::move(smsg.transport_msg()) );
TransportMessage tm( smsg.transport_msg() );
size_t num = 0;
const size_t max = 100000;
......
......@@ -24,7 +24,7 @@ class TestProc:
tmLogControl
};
virtual void step();
virtual void step() override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
......
......@@ -237,7 +237,7 @@ namespace uniset
ai.ci.precision = 0;
}
return std::move(ai);
return ai;
};
//! сохранение информации об изменении состояния датчика
......@@ -411,19 +411,6 @@ namespace uniset
(invert == r.invert) );
}
operator IONotifyController_i::ThresholdInfo()
{
IONotifyController_i::ThresholdInfo r;
r.id = id;
r.hilimit = hilimit;
r.lowlimit = lowlimit;
r.invert = invert;
r.tv_sec = tv_sec;
r.tv_nsec = tv_nsec;
r.state = state;
return r;
}
UThresholdInfo( const UThresholdInfo& ) = delete;
UThresholdInfo& operator=( const UThresholdInfo& ) = delete;
UThresholdInfo( UThresholdInfo&& ) = default;
......
......@@ -93,7 +93,7 @@ namespace uniset
virtual bool removeObject( const std::shared_ptr<UniSetObject>& obj );
enum OManagerCommand { deactiv, activ, initial };
friend std::ostream& operator<<(std::ostream& os, uniset::UniSetManager::OManagerCommand& cmd );
friend std::ostream& operator<<( std::ostream& os, uniset::UniSetManager::OManagerCommand& cmd );
// работа со списком объектов
void objects(OManagerCommand cmd);
......
......@@ -24,60 +24,57 @@ namespace uniset
ModbusRTUSlaveSlot( const std::string& dev, bool use485 = false, bool tr_ctl = false );
virtual ~ModbusRTUSlaveSlot();
virtual void terminate();
virtual void terminate() override;
inline ComPort* getComPort()
{
return port;
}
ComPort* getComPort();
protected:
virtual ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
ModbusRTU::ReadCoilRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
ModbusRTU::ReadInputStatusRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
ModbusRTU::ReadOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
ModbusRTU::ReadInputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
ModbusRTU::ForceSingleCoilRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
ModbusRTU::WriteSingleOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
ModbusRTU::ForceCoilsRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
ModbusRTU::WriteOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::DiagnosticRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
ModbusRTU::MEIMessageRetRDI& reply ) override;
virtual ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
ModbusRTU::JournalCommandRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
ModbusRTU::SetDateTimeRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::RemoteServiceRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
ModbusRTU::FileTransferRetMessage& reply ) override;
private:
};
// -------------------------------------------------------------------------
// ---------------------------------------------------------------------
} // end of namespace uniset
// -------------------------------------------------------------------------
#endif // ModbusRTUSlaveSlot_H_
......
......@@ -16,9 +16,8 @@
namespace std
{
template<>
class hash<uniset::ModbusRTU::mbErrCode>
struct hash<uniset::ModbusRTU::mbErrCode>
{
public:
size_t operator()(const uniset::ModbusRTU::mbErrCode& e) const
{
return std::hash<size_t>()(e);
......
......@@ -46,7 +46,7 @@ namespace uniset
bool async_run( const std::unordered_set<ModbusRTU::ModbusAddr>& vmbaddr );
/*! остановить поток выполнения (см. run или async_run) */
virtual void terminate();
virtual void terminate() override;
virtual bool isActive() const override;
......
......@@ -23,46 +23,46 @@ namespace uniset
protected:
virtual ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
ModbusRTU::ReadCoilRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
ModbusRTU::ReadInputStatusRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
ModbusRTU::ReadOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
ModbusRTU::ReadInputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
ModbusRTU::ForceSingleCoilRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
ModbusRTU::WriteSingleOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
ModbusRTU::ForceCoilsRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
ModbusRTU::WriteOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::DiagnosticRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
ModbusRTU::MEIMessageRetRDI& reply ) override;
virtual ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
ModbusRTU::JournalCommandRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
ModbusRTU::SetDateTimeRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::RemoteServiceRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
ModbusRTU::FileTransferRetMessage& reply ) override;
private:
......
......@@ -70,53 +70,53 @@ namespace uniset
virtual void final();
virtual size_t getNextData( unsigned char* buf, int len ) override;
virtual void setChannelTimeout( timeout_t msec );
virtual void setChannelTimeout( timeout_t msec ) override;
virtual ModbusRTU::mbErrCode sendData( unsigned char* buf, int len ) override;
virtual ModbusRTU::mbErrCode tcp_processing( ModbusRTU::MBAPHeader& mhead );
virtual ModbusRTU::mbErrCode make_adu_header( ModbusRTU::ModbusMessage& request ) override;
virtual ModbusRTU::mbErrCode post_send_request(ModbusRTU::ModbusMessage& request ) override;
virtual ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
ModbusRTU::ReadCoilRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
ModbusRTU::ReadInputStatusRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
ModbusRTU::ReadOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
ModbusRTU::ReadInputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
ModbusRTU::ForceSingleCoilRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
ModbusRTU::WriteSingleOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
ModbusRTU::ForceCoilsRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
ModbusRTU::WriteOutputRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::DiagnosticRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
ModbusRTU::MEIMessageRetRDI& reply ) override;
virtual ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
ModbusRTU::JournalCommandRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
ModbusRTU::SetDateTimeRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::RemoteServiceRetMessage& reply ) override;
virtual ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
ModbusRTU::FileTransferRetMessage& reply ) override;
private:
std::queue<unsigned char> qrecv;
......@@ -144,7 +144,7 @@ namespace uniset
PassiveTimer pt;
PassiveTimer ptWait;
};
// -------------------------------------------------------------------------
// ---------------------------------------------------------------------
} // end of namespace uniset
// -------------------------------------------------------------------------
#endif // ModbusTCPSession_H_
......
......@@ -29,7 +29,7 @@ namespace uniset
const size_t BitsPerByte = 8;
typedef uint8_t ModbusAddr; /*!< адрес узла в modbus-сети */
typedef uint16_t ModbusData; /*!< размер данных в modbus-сообщениях */
const size_t BitsPerData = 16;
const uint8_t BitsPerData = 16;
typedef uint16_t ModbusCRC; /*!< размер CRC16 в modbus-сообщениях */
// ---------------------------------------------------------------------
......
......@@ -338,7 +338,7 @@ size_t ComPort::receiveBlock(unsigned char* msg, size_t len)
{
msg[k] = m_receiveByte(waiting);
}
catch(TimeOut)
catch( const uniset::TimeOut& ex )
{
break;
}
......
......@@ -454,7 +454,7 @@ namespace uniset
return recv_pdu(qfunc, rbuf, timeout);
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
// cout << "(recv): catch TimeOut " << endl;
}
......@@ -1390,7 +1390,7 @@ namespace uniset
return ex.err;
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
// cout << "(recv): catch TimeOut " << endl;
}
......
......@@ -178,9 +178,14 @@ namespace uniset
{
try
{
terminate();
ModbusRTUSlave::terminate();
}
catch(...) {}
}
// -------------------------------------------------------------------------
ComPort* ModbusRTUSlaveSlot::getComPort()
{
return port;
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -681,11 +681,11 @@ namespace uniset
return recv_pdu(rbuf, timeout);
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
// cout << "(recv): catch TimeOut " << endl;
}
catch( uniset::CommFailed )
catch( const uniset::CommFailed& ex )
{
cleanupChannel();
return erSessionClosed;
......@@ -1535,11 +1535,11 @@ namespace uniset
cleanupChannel();
return ex.err;
}
catch( uniset::TimeOut )
catch( const uniset::TimeOut& ex )
{
// cout << "(recv): catch TimeOut " << endl;
}
catch( uniset::Exception& ex ) // SystemError
catch( const uniset::Exception& ex ) // SystemError
{
if( dlog->is_crit() )
dlog->crit() << "(recv): " << ex << endl;
......
......@@ -315,10 +315,7 @@ namespace uniset
return 0;
}
}
catch( uniset::CommFailed )
{
}
catch( const uniset::CommFailed& ex ){}
if( !cancelled && dlog->is_info() )
dlog->info() << peername << "(getNextData): client disconnected" << endl;
......@@ -387,10 +384,7 @@ namespace uniset
}
while( len == 0 && !pt.checkTime() );
}
catch( uniset::CommFailed )
{
}
catch( const uniset::CommFailed& ex ){}
if( len < mhead.len )
{
......
......@@ -265,7 +265,7 @@ namespace uniset
uwarn << myname << "(registration): replace object (ObjectNameAlready)" << endl;
unregistration();
}
catch( uniset::ORepFailed )
catch( const uniset::ORepFailed& ex )
{
uwarn << myname << "(registration): don`t registration in object reposotory " << endl;
}
......
......@@ -176,7 +176,7 @@ std::ostream& DebugStream::printDate(Debug::type t, char brk) noexcept
std::time_t tv = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::tm tms = *std::localtime(&tv);
#if __GLIBCXX__ >= 20151207
#if __GNUC__ >= 5
std::ostringstream fmt;
fmt << "%Od" << brk << "%Om" << brk << "%Y";
return (*this) << std::put_time(&tms, fmt.str().c_str());
......@@ -199,7 +199,7 @@ std::ostream& DebugStream::printTime(Debug::type t, char brk) noexcept
timespec tv = uniset::now_to_timespec(); // gettimeofday(tv,0);
std::tm tms = *std::localtime(&tv.tv_sec);
#if __GLIBCXX__ >= 20151207
#if __GNUC__ >= 5
std::ostringstream fmt;
fmt << "%OH" << brk << "%OM" << brk << "%OS";
(*this) << std::put_time(&tms, fmt.str().c_str());
......@@ -229,7 +229,7 @@ std::ostream& DebugStream::printDateTime(Debug::type t) noexcept
timespec tv = uniset::now_to_timespec(); // gettimeofday(tv,0);
std::tm tms = *std::localtime(&tv.tv_sec);
#if __GLIBCXX__ >= 20151207
#if __GNUC__ >= 5
*this << std::put_time(&tms, "%Od/%Om/%Y %OH:%OM:%OS");
#else
*this << std::setw(2) << std::setfill('0') << tms.tm_mday << "/"
......
......@@ -568,7 +568,7 @@ namespace uniset
try
{
std::string ret( std::move(m_command_sig.emit(this, msg.cmd, cmdLogName)) );
std::string ret( m_command_sig.emit(this, msg.cmd, cmdLogName) );
if( !ret.empty() )
{
......
......@@ -139,7 +139,7 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
continue;
}
catch( const ORepFailed )
catch( const ORepFailed& ex )
{
string er("ObjectRepository(registrartion): (getContext) не смог зарегистрировать " + name);
throw ORepFailed(er);
......@@ -342,7 +342,7 @@ bool ObjectRepository::list( const string& section, ListObjectName* olist, size_
CORBA::ORB_var orb = uconf->getORB();
ctx = ORepHelpers::getContext(orb, section, nsName);
}
catch( const ORepFailed )
catch( const ORepFailed& ex )
{
uwarn << "ORepository(list): не смог получить ссылку на " << section << endl;
throw;
......@@ -423,7 +423,7 @@ bool ObjectRepository::isExist( const ObjectPtr& oref ) const
UniSetObject_i_var o = UniSetObject_i::_narrow(oref);
return o->exist();
}
catch( const CORBA::TRANSIENT) {}
catch( const CORBA::TRANSIENT& ) {}
catch( const CORBA::SystemException&) {}
catch( const CORBA::Exception&) {}
catch( const omniORB::fatalException& fe )
......@@ -512,13 +512,13 @@ bool ObjectRepository::createContext( const string& cname, CosNaming::NamingCont
ulogrep << "ORepFactory(createContext): создал. " << endl;
return true;
}
catch(const CosNaming::NamingContext::AlreadyBound ab)
catch(const CosNaming::NamingContext::AlreadyBound& ab)
{
// ctx->resolve(nc);
ulogrep << "ORepFactory(createContext): context " << cname << " already exist" << endl;
return true;
}
catch( const CosNaming::NamingContext::NotFound )
catch( const CosNaming::NamingContext::NotFound& ex )
{
ulogrep << "ORepFactory(createContext): NotFound " << cname << endl;
throw NameNotFound();
......@@ -569,7 +569,7 @@ void ObjectRepository::printSection( const string& fullName ) const
if( olist.empty() )
cout << fullName << " пуст!!!" << endl;
}
catch( ORepFailed )
catch( ORepFailed& ex )
{
cout << "printSection: cath exceptions ORepFailed..." << endl;
return ;
......@@ -601,7 +601,7 @@ bool ObjectRepository::removeSection( const string& fullName, bool recursive ) c
const char* const* argv(uconf->getArgv());
ctx = ORepHelpers::getContext(fullName, argc, argv, nsName);
}
catch( ORepFailed )
catch( ORepFailed& ex )
{
return false;
}
......@@ -677,7 +677,7 @@ bool ObjectRepository::removeSection( const string& fullName, bool recursive ) c
ulogrep << "ORepFactory: контекст" << fullName << " не пустой " << endl;
rem = false;
}
catch( ORepFailed )
catch( ORepFailed& ex )
{
ulogrep << "ORepFactory: не удаось получить ссылку на контекст " << in_sec << endl;
rem = false;
......@@ -716,7 +716,7 @@ bool ObjectRepository::renameSection( const string& newFName, const string& oldF
in_ctx->rebind_context(ctxNewName, ctx);
in_ctx->unbind(ctxOldName);
}
catch( ORepFailed )
catch( ORepFailed& ex )
{
return false;
}
......
......@@ -439,7 +439,7 @@ void IOController::logging( uniset::SensorMessage& sm )
}
sm.consumer = dbserverID;
TransportMessage tm(std::move(sm.transport_msg()));
TransportMessage tm(sm.transport_msg());
ui->send( sm.consumer, std::move(tm) );
isPingDBServer = true;
}
......@@ -468,7 +468,7 @@ void IOController::dumpToDB()
if ( !s->dbignore )
{
SensorMessage sm( std::move(s->makeSensorMessage()) );
SensorMessage sm( s->makeSensorMessage() );
logging(sm);
}
}
......@@ -600,7 +600,8 @@ IOController::USensorInfo::USensorInfo(IOController_i::SensorIOInfo* ai):
IOController::USensorInfo&
IOController::USensorInfo::operator=(IOController_i::SensorIOInfo& r)
{
(*this) = r;
IOController::USensorInfo tmp(r);
(*this) = std::move(tmp);
return *this;
}
// ----------------------------------------------------------------------------------------
......@@ -625,9 +626,10 @@ IOController::USensorInfo::USensorInfo(): d_value(1), d_off_value(0)
}
// ----------------------------------------------------------------------------------------
IOController::USensorInfo&
IOController::USensorInfo::operator=(IOController_i::SensorIOInfo* r)
IOController::USensorInfo::operator=( IOController_i::SensorIOInfo* r )
{
(*this) = (*r);
IOController::USensorInfo tmp(r);
(*this) = std::move(tmp);
return *this;
}
// ----------------------------------------------------------------------------------------
......@@ -650,10 +652,10 @@ void IOController::USensorInfo::setUserData( size_t index, void* data )
}
// ----------------------------------------------------------------------------------------
const IOController::USensorInfo&
IOController::USensorInfo::operator=(const IOController_i::SensorIOInfo& r)
IOController::USensorInfo::operator=( const IOController_i::SensorIOInfo& r )
{
(*this) = r;
// any=0;
IOController::USensorInfo tmp(r);
(*this) = std::move(tmp);
return *this;
}
// ----------------------------------------------------------------------------------------
......
......@@ -537,7 +537,7 @@ void IONotifyController::askSensor(const uniset::ObjectId sid,
if( lst )
{
uniset::uniset_rwmutex_rlock lock(usi->val_lock);
SensorMessage smsg( std::move(usi->makeSensorMessage(false)) );
SensorMessage smsg( usi->makeSensorMessage(false) );
send(*lst, smsg, &ci);
}
}
......@@ -620,7 +620,7 @@ long IONotifyController::localSetValue( std::shared_ptr<IOController::USensorInf
uniset::uniset_rwmutex_rlock lock(usi->val_lock);
SensorMessage sm(std::move(usi->makeSensorMessage(false)));
SensorMessage sm(usi->makeSensorMessage(false));
try
{
......@@ -833,7 +833,7 @@ void IONotifyController::askThreshold(uniset::ObjectId sid,
break;
// посылка первый раз состояния
SensorMessage sm(std::move(li->second->makeSensorMessage()));
SensorMessage sm(li->second->makeSensorMessage());
sm.consumer = ci.id;
sm.tid = tid;
......@@ -946,7 +946,7 @@ void IONotifyController::checkThreshold( std::shared_ptr<IOController::USensorIn
// обрабатываем текущее состояние датчика обязательно "залочив" значение..
uniset_rwmutex_rlock vlock(usi->val_lock);
SensorMessage sm(std::move(usi->makeSensorMessage(false)));
SensorMessage sm(usi->makeSensorMessage(false));
// текущее время
struct timespec tm = uniset::now_to_timespec();
......@@ -1177,7 +1177,7 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList()
void IONotifyController::onChangeUndefinedState( std::shared_ptr<USensorInfo>& usi, IOController* ic )
{
uniset_rwmutex_rlock vlock(usi->val_lock);
SensorMessage sm( std::move(usi->makeSensorMessage(false)) );
SensorMessage sm( usi->makeSensorMessage(false) );
try
{
......
......@@ -80,7 +80,7 @@ timeout_t LT_Object::checkTimers( UniSetObject* obj )
if( li->tmr.checkTime() )
{
// помещаем себе в очередь сообщение
TransportMessage tm( std::move(TimerMessage(li->id, li->priority, obj->getId()).transport_msg()) );
TransportMessage tm( TimerMessage(li->id, li->priority, obj->getId()).transport_msg() );
obj->push(tm);
// Проверка на количество заданных тактов
......
......@@ -87,7 +87,7 @@ void SViewer::readSection( const string& section, const string& secRoot )
cout << "(readSection): получен не полный список" << endl;
}
}
catch( ORepFailed ) {}
catch( const ORepFailed& ex ) {}
catch(...)
{
std::exception_ptr p = std::current_exception();
......@@ -112,7 +112,7 @@ void SViewer::readSection( const string& section, const string& secRoot )
if( !rep.list(secName, &lstObj, 1000) )
cout << "(readSection): получен не полный список" << endl;
}
catch( ORepFailed )
catch( const ORepFailed& ex )
{
cout << "(readSection):.. catch ORepFailed" << endl;
return;
......@@ -176,7 +176,7 @@ void SViewer::getInfo( ObjectId id )
IOController_i::SensorInfoSeq_var amap = ioc->getSensorsMap();
updateSensors(amap, id);
}
catch( IOController_i::NameNotFound ) {}
catch( const IOController_i::NameNotFound& ex ) {}
catch(...) {}
try
......@@ -184,7 +184,7 @@ void SViewer::getInfo( ObjectId id )
IONotifyController_i::ThresholdsListSeq_var tlst = ioc->getThresholdsList();
updateThresholds(tlst, id);
}
catch( IOController_i::NameNotFound ) {}
catch( const IOController_i::NameNotFound& ex ) {}
catch(...) {}
return;
......
......@@ -19,7 +19,7 @@ const size_t COUNT = 1000000; // сколько сообщений помест
void mq_write_thread()
{
SensorMessage smsg(100, 2);
TransportMessage tm( std::move(smsg.transport_msg()) );
TransportMessage tm( smsg.transport_msg() );
auto vm = make_shared<VoidMessage>(tm);
msleep(100);
......@@ -67,7 +67,7 @@ int main(int argc, const char** argv)
// сперва просто проверка что очередь работает.
{
SensorMessage sm(100, 2);
TransportMessage tm( std::move(sm.transport_msg()) );
TransportMessage tm( sm.transport_msg() );
auto vm = make_shared<VoidMessage>(tm);
mq.push(vm);
auto msg = mq.top();
......
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