Commit f0f93b85 authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): Небольшая оптимизация работы NCRestorer_XML, сдела так, что если заданный…

(2.0): Небольшая оптимизация работы NCRestorer_XML, сдела так, что если заданный файл совпадает (пока-что по имени) с основным конфигурационным (загружаемым Configuration), то он не открывается заново, а читается confXML.
parent ade184b6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
START=uniset-start.sh START=uniset-start.sh
${START} -f ./smemory-test --confile test.xml --dlog-add-levels level1 --localNode LocalhostNode $* ${START} -f ./smemory-test --confile ./test.xml --dlog-add-levels level1 --localNode LocalhostNode $*
#--unideb-add-levels crit,warn,info #--unideb-add-levels crit,warn,info
......
#!/bin/sh
START=uniset-start.sh
${START} -vcall ./.libs/lt-smemory-test --confile test.xml --dlog-add-levels level1 --localNode LocalhostNode $*
#--unideb-add-levels crit,warn,info
#system,level2,level8,level9
...@@ -175,7 +175,7 @@ class NCRestorer_XML: ...@@ -175,7 +175,7 @@ class NCRestorer_XML:
std::string t_filterValue; std::string t_filterValue;
std::string fname; std::string fname;
UniXML uxml; UniXML* uxml;
ReaderSlot rtslot; ReaderSlot rtslot;
NCReaderSlot ncrslot; NCReaderSlot ncrslot;
......
...@@ -53,21 +53,27 @@ c_filterField(""), ...@@ -53,21 +53,27 @@ c_filterField(""),
c_filterValue(""), c_filterValue(""),
t_filterField(""), t_filterField(""),
t_filterValue(""), t_filterValue(""),
fname(fname) fname(fname),
uxml(0)
{ {
init(fname); init(fname);
setItemFilter(f_field,f_value); setItemFilter(f_field,f_value);
} }
NCRestorer_XML::NCRestorer_XML(): NCRestorer_XML::NCRestorer_XML():
fname("") fname(""),
uxml(0)
{ {
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
NCRestorer_XML::~NCRestorer_XML() NCRestorer_XML::~NCRestorer_XML()
{ {
uxml.close(); if( uxml)
{
uxml->close();
delete uxml;
}
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void NCRestorer_XML::init( const std::string& fname ) void NCRestorer_XML::init( const std::string& fname )
...@@ -78,7 +84,10 @@ void NCRestorer_XML::init( const std::string& fname ) ...@@ -78,7 +84,10 @@ void NCRestorer_XML::init( const std::string& fname )
*/ */
try try
{ {
uxml.open(fname); if( fname == conf->getConfFileName() )
uxml = conf->getConfXML();
else
uxml = new UniXML(fname);
} }
catch(UniSetTypes::NameNotFound& ex) catch(UniSetTypes::NameNotFound& ex)
{ {
...@@ -175,11 +184,13 @@ void NCRestorer_XML::read( IONotifyController* ic, const string& fn ) ...@@ -175,11 +184,13 @@ void NCRestorer_XML::read( IONotifyController* ic, const string& fn )
// оптимизация (не загружаем второй раз xml-файл) // оптимизация (не загружаем второй раз xml-файл)
if( fname == conf->getConfFileName() && confxml ) if( fname == conf->getConfFileName() && confxml )
read( ic, *confxml ); read( ic, *confxml );
else else if( uxml && uxml->isOpen() && uxml->filename == fn )
read(ic,*uxml);
else
{ {
uxml.close(); uxml->close();
uxml.open(fname); uxml->open(fname);
read(ic,uxml); read(ic,*uxml);
} }
} }
} }
......
...@@ -42,6 +42,7 @@ c_filterValue("") ...@@ -42,6 +42,7 @@ c_filterValue("")
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
Restorer_XML::~Restorer_XML() Restorer_XML::~Restorer_XML()
{ {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Restorer_XML::setItemFilter( const string field, const string val ) void Restorer_XML::setItemFilter( const string field, const string val )
......
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