Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
41efee0d
Commit
41efee0d
authored
Nov 23, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Перевёл на shared_ptr Configuration::getConfXML();
parent
020809c1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
147 additions
and
148 deletions
+147
-148
IOControl.cc
extensions/IOControl/IOControl.cc
+2
-2
IOControl.h
extensions/IOControl/IOControl.h
+1
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+2
-2
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+1
-1
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+2
-2
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+1
-1
Makefile.am
extensions/ModbusSlave/Makefile.am
+1
-1
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+3
-3
SharedMemory.h
extensions/SharedMemory/SharedMemory.h
+1
-1
smemory-plus.cc
extensions/SharedMemoryPlus/smemory-plus.cc
+1
-1
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+1
-1
UNetSender.h
extensions/UNetUDP/UNetSender.h
+1
-1
UniExchange.cc
extensions/UniNetwork/UniExchange.cc
+1
-1
UniExchange.h
extensions/UniNetwork/UniExchange.h
+1
-1
Configuration.h
include/Configuration.h
+5
-11
NCRestorer.h
include/NCRestorer.h
+13
-13
ObjectIndex_XML.h
include/ObjectIndex_XML.h
+5
-4
ObjectIndex_idXML.h
include/ObjectIndex_idXML.h
+4
-4
Restorer.h
include/Restorer.h
+5
-4
ObjectIndex_XML.cc
src/ObjectRepository/ObjectIndex_XML.cc
+17
-17
ObjectIndex_idXML.cc
src/ObjectRepository/ObjectIndex_idXML.cc
+14
-14
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+39
-39
Configuration.cc
src/Various/Configuration.cc
+24
-21
Restorer_XML.cc
src/Various/Restorer_XML.cc
+2
-2
No files found.
extensions/IOControl/IOControl.cc
View file @
41efee0d
...
@@ -670,7 +670,7 @@ void IOControl::readConfiguration()
...
@@ -670,7 +670,7 @@ void IOControl::readConfiguration()
readconf_ok
=
true
;
readconf_ok
=
true
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
IOControl
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
IOControl
::
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
initIOItem
(
it
);
initIOItem
(
it
);
...
@@ -1481,7 +1481,7 @@ void IOControl::buildCardsList()
...
@@ -1481,7 +1481,7 @@ void IOControl::buildCardsList()
return
;
return
;
}
}
const
UniXML
*
xml
=
conf
->
getConfXML
();
const
std
::
shared_ptr
<
UniXML
>
xml
=
conf
->
getConfXML
();
if
(
!
xml
)
if
(
!
xml
)
{
{
dwarn
<<
myname
<<
"(buildCardsList): xml=NULL?!"
<<
endl
;
dwarn
<<
myname
<<
"(buildCardsList): xml=NULL?!"
<<
endl
;
...
...
extensions/IOControl/IOControl.h
View file @
41efee0d
...
@@ -307,7 +307,7 @@ class IOControl:
...
@@ -307,7 +307,7 @@ class IOControl:
// чтение файла конфигурации
// чтение файла конфигурации
void
readConfiguration
();
void
readConfiguration
();
bool
initIOItem
(
UniXML_iterator
&
it
);
bool
initIOItem
(
UniXML_iterator
&
it
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
buildCardsList
();
void
buildCardsList
();
void
waitSM
();
void
waitSM
();
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
41efee0d
...
@@ -278,7 +278,7 @@ void MBExchange::readConfiguration()
...
@@ -278,7 +278,7 @@ void MBExchange::readConfiguration()
// readconf_ok = true;
// readconf_ok = true;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
MBExchange
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
MBExchange
::
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
initItem
(
it
);
initItem
(
it
);
...
@@ -2371,7 +2371,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::RSProperty& p )
...
@@ -2371,7 +2371,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::RSProperty& p )
void
MBExchange
::
initDeviceList
()
void
MBExchange
::
initDeviceList
()
{
{
xmlNode
*
respNode
=
0
;
xmlNode
*
respNode
=
0
;
const
UniXML
*
xml
=
conf
->
getConfXML
();
const
std
::
shared_ptr
<
UniXML
>
xml
=
conf
->
getConfXML
();
if
(
xml
)
if
(
xml
)
respNode
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"DeviceList"
);
respNode
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"DeviceList"
);
...
...
extensions/ModbusMaster/MBExchange.h
View file @
41efee0d
...
@@ -269,7 +269,7 @@ class MBExchange:
...
@@ -269,7 +269,7 @@ class MBExchange:
void
waitSMReady
();
void
waitSMReady
();
void
readConfiguration
();
void
readConfiguration
();
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
initItem
(
UniXML_iterator
&
it
);
bool
initItem
(
UniXML_iterator
&
it
);
void
initDeviceList
();
void
initDeviceList
();
void
initOffsetList
();
void
initOffsetList
();
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
41efee0d
...
@@ -213,7 +213,7 @@ prefix(prefix)
...
@@ -213,7 +213,7 @@ prefix(prefix)
// build file list...
// build file list...
xmlNode
*
fnode
=
0
;
xmlNode
*
fnode
=
0
;
const
UniXML
*
xml
=
conf
->
getConfXML
();
const
std
::
shared_ptr
<
UniXML
>
xml
=
conf
->
getConfXML
();
if
(
xml
)
if
(
xml
)
fnode
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"filelist"
);
fnode
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"filelist"
);
...
@@ -798,7 +798,7 @@ void MBSlave::readConfiguration()
...
@@ -798,7 +798,7 @@ void MBSlave::readConfiguration()
// readconf_ok = true;
// readconf_ok = true;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
MBSlave
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
MBSlave
::
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
initItem
(
it
);
initItem
(
it
);
...
...
extensions/ModbusSlave/MBSlave.h
View file @
41efee0d
...
@@ -389,7 +389,7 @@ class MBSlave:
...
@@ -389,7 +389,7 @@ class MBSlave:
virtual
void
initIterators
();
virtual
void
initIterators
();
bool
initItem
(
UniXML_iterator
&
it
);
bool
initItem
(
UniXML_iterator
&
it
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
readConfiguration
();
void
readConfiguration
();
bool
check_item
(
UniXML_iterator
&
it
);
bool
check_item
(
UniXML_iterator
&
it
);
...
...
extensions/ModbusSlave/Makefile.am
View file @
41efee0d
...
@@ -36,4 +36,4 @@ pkgconfig_DATA = libUniSet2MBSlave.pc
...
@@ -36,4 +36,4 @@ pkgconfig_DATA = libUniSet2MBSlave.pc
all-local
:
all-local
:
ln
-sf
../ModbusSlave/
$(devel_include_HEADERS)
../include
ln
-sf
../ModbusSlave/
$(devel_include_HEADERS)
../include
SUBDIRS
=
tests
#
SUBDIRS=tests
extensions/SharedMemory/SharedMemory.cc
View file @
41efee0d
...
@@ -324,7 +324,7 @@ void SharedMemory::checkHeartBeat()
...
@@ -324,7 +324,7 @@ void SharedMemory::checkHeartBeat()
wdt
->
ping
();
wdt
->
ping
();
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
SharedMemory
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
SharedMemory
::
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
for
(
auto
&
r
:
lstRSlot
)
for
(
auto
&
r
:
lstRSlot
)
{
{
...
@@ -508,14 +508,14 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
...
@@ -508,14 +508,14 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
{
{
dinfo
<<
myname
<<
"(buildHistoryList): ..."
<<
endl
;
dinfo
<<
myname
<<
"(buildHistoryList): ..."
<<
endl
;
const
UniXML
*
xml
=
conf
->
getConfXML
();
const
std
::
shared_ptr
<
UniXML
>
xml
=
conf
->
getConfXML
();
if
(
!
xml
)
if
(
!
xml
)
{
{
dwarn
<<
myname
<<
"(buildHistoryList): xml=NULL?!"
<<
endl
;
dwarn
<<
myname
<<
"(buildHistoryList): xml=NULL?!"
<<
endl
;
return
;
return
;
}
}
xmlNode
*
n
=
const_cast
<
UniXML
*>
(
xml
)
->
extFindNode
(
cnode
,
1
,
1
,
"History"
,
""
);
xmlNode
*
n
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"History"
,
""
);
if
(
!
n
)
if
(
!
n
)
{
{
dwarn
<<
myname
<<
"(buildHistoryList): <History> not found. ignore..."
<<
endl
;
dwarn
<<
myname
<<
"(buildHistoryList): <History> not found. ignore..."
<<
endl
;
...
...
extensions/SharedMemory/SharedMemory.h
View file @
41efee0d
...
@@ -360,7 +360,7 @@ class SharedMemory:
...
@@ -360,7 +360,7 @@ class SharedMemory:
virtual
bool
activateObject
()
override
;
virtual
bool
activateObject
()
override
;
// virtual void logging(UniSetTypes::SensorMessage& sm){}
// virtual void logging(UniSetTypes::SensorMessage& sm){}
// virtual void dumpToDB(){}
// virtual void dumpToDB(){}
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
buildEventList
(
xmlNode
*
cnode
);
void
buildEventList
(
xmlNode
*
cnode
);
void
readEventList
(
const
std
::
string
&
oname
);
void
readEventList
(
const
std
::
string
&
oname
);
...
...
extensions/SharedMemoryPlus/smemory-plus.cc
View file @
41efee0d
...
@@ -287,7 +287,7 @@ void help_print( int argc, const char* argv[] )
...
@@ -287,7 +287,7 @@ void help_print( int argc, const char* argv[] )
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
LogServer
*
run_logserver
(
const
std
::
string
&
cname
,
DebugStream
&
log
)
LogServer
*
run_logserver
(
const
std
::
string
&
cname
,
DebugStream
&
log
)
{
{
const
UniXML
*
xml
=
UniSetTypes
::
conf
->
getConfXML
();
const
std
::
shared_ptr
<
UniXML
>
xml
=
UniSetTypes
::
conf
->
getConfXML
();
xmlNode
*
cnode
=
UniSetTypes
::
conf
->
findNode
(
xml
->
getFirstNode
(),
"LogServer"
,
cname
);
xmlNode
*
cnode
=
UniSetTypes
::
conf
->
findNode
(
xml
->
getFirstNode
(),
"LogServer"
,
cname
);
if
(
cnode
==
0
)
if
(
cnode
==
0
)
{
{
...
...
extensions/UNetUDP/UNetSender.cc
View file @
41efee0d
...
@@ -232,7 +232,7 @@ void UNetSender::readConfiguration()
...
@@ -232,7 +232,7 @@ void UNetSender::readConfiguration()
}
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
UNetSender
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
UNetSender
::
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
initItem
(
it
);
initItem
(
it
);
...
...
extensions/UNetUDP/UNetSender.h
View file @
41efee0d
...
@@ -72,7 +72,7 @@ class UNetSender
...
@@ -72,7 +72,7 @@ class UNetSender
SMInterface
*
shm
;
SMInterface
*
shm
;
bool
initItem
(
UniXML_iterator
&
it
);
bool
initItem
(
UniXML_iterator
&
it
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
readConfiguration
();
void
readConfiguration
();
...
...
extensions/UniNetwork/UniExchange.cc
View file @
41efee0d
...
@@ -369,7 +369,7 @@ void UniExchange::readConfiguration()
...
@@ -369,7 +369,7 @@ void UniExchange::readConfiguration()
// readconf_ok = true;
// readconf_ok = true;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
UniExchange
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
UniExchange
::
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
if
(
UniSetTypes
::
check_filter
(
it
,
s_field
,
s_fvalue
)
)
initItem
(
it
);
initItem
(
it
);
...
...
extensions/UniNetwork/UniExchange.h
View file @
41efee0d
...
@@ -112,7 +112,7 @@ class UniExchange:
...
@@ -112,7 +112,7 @@ class UniExchange:
NetNodeList
nlst
;
NetNodeList
nlst
;
void
readConfiguration
();
void
readConfiguration
();
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
initItem
(
UniXML_iterator
&
it
);
bool
initItem
(
UniXML_iterator
&
it
);
void
updateLocalData
();
void
updateLocalData
();
void
initIterators
();
void
initIterators
();
...
...
include/Configuration.h
View file @
41efee0d
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#ifndef Configuration_H_
#ifndef Configuration_H_
#define Configuration_H_
#define Configuration_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Убрать UniXML.h, сменить unixml на указатель!!!!!!!!
#include <memory>
#include <string>
#include <string>
#include <ostream>
#include <ostream>
#include "UniXML.h"
#include "UniXML.h"
...
@@ -33,15 +33,9 @@
...
@@ -33,15 +33,9 @@
#include "ObjectIndex.h"
#include "ObjectIndex.h"
#include "IORFile.h"
#include "IORFile.h"
#include "Debug.h"
#include "Debug.h"
// --------------------------------------------------------------------------
/*
/*
В функции main нужно вызвать конструктор класса Configuration
В функции main нужно обязательно вызывать UniSetTypes::uniset_init(argc,argv);
fileConf - название файла конфигурации, который будет открываться.
Если в каталоге conf того каталога, откуда была запущена программа.
getTopDir позволяет получить каталог, откуда запущена программа.
Современный способ инициализации:
UniSetTypes::uniset_init(argc,argv);
*/
*/
namespace
UniSetTypes
namespace
UniSetTypes
{
{
...
@@ -164,7 +158,7 @@ namespace UniSetTypes
...
@@ -164,7 +158,7 @@ namespace UniSetTypes
IORFile
iorfile
;
IORFile
iorfile
;
/*! указатель на конфигурационный xml */
/*! указатель на конфигурационный xml */
inline
const
UniXML
*
getConfXML
()
const
{
return
&
unixml
;
}
inline
const
std
::
shared_ptr
<
UniXML
>
getConfXML
()
const
{
return
unixml
;
}
CORBA
::
ORB_ptr
getORB
()
const
{
return
CORBA
::
ORB
::
_duplicate
(
orb
);
}
CORBA
::
ORB_ptr
getORB
()
const
{
return
CORBA
::
ORB
::
_duplicate
(
orb
);
}
CORBA
::
PolicyList
getPolicy
()
const
{
return
policyList
;
}
CORBA
::
PolicyList
getPolicy
()
const
{
return
policyList
;
}
...
@@ -186,7 +180,7 @@ namespace UniSetTypes
...
@@ -186,7 +180,7 @@ namespace UniSetTypes
std
::
string
getPort
(
const
std
::
string
&
port
=
""
);
std
::
string
getPort
(
const
std
::
string
&
port
=
""
);
std
::
string
rootDir
;
std
::
string
rootDir
;
UniXML
unixml
;
std
::
shared_ptr
<
UniXML
>
unixml
;
int
_argc
;
int
_argc
;
const
char
*
const
*
_argv
;
const
char
*
const
*
_argv
;
...
...
include/NCRestorer.h
View file @
41efee0d
...
@@ -149,12 +149,12 @@ class NCRestorer_XML:
...
@@ -149,12 +149,12 @@ class NCRestorer_XML:
*/
*/
void
setReadThresholdItem
(
ReaderSlot
sl
);
void
setReadThresholdItem
(
ReaderSlot
sl
);
typedef
sigc
::
slot
<
bool
,
const
UniXML
&
,
UniXML_iterator
&
,
xmlNode
*
,
SInfo
&>
NCReaderSlot
;
typedef
sigc
::
slot
<
bool
,
const
std
::
shared_ptr
<
UniXML
>
&
,
UniXML_iterator
&
,
xmlNode
*
,
SInfo
&>
NCReaderSlot
;
void
setNCReadItem
(
NCReaderSlot
sl
);
void
setNCReadItem
(
NCReaderSlot
sl
);
virtual
void
read
(
IONotifyController
*
ic
,
const
std
::
string
&
filename
=
""
);
virtual
void
read
(
IONotifyController
*
ic
,
const
std
::
string
&
filename
=
""
);
virtual
void
read
(
IONotifyController
*
ic
,
const
UniXML
&
xml
);
virtual
void
read
(
IONotifyController
*
ic
,
const
std
::
shared_ptr
<
UniXML
>
&
xml
);
virtual
void
dump
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerListInfo
&
lst
);
virtual
void
dump
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerListInfo
&
lst
);
virtual
void
dumpThreshold
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
);
virtual
void
dumpThreshold
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
);
...
@@ -162,19 +162,19 @@ class NCRestorer_XML:
...
@@ -162,19 +162,19 @@ class NCRestorer_XML:
protected
:
protected
:
bool
check_thresholds_item
(
UniXML_iterator
&
it
);
bool
check_thresholds_item
(
UniXML_iterator
&
it
);
void
read_consumers
(
const
UniXML
&
xml
,
xmlNode
*
node
,
NCRestorer_XML
::
SInfo
&&
inf
,
IONotifyController
*
ic
);
void
read_consumers
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
node
,
NCRestorer_XML
::
SInfo
&&
inf
,
IONotifyController
*
ic
);
void
read_list
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
read_list
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
read_thresholds
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
read_thresholds
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
init
(
const
std
::
string
&
fname
);
void
init
(
const
std
::
string
&
fname
);
bool
getBaseInfo
(
const
UniXML
&
xml
,
xmlNode
*
it
,
IOController_i
::
SensorInfo
&
si
);
bool
getBaseInfo
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
it
,
IOController_i
::
SensorInfo
&
si
);
bool
getSensorInfo
(
const
UniXML
&
xml
,
xmlNode
*
snode
,
SInfo
&
si
);
bool
getSensorInfo
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
snode
,
SInfo
&
si
);
bool
getConsumerList
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
::
ConsumerListInfo
&
lst
);
bool
getConsumerList
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
node
,
IONotifyController
::
ConsumerListInfo
&
lst
);
bool
getThresholdInfo
(
const
UniXML
&
xml
,
xmlNode
*
tnode
,
IONotifyController
::
ThresholdInfoExt
&
ti
);
bool
getThresholdInfo
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
tnode
,
IONotifyController
::
ThresholdInfoExt
&
ti
);
static
void
set_dumptime
(
const
UniXML
&
xml
,
xmlNode
*
node
);
static
void
set_dumptime
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
node
);
static
xmlNode
*
bind_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
bind_node
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
rebind_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
rebind_node
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
std
::
string
s_filterField
;
std
::
string
s_filterField
;
std
::
string
s_filterValue
;
std
::
string
s_filterValue
;
...
@@ -184,7 +184,7 @@ class NCRestorer_XML:
...
@@ -184,7 +184,7 @@ class NCRestorer_XML:
std
::
string
t_filterValue
;
std
::
string
t_filterValue
;
std
::
string
fname
;
std
::
string
fname
;
UniXML
*
uxml
;
std
::
shared_ptr
<
UniXML
>
uxml
;
ReaderSlot
rtslot
;
ReaderSlot
rtslot
;
NCReaderSlot
ncrslot
;
NCReaderSlot
ncrslot
;
...
...
include/ObjectIndex_XML.h
View file @
41efee0d
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#define ObjectIndex_XML_H_
#define ObjectIndex_XML_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#include <map>
#include <map>
#include <memory>
#include <vector>
#include <vector>
#include <string>
#include <string>
#include "ObjectIndex.h"
#include "ObjectIndex.h"
...
@@ -38,7 +39,7 @@ class ObjectIndex_XML:
...
@@ -38,7 +39,7 @@ class ObjectIndex_XML:
{
{
public
:
public
:
ObjectIndex_XML
(
const
std
::
string
&
xmlfile
,
int
minSize
=
1000
);
ObjectIndex_XML
(
const
std
::
string
&
xmlfile
,
int
minSize
=
1000
);
ObjectIndex_XML
(
UniXML
&
xml
,
int
minSize
=
1000
);
ObjectIndex_XML
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
int
minSize
=
1000
);
virtual
~
ObjectIndex_XML
();
virtual
~
ObjectIndex_XML
();
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
ObjectId
)
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
ObjectId
)
override
;
...
@@ -51,9 +52,9 @@ class ObjectIndex_XML:
...
@@ -51,9 +52,9 @@ class ObjectIndex_XML:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_XML
&
oi
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_XML
&
oi
);
protected
:
protected
:
void
build
(
UniXML
&
xml
);
void
build
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
);
unsigned
int
read_section
(
UniXML
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
);
unsigned
int
read_section
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
);
unsigned
int
read_nodes
(
UniXML
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
);
unsigned
int
read_nodes
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
);
private
:
private
:
typedef
std
::
map
<
std
::
string
,
ObjectId
>
MapObjectKey
;
typedef
std
::
map
<
std
::
string
,
ObjectId
>
MapObjectKey
;
...
...
include/ObjectIndex_idXML.h
View file @
41efee0d
...
@@ -12,7 +12,7 @@ class ObjectIndex_idXML:
...
@@ -12,7 +12,7 @@ class ObjectIndex_idXML:
{
{
public
:
public
:
ObjectIndex_idXML
(
const
std
::
string
&
xmlfile
);
ObjectIndex_idXML
(
const
std
::
string
&
xmlfile
);
ObjectIndex_idXML
(
UniXML
&
xml
);
ObjectIndex_idXML
(
const
std
::
shared_ptr
<
UniXML
>&
xml
);
virtual
~
ObjectIndex_idXML
();
virtual
~
ObjectIndex_idXML
();
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
UniSetTypes
::
ObjectId
)
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
UniSetTypes
::
ObjectId
)
override
;
...
@@ -25,9 +25,9 @@ class ObjectIndex_idXML:
...
@@ -25,9 +25,9 @@ class ObjectIndex_idXML:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_idXML
&
oi
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_idXML
&
oi
);
protected
:
protected
:
void
build
(
UniXML
&
xml
);
void
build
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
);
void
read_section
(
UniXML
&
xml
,
const
std
::
string
&
sec
);
void
read_section
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
);
void
read_nodes
(
UniXML
&
xml
,
const
std
::
string
&
sec
);
void
read_nodes
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
);
private
:
private
:
typedef
std
::
map
<
UniSetTypes
::
ObjectId
,
UniSetTypes
::
ObjectInfo
>
MapObjects
;
typedef
std
::
map
<
UniSetTypes
::
ObjectId
,
UniSetTypes
::
ObjectInfo
>
MapObjects
;
...
...
include/Restorer.h
View file @
41efee0d
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#ifndef Restorer_H_
#ifndef Restorer_H_
#define Restorer_H_
#define Restorer_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#include <memory>
#include <sigc++/sigc++.h>
#include <sigc++/sigc++.h>
#include <string>
#include <string>
#include "UniXML.h"
#include "UniXML.h"
...
@@ -48,7 +49,7 @@ class Restorer_XML
...
@@ -48,7 +49,7 @@ class Restorer_XML
\param sec - итератор (указатель) на корневой узел секции (SubscriberList)
\param sec - итератор (указатель) на корневой узел секции (SubscriberList)
\return TRUE - если чтение параметров прошло успешно, FALSE - если нет
\return TRUE - если чтение параметров прошло успешно, FALSE - если нет
*/
*/
typedef
sigc
::
slot
<
bool
,
const
UniXML
&
,
UniXML_iterator
&
,
xmlNode
*>
ReaderSlot
;
typedef
sigc
::
slot
<
bool
,
const
std
::
shared_ptr
<
UniXML
>
&
,
UniXML_iterator
&
,
xmlNode
*>
ReaderSlot
;
/*! установить функцию для callback-вызова при чтении списка сообщений
/*! установить функцию для callback-вызова при чтении списка сообщений
For example:
For example:
...
@@ -98,12 +99,12 @@ class Restorer_XML
...
@@ -98,12 +99,12 @@ class Restorer_XML
UniSetTypes
::
ObjectId
&
cid
,
UniSetTypes
::
ObjectId
&
cnode
);
UniSetTypes
::
ObjectId
&
cid
,
UniSetTypes
::
ObjectId
&
cnode
);
/*! Функция поиска по текущему уровню (без рекурсии для дочерних узлов) */
/*! Функция поиска по текущему уровню (без рекурсии для дочерних узлов) */
static
xmlNode
*
find_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
find_node
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
protected
:
protected
:
virtual
bool
check_list_item
(
UniXML
_
iterator
&
it
);
virtual
bool
check_list_item
(
UniXML
::
iterator
&
it
);
virtual
bool
check_consumer_item
(
UniXML
_
iterator
&
it
);
virtual
bool
check_consumer_item
(
UniXML
::
iterator
&
it
);
ReaderSlot
rslot
;
ReaderSlot
rslot
;
ReaderSlot
cslot
;
ReaderSlot
cslot
;
...
...
src/ObjectRepository/ObjectIndex_XML.cc
View file @
41efee0d
...
@@ -31,16 +31,16 @@ using namespace std;
...
@@ -31,16 +31,16 @@ using namespace std;
ObjectIndex_XML
::
ObjectIndex_XML
(
const
string
&
xmlfile
,
int
minSize
)
:
ObjectIndex_XML
::
ObjectIndex_XML
(
const
string
&
xmlfile
,
int
minSize
)
:
omap
(
minSize
)
omap
(
minSize
)
{
{
UniXML
xml
;
shared_ptr
<
UniXML
>
xml
=
make_shared
<
UniXML
>
()
;
// try
// try
// {
// {
xml
.
open
(
xmlfile
);
xml
->
open
(
xmlfile
);
build
(
xml
);
build
(
xml
);
// }
// }
// catch(...){}
// catch(...){}
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
ObjectIndex_XML
::
ObjectIndex_XML
(
UniXML
&
xml
,
int
minSize
)
:
ObjectIndex_XML
::
ObjectIndex_XML
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
int
minSize
)
:
omap
(
minSize
)
omap
(
minSize
)
{
{
build
(
xml
);
build
(
xml
);
...
@@ -97,7 +97,7 @@ std::ostream& ObjectIndex_XML::printMap( std::ostream& os )
...
@@ -97,7 +97,7 @@ std::ostream& ObjectIndex_XML::printMap( std::ostream& os )
return
os
;
return
os
;
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
void
ObjectIndex_XML
::
build
(
UniXML
&
xml
)
void
ObjectIndex_XML
::
build
(
const
std
::
shared_ptr
<
UniXML
>&
xml
)
{
{
// выделяем память
// выделяем память
// ObjectInfo* omap = new ObjectInfo[maxSize];
// ObjectInfo* omap = new ObjectInfo[maxSize];
...
@@ -115,7 +115,7 @@ void ObjectIndex_XML::build(UniXML& xml)
...
@@ -115,7 +115,7 @@ void ObjectIndex_XML::build(UniXML& xml)
// omap[ind].id = ind;
// omap[ind].id = ind;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
unsigned
int
ObjectIndex_XML
::
read_section
(
UniXML
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
)
unsigned
int
ObjectIndex_XML
::
read_section
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
)
{
{
if
(
(
unsigned
)
ind
>=
omap
.
size
()
)
if
(
(
unsigned
)
ind
>=
omap
.
size
()
)
{
{
...
@@ -125,7 +125,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
...
@@ -125,7 +125,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
omap
.
resize
(
omap
.
size
()
+
100
);
omap
.
resize
(
omap
.
size
()
+
100
);
}
}
string
secRoot
=
xml
.
getProp
(
xml
.
findNode
(
xml
.
getFirstNode
(),
"RootSection"
),
"name"
);
string
secRoot
=
xml
->
getProp
(
xml
->
findNode
(
xml
->
getFirstNode
(),
"RootSection"
),
"name"
);
if
(
secRoot
.
empty
()
)
if
(
secRoot
.
empty
()
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -134,7 +134,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
...
@@ -134,7 +134,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
throw
SystemError
(
msg
.
str
());
throw
SystemError
(
msg
.
str
());
}
}
xmlNode
*
root
(
xml
.
findNode
(
xml
.
getFirstNode
(),
sec
)
);
xmlNode
*
root
(
xml
->
findNode
(
xml
->
getFirstNode
(),
sec
)
);
if
(
!
root
)
if
(
!
root
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -153,9 +153,9 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
...
@@ -153,9 +153,9 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
throw
NameNotFound
(
msg
.
str
());
throw
NameNotFound
(
msg
.
str
());
}
}
string
secname
=
xml
.
getProp
(
root
,
"section"
);
string
secname
=
xml
->
getProp
(
root
,
"section"
);
if
(
secname
.
empty
()
)
if
(
secname
.
empty
()
)
secname
=
xml
.
getProp
(
root
,
"name"
);
secname
=
xml
->
getProp
(
root
,
"name"
);
if
(
secname
.
empty
()
)
if
(
secname
.
empty
()
)
{
{
...
@@ -173,7 +173,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
...
@@ -173,7 +173,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
omap
[
ind
].
id
=
ind
;
omap
[
ind
].
id
=
ind
;
// name
// name
const
string
name
(
secname
+
xml
.
getProp
(
it
,
"name"
));
const
string
name
(
secname
+
xml
->
getProp
(
it
,
"name"
));
delete
[]
omap
[
ind
].
repName
;
delete
[]
omap
[
ind
].
repName
;
omap
[
ind
].
repName
=
new
char
[
name
.
size
()
+
1
];
omap
[
ind
].
repName
=
new
char
[
name
.
size
()
+
1
];
strcpy
(
omap
[
ind
].
repName
,
name
.
c_str
()
);
strcpy
(
omap
[
ind
].
repName
,
name
.
c_str
()
);
...
@@ -182,9 +182,9 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
...
@@ -182,9 +182,9 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
mok
[
name
]
=
ind
;
// mok[omap[ind].repName] = ind;
mok
[
name
]
=
ind
;
// mok[omap[ind].repName] = ind;
// textname
// textname
string
textname
(
xml
.
getProp
(
it
,
"textname"
));
string
textname
(
xml
->
getProp
(
it
,
"textname"
));
if
(
textname
.
empty
()
)
if
(
textname
.
empty
()
)
textname
=
xml
.
getProp
(
it
,
"name"
);
textname
=
xml
->
getProp
(
it
,
"name"
);
delete
[]
omap
[
ind
].
textName
;
delete
[]
omap
[
ind
].
textName
;
omap
[
ind
].
textName
=
new
char
[
textname
.
size
()
+
1
];
omap
[
ind
].
textName
=
new
char
[
textname
.
size
()
+
1
];
...
@@ -207,7 +207,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
...
@@ -207,7 +207,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string& sec,
return
ind
;
return
ind
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
unsigned
int
ObjectIndex_XML
::
read_nodes
(
UniXML
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
)
unsigned
int
ObjectIndex_XML
::
read_nodes
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
,
unsigned
int
ind
)
{
{
if
(
ind
>=
omap
.
size
()
)
if
(
ind
>=
omap
.
size
()
)
{
{
...
@@ -217,7 +217,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
...
@@ -217,7 +217,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
omap
.
resize
(
omap
.
size
()
+
100
);
omap
.
resize
(
omap
.
size
()
+
100
);
}
}
xmlNode
*
root
(
xml
.
findNode
(
xml
.
getFirstNode
(),
sec
)
);
xmlNode
*
root
(
xml
->
findNode
(
xml
->
getFirstNode
(),
sec
)
);
if
(
!
root
)
if
(
!
root
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -234,19 +234,19 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
...
@@ -234,19 +234,19 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
throw
NameNotFound
(
msg
.
str
());
throw
NameNotFound
(
msg
.
str
());
}
}
// string secname = xml
.
getProp(root,"section");
// string secname = xml
->
getProp(root,"section");
for
(
;
it
.
getCurrent
();
it
.
goNext
()
)
for
(
;
it
.
getCurrent
();
it
.
goNext
()
)
{
{
omap
[
ind
].
id
=
ind
;
omap
[
ind
].
id
=
ind
;
string
nodename
(
xml
.
getProp
(
it
,
"name"
));
string
nodename
(
xml
->
getProp
(
it
,
"name"
));
delete
[]
omap
[
ind
].
repName
;
delete
[]
omap
[
ind
].
repName
;
omap
[
ind
].
repName
=
new
char
[
nodename
.
size
()
+
1
];
omap
[
ind
].
repName
=
new
char
[
nodename
.
size
()
+
1
];
strcpy
(
omap
[
ind
].
repName
,
nodename
.
c_str
()
);
strcpy
(
omap
[
ind
].
repName
,
nodename
.
c_str
()
);
// textname
// textname
string
textname
(
xml
.
getProp
(
it
,
"textname"
));
string
textname
(
xml
->
getProp
(
it
,
"textname"
));
if
(
textname
.
empty
()
)
if
(
textname
.
empty
()
)
textname
=
nodename
;
textname
=
nodename
;
...
...
src/ObjectRepository/ObjectIndex_idXML.cc
View file @
41efee0d
...
@@ -10,16 +10,16 @@ using namespace std;
...
@@ -10,16 +10,16 @@ using namespace std;
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
ObjectIndex_idXML
::
ObjectIndex_idXML
(
const
string
&
xmlfile
)
ObjectIndex_idXML
::
ObjectIndex_idXML
(
const
string
&
xmlfile
)
{
{
UniXML
xml
;
shared_ptr
<
UniXML
>
xml
=
make_shared
<
UniXML
>
()
;
// try
// try
// {
// {
xml
.
open
(
xmlfile
);
xml
->
open
(
xmlfile
);
build
(
xml
);
build
(
xml
);
// }
// }
// catch(...){}
// catch(...){}
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
ObjectIndex_idXML
::
ObjectIndex_idXML
(
UniXML
&
xml
)
ObjectIndex_idXML
::
ObjectIndex_idXML
(
const
shared_ptr
<
UniXML
>
&
xml
)
{
{
build
(
xml
);
build
(
xml
);
}
}
...
@@ -77,7 +77,7 @@ std::ostream& ObjectIndex_idXML::printMap( std::ostream& os )
...
@@ -77,7 +77,7 @@ std::ostream& ObjectIndex_idXML::printMap( std::ostream& os )
return
os
;
return
os
;
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
void
ObjectIndex_idXML
::
build
(
UniXML
&
xml
)
void
ObjectIndex_idXML
::
build
(
const
shared_ptr
<
UniXML
>&
xml
)
{
{
read_section
(
xml
,
"sensors"
);
read_section
(
xml
,
"sensors"
);
read_section
(
xml
,
"objects"
);
read_section
(
xml
,
"objects"
);
...
@@ -86,9 +86,9 @@ void ObjectIndex_idXML::build(UniXML& xml)
...
@@ -86,9 +86,9 @@ void ObjectIndex_idXML::build(UniXML& xml)
read_nodes
(
xml
,
"nodes"
);
read_nodes
(
xml
,
"nodes"
);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
ObjectIndex_idXML
::
read_section
(
UniXML
&
xml
,
const
std
::
string
&
sec
)
void
ObjectIndex_idXML
::
read_section
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
)
{
{
string
secRoot
=
xml
.
getProp
(
xml
.
findNode
(
xml
.
getFirstNode
(),
"RootSection"
),
"name"
);
string
secRoot
=
xml
->
getProp
(
xml
->
findNode
(
xml
->
getFirstNode
(),
"RootSection"
),
"name"
);
if
(
secRoot
.
empty
()
)
if
(
secRoot
.
empty
()
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -97,7 +97,7 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
...
@@ -97,7 +97,7 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
throw
SystemError
(
msg
.
str
());
throw
SystemError
(
msg
.
str
());
}
}
xmlNode
*
root
(
xml
.
findNode
(
xml
.
getFirstNode
(),
sec
)
);
xmlNode
*
root
(
xml
->
findNode
(
xml
->
getFirstNode
(),
sec
)
);
if
(
!
root
)
if
(
!
root
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -114,9 +114,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
...
@@ -114,9 +114,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
throw
NameNotFound
(
msg
.
str
());
throw
NameNotFound
(
msg
.
str
());
}
}
string
secname
=
xml
.
getProp
(
root
,
"section"
);
string
secname
=
xml
->
getProp
(
root
,
"section"
);
if
(
secname
.
empty
()
)
if
(
secname
.
empty
()
)
secname
=
xml
.
getProp
(
root
,
"name"
);
secname
=
xml
->
getProp
(
root
,
"name"
);
if
(
secname
.
empty
()
)
if
(
secname
.
empty
()
)
{
{
...
@@ -148,9 +148,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
...
@@ -148,9 +148,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
strcpy
(
inf
.
repName
,
name
.
c_str
()
);
strcpy
(
inf
.
repName
,
name
.
c_str
()
);
// textname
// textname
string
textname
(
xml
.
getProp
(
it
,
"textname"
));
string
textname
(
xml
->
getProp
(
it
,
"textname"
));
if
(
textname
.
empty
()
)
if
(
textname
.
empty
()
)
textname
=
xml
.
getProp
(
it
,
"name"
);
textname
=
xml
->
getProp
(
it
,
"name"
);
inf
.
textName
=
new
char
[
textname
.
size
()
+
1
];
inf
.
textName
=
new
char
[
textname
.
size
()
+
1
];
strcpy
(
inf
.
textName
,
textname
.
c_str
()
);
strcpy
(
inf
.
textName
,
textname
.
c_str
()
);
...
@@ -162,9 +162,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
...
@@ -162,9 +162,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
}
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
ObjectIndex_idXML
::
read_nodes
(
UniXML
&
xml
,
const
std
::
string
&
sec
)
void
ObjectIndex_idXML
::
read_nodes
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
const
std
::
string
&
sec
)
{
{
xmlNode
*
root
(
xml
.
findNode
(
xml
.
getFirstNode
(),
sec
)
);
xmlNode
*
root
(
xml
->
findNode
(
xml
->
getFirstNode
(),
sec
)
);
if
(
!
root
)
if
(
!
root
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -200,7 +200,7 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
...
@@ -200,7 +200,7 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
strcpy
(
inf
.
repName
,
name
.
c_str
()
);
strcpy
(
inf
.
repName
,
name
.
c_str
()
);
// textname
// textname
string
textname
(
xml
.
getProp
(
it
,
"textname"
));
string
textname
(
xml
->
getProp
(
it
,
"textname"
));
if
(
textname
.
empty
()
)
if
(
textname
.
empty
()
)
textname
=
name
;
textname
=
name
;
...
...
src/Processes/NCRestorer_XML.cc
View file @
41efee0d
This diff is collapsed.
Click to expand it.
src/Various/Configuration.cc
View file @
41efee0d
...
@@ -184,10 +184,13 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -184,10 +184,13 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
try
try
{
{
if
(
!
unixml
.
isOpen
()
)
if
(
unixml
==
nullptr
)
unixml
=
std
::
shared_ptr
<
UniXML
>
(
new
UniXML
()
);
if
(
!
unixml
->
isOpen
()
)
{
{
uinfo
<<
"(Configuration): open from file "
<<
fileConfName
<<
endl
;
uinfo
<<
"(Configuration): open from file "
<<
fileConfName
<<
endl
;
unixml
.
open
(
fileConfName
);
unixml
->
open
(
fileConfName
);
}
}
}
}
catch
(...)
catch
(...)
...
@@ -204,7 +207,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -204,7 +207,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
{
{
if
(
oind
==
NULL
)
if
(
oind
==
NULL
)
{
{
UniXML_iterator
it
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"ObjectsMap"
);
UniXML_iterator
it
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"ObjectsMap"
);
if
(
!
it
)
if
(
!
it
)
{
{
ucrit
<<
"(Configuration:init): not found <ObjectsMap> node in "
<<
fileConfName
<<
endl
;
ucrit
<<
"(Configuration:init): not found <ObjectsMap> node in "
<<
fileConfName
<<
endl
;
...
@@ -406,7 +409,7 @@ int Configuration::getArgPInt( const string& name, const string& strdefval, int
...
@@ -406,7 +409,7 @@ int Configuration::getArgPInt( const string& name, const string& strdefval, int
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
Configuration
::
initParameters
()
void
Configuration
::
initParameters
()
{
{
xmlNode
*
root
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"UniSet"
);
xmlNode
*
root
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"UniSet"
);
if
(
!
root
)
if
(
!
root
)
{
{
ucrit
<<
"Configuration: INIT PARAM`s FAILED! <UniSet>...</UniSet> not found"
<<
endl
;
ucrit
<<
"Configuration: INIT PARAM`s FAILED! <UniSet>...</UniSet> not found"
<<
endl
;
...
@@ -531,7 +534,7 @@ void Configuration::setLocalNode( const string& nodename )
...
@@ -531,7 +534,7 @@ void Configuration::setLocalNode( const string& nodename )
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
xmlNode
*
Configuration
::
getNode
(
const
string
&
path
)
xmlNode
*
Configuration
::
getNode
(
const
string
&
path
)
{
{
return
unixml
.
findNode
(
unixml
.
getFirstNode
(),
path
);
return
unixml
->
findNode
(
unixml
->
getFirstNode
(),
path
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string
Configuration
::
getProp
(
xmlNode
*
node
,
const
string
&
name
)
string
Configuration
::
getProp
(
xmlNode
*
node
,
const
string
&
name
)
...
@@ -556,7 +559,7 @@ string Configuration::getField(const string& path)
...
@@ -556,7 +559,7 @@ string Configuration::getField(const string& path)
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
int
Configuration
::
getIntField
(
const
std
::
string
&
path
)
int
Configuration
::
getIntField
(
const
std
::
string
&
path
)
{
{
return
unixml
.
getIntProp
(
getNode
(
path
),
"name"
);
return
unixml
->
getIntProp
(
getNode
(
path
),
"name"
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -571,10 +574,10 @@ int Configuration::getPIntField(const std::string& path, int def)
...
@@ -571,10 +574,10 @@ int Configuration::getPIntField(const std::string& path, int def)
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
xmlNode
*
Configuration
::
findNode
(
xmlNode
*
node
,
const
std
::
string
&
snode
,
const
std
::
string
&
sname
)
xmlNode
*
Configuration
::
findNode
(
xmlNode
*
node
,
const
std
::
string
&
snode
,
const
std
::
string
&
sname
)
{
{
if
(
!
unixml
.
isOpen
()
)
if
(
!
unixml
->
isOpen
()
)
return
0
;
return
0
;
return
unixml
.
findNode
(
node
,
snode
,
sname
);
return
unixml
->
findNode
(
node
,
snode
,
sname
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string
Configuration
::
getRootDir
()
string
Configuration
::
getRootDir
()
...
@@ -585,7 +588,7 @@ string Configuration::getRootDir()
...
@@ -585,7 +588,7 @@ string Configuration::getRootDir()
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
Configuration
::
createNodesList
()
void
Configuration
::
createNodesList
()
{
{
xmlNode
*
omapnode
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"ObjectsMap"
);
xmlNode
*
omapnode
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"ObjectsMap"
);
if
(
!
omapnode
)
if
(
!
omapnode
)
{
{
ucrit
<<
"(Configuration): <ObjectsMap> not found!!!"
<<
endl
;
ucrit
<<
"(Configuration): <ObjectsMap> not found!!!"
<<
endl
;
...
@@ -593,7 +596,7 @@ void Configuration::createNodesList()
...
@@ -593,7 +596,7 @@ void Configuration::createNodesList()
}
}
xmlNode
*
node
=
unixml
.
findNode
(
omapnode
,
"nodes"
);
xmlNode
*
node
=
unixml
->
findNode
(
omapnode
,
"nodes"
);
if
(
!
node
)
if
(
!
node
)
{
{
ucrit
<<
"(Configuration): <nodes> section not found!"
<<
endl
;
ucrit
<<
"(Configuration): <nodes> section not found!"
<<
endl
;
...
@@ -604,7 +607,7 @@ void Configuration::createNodesList()
...
@@ -604,7 +607,7 @@ void Configuration::createNodesList()
it
.
goChildren
();
it
.
goChildren
();
// определяем порт
// определяем порт
string
defPort
(
getPort
(
unixml
.
getProp
(
node
,
"port"
)));
string
defPort
(
getPort
(
unixml
->
getProp
(
node
,
"port"
)));
lnodes
.
clear
();
lnodes
.
clear
();
for
(
;
it
;
it
.
goNext
()
)
for
(
;
it
;
it
.
goNext
()
)
...
@@ -755,7 +758,7 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
...
@@ -755,7 +758,7 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
void
Configuration
::
initRepSections
()
void
Configuration
::
initRepSections
()
{
{
// Реализация под жёсткую структуру репозитория
// Реализация под жёсткую структуру репозитория
xmlNode
*
node
(
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"RootSection"
)
);
xmlNode
*
node
(
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"RootSection"
)
);
if
(
node
==
NULL
)
if
(
node
==
NULL
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -764,7 +767,7 @@ void Configuration::initRepSections()
...
@@ -764,7 +767,7 @@ void Configuration::initRepSections()
throw
SystemError
(
msg
.
str
());
throw
SystemError
(
msg
.
str
());
}
}
secRoot
=
unixml
.
getProp
(
node
,
"name"
);
secRoot
=
unixml
->
getProp
(
node
,
"name"
);
secSensors
=
secRoot
+
"/"
+
getRepSectionName
(
"sensors"
,
xmlSensorsSec
);
secSensors
=
secRoot
+
"/"
+
getRepSectionName
(
"sensors"
,
xmlSensorsSec
);
secObjects
=
secRoot
+
"/"
+
getRepSectionName
(
"objects"
,
xmlObjectsSec
);
secObjects
=
secRoot
+
"/"
+
getRepSectionName
(
"objects"
,
xmlObjectsSec
);
secControlles
=
secRoot
+
"/"
+
getRepSectionName
(
"controllers"
,
xmlControllersSec
);
secControlles
=
secRoot
+
"/"
+
getRepSectionName
(
"controllers"
,
xmlControllersSec
);
...
@@ -773,7 +776,7 @@ void Configuration::initRepSections()
...
@@ -773,7 +776,7 @@ void Configuration::initRepSections()
string
Configuration
::
getRepSectionName
(
const
string
&
sec
,
xmlNode
*
secnode
)
string
Configuration
::
getRepSectionName
(
const
string
&
sec
,
xmlNode
*
secnode
)
{
{
xmlNode
*
node
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
sec
);
xmlNode
*
node
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
sec
);
if
(
node
==
NULL
)
if
(
node
==
NULL
)
{
{
ostringstream
msg
;
ostringstream
msg
;
...
@@ -784,9 +787,9 @@ string Configuration::getRepSectionName( const string& sec, xmlNode* secnode )
...
@@ -784,9 +787,9 @@ string Configuration::getRepSectionName( const string& sec, xmlNode* secnode )
secnode
=
node
;
secnode
=
node
;
string
ret
(
unixml
.
getProp
(
node
,
"section"
));
string
ret
(
unixml
->
getProp
(
node
,
"section"
));
if
(
ret
.
empty
()
)
if
(
ret
.
empty
()
)
ret
=
unixml
.
getProp
(
node
,
"name"
);
ret
=
unixml
->
getProp
(
node
,
"name"
);
return
ret
;
return
ret
;
}
}
...
@@ -891,7 +894,7 @@ xmlNode* Configuration::getXMLSensorsSection()
...
@@ -891,7 +894,7 @@ xmlNode* Configuration::getXMLSensorsSection()
if
(
xmlSensorsSec
)
if
(
xmlSensorsSec
)
return
xmlSensorsSec
;
return
xmlSensorsSec
;
xmlSensorsSec
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"sensors"
);
xmlSensorsSec
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"sensors"
);
return
xmlSensorsSec
;
return
xmlSensorsSec
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -900,7 +903,7 @@ xmlNode* Configuration::getXMLObjectsSection()
...
@@ -900,7 +903,7 @@ xmlNode* Configuration::getXMLObjectsSection()
if
(
xmlObjectsSec
)
if
(
xmlObjectsSec
)
return
xmlObjectsSec
;
return
xmlObjectsSec
;
xmlObjectsSec
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"objects"
);
xmlObjectsSec
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"objects"
);
return
xmlObjectsSec
;
return
xmlObjectsSec
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -909,7 +912,7 @@ xmlNode* Configuration::getXMLControllersSection()
...
@@ -909,7 +912,7 @@ xmlNode* Configuration::getXMLControllersSection()
if
(
xmlControllersSec
)
if
(
xmlControllersSec
)
return
xmlControllersSec
;
return
xmlControllersSec
;
xmlControllersSec
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"controllers"
);
xmlControllersSec
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"controllers"
);
return
xmlControllersSec
;
return
xmlControllersSec
;
}
}
...
@@ -919,7 +922,7 @@ xmlNode* Configuration::getXMLServicesSection()
...
@@ -919,7 +922,7 @@ xmlNode* Configuration::getXMLServicesSection()
if
(
xmlServicesSec
)
if
(
xmlServicesSec
)
return
xmlServicesSec
;
return
xmlServicesSec
;
xmlServicesSec
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"services"
);
xmlServicesSec
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"services"
);
return
xmlServicesSec
;
return
xmlServicesSec
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -928,7 +931,7 @@ xmlNode* Configuration::getXMLNodesSection()
...
@@ -928,7 +931,7 @@ xmlNode* Configuration::getXMLNodesSection()
if
(
xmlNodesSec
)
if
(
xmlNodesSec
)
return
xmlNodesSec
;
return
xmlNodesSec
;
xmlNodesSec
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"nodes"
);
xmlNodesSec
=
unixml
->
findNode
(
unixml
->
getFirstNode
(),
"nodes"
);
return
xmlNodesSec
;
return
xmlNodesSec
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
...
src/Various/Restorer_XML.cc
View file @
41efee0d
...
@@ -119,7 +119,7 @@ bool Restorer_XML::check_consumer_item( UniXML_iterator& it )
...
@@ -119,7 +119,7 @@ bool Restorer_XML::check_consumer_item( UniXML_iterator& it )
return
UniSetTypes
::
check_filter
(
it
,
c_filterField
,
c_filterValue
);
return
UniSetTypes
::
check_filter
(
it
,
c_filterField
,
c_filterValue
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
xmlNode
*
Restorer_XML
::
find_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
xmlNode
*
Restorer_XML
::
find_node
(
const
std
::
shared_ptr
<
UniXML
>
&
xml
,
xmlNode
*
root
,
const
string
&
nodename
,
const
string
&
nm
)
const
string
&
nodename
,
const
string
&
nm
)
{
{
UniXML_iterator
it
(
root
);
UniXML_iterator
it
(
root
);
...
@@ -132,7 +132,7 @@ xmlNode* Restorer_XML::find_node( const UniXML& xml, xmlNode* root,
...
@@ -132,7 +132,7 @@ xmlNode* Restorer_XML::find_node( const UniXML& xml, xmlNode* root,
if
(
nm
.
empty
()
)
if
(
nm
.
empty
()
)
return
it
;
return
it
;
if
(
xml
.
getProp
(
it
,
"name"
)
==
nm
)
if
(
xml
->
getProp
(
it
,
"name"
)
==
nm
)
return
it
;
return
it
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment