Commit 21468239 authored by Pavel Vainerman's avatar Pavel Vainerman

Вернул по ошибке удалённые изменения..

parent 89f4a590
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Name: libuniset Name: libuniset
Version: 1.0 Version: 1.0
Release: alt43 Release: alt44
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
License: GPL License: GPL
Group: Development/C++ Group: Development/C++
...@@ -207,6 +207,10 @@ rm -f %buildroot%_libdir/*.la ...@@ -207,6 +207,10 @@ rm -f %buildroot%_libdir/*.la
%changelog %changelog
* Mon Oct 03 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt44
- add nodes filter for UNet2
- minor optimization
* Thu Jul 14 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt42 * Thu Jul 14 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt42
- fixed bug in uniset-codegen - fixed bug in uniset-codegen
......
...@@ -687,7 +687,7 @@ void IOControl::readConfiguration() ...@@ -687,7 +687,7 @@ void IOControl::readConfiguration()
for( ;it.getCurrent(); it.goNext() ) for( ;it.getCurrent(); it.goNext() )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initIOItem(it); initIOItem(it);
} }
...@@ -696,29 +696,12 @@ void IOControl::readConfiguration() ...@@ -696,29 +696,12 @@ void IOControl::readConfiguration()
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool IOControl::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) bool IOControl::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initIOItem(it); initIOItem(it);
return true; return true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool IOControl::check_item( UniXML_iterator& it )
{
if( s_field.empty() )
return true;
// просто проверка на не пустой field
if( s_fvalue.empty() && it.getProp(s_field).empty() )
return false;
// просто проверка что field = value
if( !s_fvalue.empty() && it.getProp(s_field) != s_fvalue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
bool IOControl::initIOItem( UniXML_iterator& it ) bool IOControl::initIOItem( UniXML_iterator& it )
{ {
IOInfo inf; IOInfo inf;
......
...@@ -293,7 +293,6 @@ class IOControl: ...@@ -293,7 +293,6 @@ class IOControl:
// чтение файла конфигурации // чтение файла конфигурации
void readConfiguration(); void readConfiguration();
bool initIOItem( UniXML_iterator& it ); bool initIOItem( UniXML_iterator& it );
bool check_item( UniXML_iterator& it );
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ); bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec );
void buildCardsList(); void buildCardsList();
......
...@@ -1284,33 +1284,16 @@ void MBTCPMaster::readConfiguration() ...@@ -1284,33 +1284,16 @@ void MBTCPMaster::readConfiguration()
for( ;it.getCurrent(); it.goNext() ) for( ;it.getCurrent(); it.goNext() )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
} }
// readconf_ok = true; // readconf_ok = true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool MBTCPMaster::check_item( UniXML_iterator& it )
{
if( s_field.empty() )
return true;
// просто проверка на не пустой field
if( s_fvalue.empty() && it.getProp(s_field).empty() )
return false;
// просто проверка что field = value
if( !s_fvalue.empty() && it.getProp(s_field)!=s_fvalue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
bool MBTCPMaster::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) bool MBTCPMaster::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
return true; return true;
} }
......
...@@ -407,7 +407,6 @@ class MBTCPMaster: ...@@ -407,7 +407,6 @@ class MBTCPMaster:
void rtuQueryOptimization( RTUDeviceMap& m ); void rtuQueryOptimization( RTUDeviceMap& m );
void readConfiguration(); void readConfiguration();
bool check_item( UniXML_iterator& it );
bool checkProcActive(); bool checkProcActive();
void setProcActive( bool st ); void setProcActive( bool st );
......
...@@ -687,33 +687,16 @@ void MBSlave::readConfiguration() ...@@ -687,33 +687,16 @@ void MBSlave::readConfiguration()
for( ;it.getCurrent(); it.goNext() ) for( ;it.getCurrent(); it.goNext() )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
} }
// readconf_ok = true; // readconf_ok = true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool MBSlave::check_item( UniXML_iterator& it )
{
if( s_field.empty() )
return true;
// просто проверка на не пустой field
if( s_fvalue.empty() && it.getProp(s_field).empty() )
return false;
// просто проверка что field = value
if( !s_fvalue.empty() && it.getProp(s_field)!=s_fvalue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
bool MBSlave::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) bool MBSlave::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
return true; return true;
} }
......
...@@ -963,33 +963,16 @@ void RTUExchange::readConfiguration() ...@@ -963,33 +963,16 @@ void RTUExchange::readConfiguration()
for( ;it.getCurrent(); it.goNext() ) for( ;it.getCurrent(); it.goNext() )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
} }
// readconf_ok = true; // readconf_ok = true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool RTUExchange::check_item( UniXML_iterator& it )
{
if( s_field.empty() )
return true;
// просто проверка на не пустой field
if( s_fvalue.empty() && it.getProp(s_field).empty() )
return false;
// просто проверка что field = value
if( !s_fvalue.empty() && it.getProp(s_field)!=s_fvalue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
bool RTUExchange::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) bool RTUExchange::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
return true; return true;
} }
......
...@@ -233,7 +233,6 @@ class RTUExchange: ...@@ -233,7 +233,6 @@ class RTUExchange:
void rtuQueryOptimization( RTUDeviceMap& m ); void rtuQueryOptimization( RTUDeviceMap& m );
void readConfiguration(); void readConfiguration();
bool check_item( UniXML_iterator& it );
private: private:
RTUExchange(); RTUExchange();
......
...@@ -67,8 +67,8 @@ sender(0) ...@@ -67,8 +67,8 @@ sender(0)
continue; continue;
} }
// проверяем заданы ли фильтры для подсетей // проверяем фильтры для подсетей
if( !n_field.empty() && !check_filter(n_it,n_field,n_fvalue) ) if( !UniSetTypes::check_filter(n_it,n_field,n_fvalue) )
continue; continue;
// Если указано поле unet_broadcast_ip непосредственно у узла - берём его // Если указано поле unet_broadcast_ip непосредственно у узла - берём его
......
...@@ -236,30 +236,14 @@ void UNetSender::readConfiguration() ...@@ -236,30 +236,14 @@ void UNetSender::readConfiguration()
for( ;it.getCurrent(); it.goNext() ) for( ;it.getCurrent(); it.goNext() )
{ {
if( check_item(it) ) if( check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
} }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool UNetSender::check_item( UniXML_iterator& it )
{
if( s_field.empty() )
return true;
// просто проверка на не пустой field
if( s_fvalue.empty() && it.getProp(s_field).empty() )
return false;
// просто проверка что field = value
if( !s_fvalue.empty() && it.getProp(s_field)!=s_fvalue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
bool UNetSender::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) bool UNetSender::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
return true; return true;
} }
......
...@@ -76,7 +76,6 @@ class UNetSender ...@@ -76,7 +76,6 @@ class UNetSender
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ); bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec );
void readConfiguration(); void readConfiguration();
bool check_item( UniXML_iterator& it );
private: private:
UNetSender(); UNetSender();
......
...@@ -425,33 +425,16 @@ void UniExchange::readConfiguration() ...@@ -425,33 +425,16 @@ void UniExchange::readConfiguration()
for( ;it.getCurrent(); it.goNext() ) for( ;it.getCurrent(); it.goNext() )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
} }
// readconf_ok = true; // readconf_ok = true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool UniExchange::check_item( UniXML_iterator& it )
{
if( s_field.empty() )
return true;
// просто проверка на не пустой field
if( s_fvalue.empty() && it.getProp(s_field).empty() )
return false;
// просто проверка что field = value
if( !s_fvalue.empty() && it.getProp(s_field)!=s_fvalue )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
bool UniExchange::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) bool UniExchange::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
if( check_item(it) ) if( UniSetTypes::check_filter(it,s_field,s_fvalue) )
initItem(it); initItem(it);
return true; return true;
} }
......
...@@ -102,7 +102,6 @@ class UniExchange: ...@@ -102,7 +102,6 @@ class UniExchange:
NetNodeList nlst; NetNodeList nlst;
void readConfiguration(); void readConfiguration();
bool check_item( UniXML_iterator& it );
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ); bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec );
bool initItem( UniXML_iterator& it ); bool initItem( UniXML_iterator& it );
void updateLocalData(); void updateLocalData();
......
...@@ -479,18 +479,7 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node, ...@@ -479,18 +479,7 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool NCRestorer_XML::check_thresholds_item( UniXML_iterator& it ) bool NCRestorer_XML::check_thresholds_item( UniXML_iterator& it )
{ {
if( t_filterField.empty() ) return UniSetTypes::check_filter(it,t_filterField,t_filterValue);
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 ) void NCRestorer_XML::setReadThresholdItem( ReaderSlot sl )
...@@ -696,18 +685,7 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll ...@@ -696,18 +685,7 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll
bool NCRestorer_XML::check_depend_item( UniXML_iterator& it ) bool NCRestorer_XML::check_depend_item( UniXML_iterator& it )
{ {
if( d_filterField.empty() ) return UniSetTypes::check_filter(it,d_filterField,d_filterValue);
return true;
// просто проверка на не пустой field
if( d_filterValue.empty() && it.getProp(d_filterField).empty() )
return false;
// просто проверка что field = value
if( !d_filterValue.empty() && it.getProp(d_filterField)!=d_filterValue )
return false;
return true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool NCRestorer_XML::getDependsInfo( UniXML& xml, xmlNode* it, IOController::DependsInfo& di ) bool NCRestorer_XML::getDependsInfo( UniXML& xml, xmlNode* it, IOController::DependsInfo& di )
......
...@@ -171,34 +171,12 @@ bool Restorer_XML::old_getConsumerInfo( UniXML_iterator& it, ...@@ -171,34 +171,12 @@ bool Restorer_XML::old_getConsumerInfo( UniXML_iterator& it,
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool Restorer_XML::check_list_item( UniXML_iterator& it ) bool Restorer_XML::check_list_item( UniXML_iterator& it )
{ {
if( i_filterField.empty() ) return UniSetTypes::check_filter(it,i_filterField,i_filterValue);
return true;
// просто проверка на не пустой field
if( i_filterValue.empty() && it.getProp(i_filterField).empty() )
return false;
// просто проверка что field = value
if( !i_filterValue.empty() && it.getProp(i_filterField)!=i_filterValue )
return false;
return true;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool Restorer_XML::check_consumer_item( UniXML_iterator& it ) bool Restorer_XML::check_consumer_item( UniXML_iterator& it )
{ {
if( c_filterField.empty() ) return UniSetTypes::check_filter(it,c_filterField,c_filterValue);
return true;
// просто проверка на не пустой field
if( c_filterValue.empty() && it.getProp(c_filterField).empty() )
return false;
// просто проверка что field = value
if( !c_filterValue.empty() && it.getProp(c_filterField)!=c_filterValue )
return false;
return true;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
xmlNode* Restorer_XML::find_node( UniXML& xml, xmlNode* root, xmlNode* Restorer_XML::find_node( UniXML& xml, xmlNode* root,
......
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