Commit 2ed382d6 authored by Pavel Vainerman's avatar Pavel Vainerman

Мелкие правки.

parent 808274cb
......@@ -2,3 +2,5 @@
gdb --batch -n -ex "thread apply all bt" $1 $2
# | ssh xxxxxx
# gcore $2
......@@ -345,18 +345,23 @@ class IOController:
inline UniSetTypes::SensorMessage makeSensorMessage()
{
UniSetTypes::SensorMessage sm;
UniSetTypes::uniset_rwmutex_rlock lock(val_lock);
sm.id = si.id;
sm.node = si.node; // uniset_conf()->getLocalNode()?
sm.sensor_type = type;
sm.value = value;
sm.undefined = undefined;
sm.priority = (UniSetTypes::Message::Priority)priority;
sm.sm_tv_sec = tv_sec;
sm.sm_tv_usec = tv_usec;
sm.ci = ci;
sm.supplier = supplier;
// лочим только изменяемые поля
{
UniSetTypes::uniset_rwmutex_rlock lock(val_lock);
sm.value = value;
sm.sm_tv_sec = tv_sec;
sm.sm_tv_usec = tv_usec;
sm.ci = ci;
sm.supplier = supplier;
sm.undefined = undefined;
}
return std::move(sm);
}
};
......
......@@ -137,8 +137,8 @@ namespace UniSetTypes
bool threshold; /*!< TRUE - сработал порог, FALSE - порог отключился */
UniSetTypes::ThresholdId tid;
SensorMessage( SensorMessage&& ) = default;
SensorMessage& operator=(SensorMessage&& ) = default;
SensorMessage( SensorMessage&& m) = default;
SensorMessage& operator=(SensorMessage&& m) = default;
SensorMessage( const SensorMessage& ) = default;
SensorMessage& operator=( const SensorMessage& ) = default;
......@@ -164,15 +164,16 @@ namespace UniSetTypes
Unknown,
StartUp, /*! начать работу */
FoldUp, /*! нет связи с главной станцией */
Finish, /*! завершить работу */
WatchDog, /*! контроль состояния */
Finish, /*! завершить работу */
WatchDog, /*! контроль состояния */
ReConfiguration, /*! обновились параметры конфигурации */
NetworkInfo, /*! обновилась информация о состоянии узлов в сети
поля
data[0] - кто
data[1] - новое состояние(true - connect, false - disconnect)
*/
LogRotate /*! переоткрыть файлы логов */
LogRotate, /*! переоткрыть файлы логов */
TheLastFieldOfCommand
};
SystemMessage( SystemMessage&& ) = default;
......@@ -229,7 +230,7 @@ namespace UniSetTypes
ConfirmMessage( const VoidMessage* msg );
ConfirmMessage(long in_sensor_id,
ConfirmMessage(ObjectId in_sensor_id,
double in_value,
time_t in_time,
time_t in_time_usec,
......@@ -241,7 +242,7 @@ namespace UniSetTypes
ConfirmMessage( const ConfirmMessage& ) = default;
ConfirmMessage& operator=( const ConfirmMessage& ) = default;
long sensor_id; /* ID датчика */
ObjectId sensor_id; /* ID датчика */
double value; /* значение датчика */
time_t time; /* время, когда датчик получил сигнал */
time_t time_usec; /* время в микросекундах */
......
......@@ -25,7 +25,7 @@ using namespace std;
// -----------------------------------------------------------------------------------------
ObjectIndex_idXML::ObjectIndex_idXML( const string& xmlfile )
{
shared_ptr<UniXML> xml = make_shared<UniXML>();
auto xml = make_shared<UniXML>();
// try
// {
xml->open(xmlfile);
......
......@@ -100,7 +100,7 @@ bool IONotifyController::addConsumer( ConsumerListInfo& lst, const ConsumerInfo&
}
catch(...) {}
lst.clst.push_front( std::move(cinf) );
lst.clst.emplace_front( std::move(cinf) );
return true;
}
// ------------------------------------------------------------------------------------------
......@@ -444,8 +444,9 @@ void IONotifyController::dumpOrdersList( const UniSetTypes::ObjectId sid,
try
{
IOController_i::SensorIOInfo ainf( getSensorIOInfo(sid) );
// делаем через tmp, т.к. у нас определён operator=
NCRestorer::SInfo tmp = ainf;
std::shared_ptr<NCRestorer::SInfo> sinf = make_shared<NCRestorer::SInfo>( std::move(tmp) );
auto sinf = make_shared<NCRestorer::SInfo>( std::move(tmp) );
restorer->dump(this, sinf, lst);
}
catch( const Exception& ex )
......@@ -463,7 +464,7 @@ void IONotifyController::dumpThresholdList( const UniSetTypes::ObjectId sid, con
try
{
IOController_i::SensorIOInfo ainf(getSensorIOInfo(sid));
shared_ptr<NCRestorer::SInfo> sinf = make_shared<NCRestorer::SInfo>(ainf);
auto sinf = make_shared<NCRestorer::SInfo>( std::move(ainf) );
restorer->dumpThreshold(this, sinf, lst);
}
catch( const Exception& ex )
......@@ -646,7 +647,7 @@ bool IONotifyController::addThreshold( ThresholdExtList& lst, ThresholdInfoExt&&
ti.tv_sec = tm.tv_sec;
ti.tv_usec = tm.tv_usec;
lst.push_back( std::move(ti) );
lst.emplace_back( std::move(ti) );
return true;
}
// --------------------------------------------------------------------------------------------------------------
......
......@@ -127,7 +127,7 @@ void NCRestorer_XML::read_list( const std::shared_ptr<UniXML>& xml, xmlNode* nod
if( !check_list_item(it) )
continue;
std::shared_ptr<NCRestorer_XML::SInfo> inf = make_shared<NCRestorer_XML::SInfo>();
auto inf = make_shared<NCRestorer_XML::SInfo>();
if( !getSensorInfo(xml, it, inf) )
{
......@@ -140,7 +140,7 @@ void NCRestorer_XML::read_list( const std::shared_ptr<UniXML>& xml, xmlNode* nod
// т.к. в функции может обновится inf
// вызываем перед регистрацией
// (потому-что в xxRegistration inf будет скопирована
std::shared_ptr<IOController::USensorInfo> uinf = std::static_pointer_cast<IOController::USensorInfo>(inf);
auto uinf = std::static_pointer_cast<IOController::USensorInfo>(inf);
ncrslot(xml, it, node, uinf);
......
......@@ -52,7 +52,7 @@ namespace UniSetTypes
//--------------------------------------------------------------------------------------------
Message::Message():
type(Unused), priority(Medium),
node(UniSetTypes::uniset_conf()->getLocalNode()),
node( UniSetTypes::uniset_conf() ? UniSetTypes::uniset_conf()->getLocalNode() : DefaultObjectId ),
supplier(DefaultObjectId),
consumer(DefaultObjectId)
{
......@@ -180,7 +180,7 @@ namespace UniSetTypes
if( c == SystemMessage::LogRotate )
return os << "LogRotate";
return os << "";
return os;
}
//--------------------------------------------------------------------------------------------
TimerMessage::TimerMessage():
......@@ -210,7 +210,7 @@ namespace UniSetTypes
assert(this->type == Message::Confirm);
}
//--------------------------------------------------------------------------------------------
ConfirmMessage::ConfirmMessage(long in_sensor_id,
ConfirmMessage::ConfirmMessage( UniSetTypes::ObjectId in_sensor_id,
double in_value,
time_t in_time,
time_t in_time_usec,
......
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