Commit f47ea61b authored by Pavel Vainerman's avatar Pavel Vainerman

(SM): сделал отдельный фильтр на пороги секции <thresholds>

parent d42fb708
......@@ -39,6 +39,8 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ):
string c_fvalue = conf->getArgParam("--c-filter-value");
string d_field = conf->getArgParam("--d-filter-field");
string d_fvalue = conf->getArgParam("--d-filter-value");
string t_field = conf->getArgParam("--t-filter-field");
string t_fvalue = conf->getArgParam("--t-filter-value");
int lock_msec = conf->getArgPInt("--lock-value-pause",0);
if( lock_msec < 0 )
......@@ -56,6 +58,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ):
rxml->setItemFilter(s_field, s_fvalue);
rxml->setConsumerFilter(c_field, c_fvalue);
rxml->setDependsFilter(d_field, d_fvalue);
rxml->setThresholdsFilter(t_field, t_fvalue);
restorer = rxml;
......
......@@ -76,7 +76,14 @@
--d-filter-field - задаёт фильтрующее поле для "зависимостей" (depends)
--d-filter-value - задаёт значение фильтрующего поля. Необязательный параметр.
\endcode
\par Фильтрование порогов (<thresholds>)
\code
--t-filter-field - задаёт фильтрующее поле для "порогов" (thresholds)
--t-filter-value - задаёт значение фильтрующего поля. Необязательный параметр.
\endcode
\note Если поле \b --X-filter-value не указано будут загружены все датчики(заказчики,зависимости)
у которых поле \b --X-filter-field не пустое.
\note Если не указывать параметры \b --X-filter-field - то в SM будут загружен ВЕСЬ список
......
......@@ -20,9 +20,7 @@
/*! \file
* \brief Интерфейс к объекту сохраняющему список заказчиков для NotifyController-ов
* \author Pavel Vainerman
* \version $Id: NCRestorer.h,v 1.17 2008/12/14 21:57:51 vpashka Exp $
* \date $Date: 2008/12/14 21:57:51 $
*/
*/
// --------------------------------------------------------------------------
#ifndef NCRestorer_H_
#define NCRestorer_H_
......@@ -153,6 +151,11 @@ class NCRestorer_XML:
*/
void setDependsFilter( const std::string filterField, const std::string filterValue="" );
/*! Установить фильтр на чтение списка 'порогов')
\note Функцию необходимо вызывать до вызова buildDependsList(...)
*/
void setThresholdsFilter( const std::string filterField, const std::string filterValue="" );
bool setFileName( const std::string& file, bool create );
inline std::string getFileName(){ return fname; }
......@@ -218,6 +221,8 @@ class NCRestorer_XML:
std::string c_filterValue;
std::string d_filterField;
std::string d_filterValue;
std::string t_filterField;
std::string t_filterValue;
std::string fname;
UniXML uxml;
......
......@@ -34,6 +34,14 @@ using namespace UniversalIO;
using namespace UniSetTypes;
// ------------------------------------------------------------------------------------------
NCRestorer_XML::NCRestorer_XML( const string fname ):
s_filterField(""),
s_filterValue(""),
c_filterField(""),
c_filterValue(""),
d_filterField(""),
d_filterValue(""),
t_filterField(""),
t_filterValue(""),
fname(fname)
{
init(fname);
......@@ -42,6 +50,14 @@ fname(fname)
NCRestorer_XML::NCRestorer_XML(const string fname,
const std::string f_field,
const std::string f_value):
s_filterField(f_field),
s_filterValue(f_value),
c_filterField(""),
c_filterValue(""),
d_filterField(""),
d_filterValue(""),
t_filterField(""),
t_filterValue(""),
fname(fname)
{
init(fname);
......@@ -468,8 +484,18 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
// ------------------------------------------------------------------------------------------
bool NCRestorer_XML::check_thresholds_item( UniXML_iterator& it )
{
// формат тот же как и <sensors>
return check_consumer_item(it);
if( t_filterField.empty() )
return true;
// просто проверка на не пустой field
if( t_filterValue.empty() && it.getProp(t_filterField).empty() )
return false;
// просто проверка что field = value
if( !t_filterValue.empty() && it.getProp(t_filterField)!=t_filterValue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
void NCRestorer_XML::setReadThresholdItem( ReaderSlot sl )
......@@ -488,6 +514,12 @@ void NCRestorer_XML::setDependsFilter( const std::string field, const std::strin
d_filterValue = val;
}
// -----------------------------------------------------------------------------
void NCRestorer_XML::setThresholdsFilter( const std::string field, const std::string val )
{
t_filterField = field;
t_filterValue = val;
}
// -----------------------------------------------------------------------------
void NCRestorer_XML::setNCReadItem( NCReaderSlot sl )
{
ncrslot = sl;
......
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