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
bc62c495
Commit
bc62c495
authored
Jan 27, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Перешёл по возможности на const где только заметил возможность
parent
689094b3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
172 additions
and
219 deletions
+172
-219
IOControl.cc
extensions/IOControl/IOControl.cc
+2
-2
IOControl.h
extensions/IOControl/IOControl.h
+1
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+5
-5
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+1
-1
MBTCPMaster.h
extensions/ModbusMaster/MBTCPMaster.h
+1
-1
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+1
-1
MBTCPMultiMaster.h
extensions/ModbusMaster/MBTCPMultiMaster.h
+0
-1
RTUExchange.h
extensions/ModbusMaster/RTUExchange.h
+0
-1
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+6
-6
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+1
-1
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+2
-1
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+6
-7
SharedMemory.h
extensions/SharedMemory/SharedMemory.h
+2
-2
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+1
-1
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+3
-3
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
-5
IOController.h
include/IOController.h
+0
-0
IORFile.h
include/IORFile.h
+4
-4
LT_Object.h
include/LT_Object.h
+0
-0
MessageType.h
include/MessageType.h
+1
-1
NCRestorer.h
include/NCRestorer.h
+18
-18
ORepHelpers.h
include/ORepHelpers.h
+2
-2
ObjectRepository.h
include/ObjectRepository.h
+12
-12
Restorer.h
include/Restorer.h
+2
-2
UInterface.h
include/UInterface.h
+0
-0
UniSetObject.h
include/UniSetObject.h
+4
-2
UniXML.h
include/UniXML.h
+15
-9
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+2
-2
UInterface.cc
src/Interfaces/UInterface.cc
+0
-0
IORFile.cc
src/ObjectRepository/IORFile.cc
+4
-20
ORepHelpers.cc
src/ObjectRepository/ORepHelpers.cc
+3
-3
ObjectIndex_XML.cc
src/ObjectRepository/ObjectIndex_XML.cc
+4
-4
ObjectIndex_idXML.cc
src/ObjectRepository/ObjectIndex_idXML.cc
+1
-5
ObjectRepository.cc
src/ObjectRepository/ObjectRepository.cc
+11
-19
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+1
-1
IOController.cc
src/Processes/IOController.cc
+0
-0
IONotifyController.cc
src/Processes/IONotifyController.cc
+11
-1
NCRestorer.cc
src/Processes/NCRestorer.cc
+0
-37
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+13
-13
LT_Object.cc
src/Various/LT_Object.cc
+0
-0
Restorer_XML.cc
src/Various/Restorer_XML.cc
+1
-1
UniXML.cc
src/Various/UniXML.cc
+23
-21
No files found.
extensions/IOControl/IOControl.cc
View file @
bc62c495
...
@@ -667,7 +667,7 @@ void IOControl::readConfiguration()
...
@@ -667,7 +667,7 @@ void IOControl::readConfiguration()
readconf_ok
=
true
;
readconf_ok
=
true
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
IOControl
::
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
IOControl
::
readItem
(
const
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
);
...
@@ -1468,7 +1468,7 @@ void IOControl::buildCardsList()
...
@@ -1468,7 +1468,7 @@ void IOControl::buildCardsList()
return
;
return
;
}
}
UniXML
*
xml
=
conf
->
getConfXML
();
const
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 @
bc62c495
...
@@ -299,7 +299,7 @@ class IOControl:
...
@@ -299,7 +299,7 @@ class IOControl:
// чтение файла конфигурации
// чтение файла конфигурации
void
readConfiguration
();
void
readConfiguration
();
bool
initIOItem
(
UniXML_iterator
&
it
);
bool
initIOItem
(
UniXML_iterator
&
it
);
bool
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
buildCardsList
();
void
buildCardsList
();
void
waitSM
();
void
waitSM
();
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
bc62c495
...
@@ -265,7 +265,7 @@ void MBExchange::readConfiguration()
...
@@ -265,7 +265,7 @@ void MBExchange::readConfiguration()
// readconf_ok = true;
// readconf_ok = true;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
MBExchange
::
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
MBExchange
::
readItem
(
const
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
);
...
@@ -457,12 +457,12 @@ void MBExchange::rtuQueryOptimization( RTUDeviceMap& m )
...
@@ -457,12 +457,12 @@ void MBExchange::rtuQueryOptimization( RTUDeviceMap& m )
RegID
id
=
it
->
second
->
id
;
// или собственно it->first
RegID
id
=
it
->
second
->
id
;
// или собственно it->first
beg
->
second
->
q_num
=
1
;
beg
->
second
->
q_num
=
1
;
beg
->
second
->
q_count
=
1
;
beg
->
second
->
q_count
=
1
;
it
++
;
++
it
;
for
(
;
it
!=
d
->
regmap
.
end
();
++
it
)
for
(
;
it
!=
d
->
regmap
.
end
();
++
it
)
{
{
if
(
(
it
->
second
->
id
-
id
)
>
1
)
if
(
(
it
->
second
->
id
-
id
)
>
1
)
{
{
it
--
;
// раз это регистр уже следующий, то надо вернуть на шаг обратно..
--
it
;
// раз это регистр уже следующий, то надо вернуть на шаг обратно..
break
;
break
;
}
}
...
@@ -1783,7 +1783,7 @@ MBExchange::RSProperty* MBExchange::addProp( PList& plist, RSProperty& p )
...
@@ -1783,7 +1783,7 @@ MBExchange::RSProperty* MBExchange::addProp( PList& plist, RSProperty& p )
plist
.
push_back
(
p
);
plist
.
push_back
(
p
);
PList
::
iterator
it
=
plist
.
end
();
PList
::
iterator
it
=
plist
.
end
();
it
--
;
--
it
;
return
&
(
*
it
);
return
&
(
*
it
);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -2292,7 +2292,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::RSProperty& p )
...
@@ -2292,7 +2292,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::RSProperty& p )
void
MBExchange
::
initDeviceList
()
void
MBExchange
::
initDeviceList
()
{
{
xmlNode
*
respNode
=
0
;
xmlNode
*
respNode
=
0
;
UniXML
*
xml
=
conf
->
getConfXML
();
const
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 @
bc62c495
...
@@ -254,7 +254,7 @@ class MBExchange:
...
@@ -254,7 +254,7 @@ class MBExchange:
void
waitSMReady
();
void
waitSMReady
();
void
readConfiguration
();
void
readConfiguration
();
bool
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
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/ModbusMaster/MBTCPMaster.h
View file @
bc62c495
...
@@ -211,7 +211,7 @@ class MBTCPMaster:
...
@@ -211,7 +211,7 @@ class MBTCPMaster:
std
::
string
iaddr
;
std
::
string
iaddr
;
// ost::InetAddress* ia;
// ost::InetAddress* ia;
int
port
;
int
port
;
int
recv_timeout
;
//
int recv_timeout;
// virtual void step();
// virtual void step();
virtual
ModbusClient
*
initMB
(
bool
reopen
=
false
);
virtual
ModbusClient
*
initMB
(
bool
reopen
=
false
);
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
bc62c495
...
@@ -169,7 +169,7 @@ ModbusClient* MBTCPMultiMaster::initMB( bool reopen )
...
@@ -169,7 +169,7 @@ ModbusClient* MBTCPMultiMaster::initMB( bool reopen )
// движемся в обратном порядке, т.к. сортировка по возрастанию приоритета
// движемся в обратном порядке, т.к. сортировка по возрастанию приоритета
if
(
checktime
<=
0
)
if
(
checktime
<=
0
)
{
{
mbi
++
;
++
mbi
;
if
(
mbi
==
mblist
.
rend
()
)
if
(
mbi
==
mblist
.
rend
()
)
mbi
=
mblist
.
rbegin
();
mbi
=
mblist
.
rbegin
();
...
...
extensions/ModbusMaster/MBTCPMultiMaster.h
View file @
bc62c495
...
@@ -234,7 +234,6 @@ class MBTCPMultiMaster:
...
@@ -234,7 +234,6 @@ class MBTCPMultiMaster:
void
check_thread
();
void
check_thread
();
UniSetTypes
::
uniset_rwmutex
mbMutex
;
UniSetTypes
::
uniset_rwmutex
mbMutex
;
int
recv_timeout
;
bool
force_disconnect
;
bool
force_disconnect
;
int
checktime
;
int
checktime
;
...
...
extensions/ModbusMaster/RTUExchange.h
View file @
bc62c495
...
@@ -42,7 +42,6 @@ class RTUExchange:
...
@@ -42,7 +42,6 @@ class RTUExchange:
private
:
private
:
RTUExchange
();
RTUExchange
();
UniSetTypes
::
uniset_mutex
pollMutex
;
bool
rs_pre_clean
;
bool
rs_pre_clean
;
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
bc62c495
...
@@ -200,7 +200,7 @@ prefix(prefix)
...
@@ -200,7 +200,7 @@ prefix(prefix)
// build file list...
// build file list...
xmlNode
*
fnode
=
0
;
xmlNode
*
fnode
=
0
;
UniXML
*
xml
=
conf
->
getConfXML
();
const
UniXML
*
xml
=
conf
->
getConfXML
();
if
(
xml
)
if
(
xml
)
fnode
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"filelist"
);
fnode
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"filelist"
);
...
@@ -750,7 +750,7 @@ void MBSlave::readConfiguration()
...
@@ -750,7 +750,7 @@ void MBSlave::readConfiguration()
// readconf_ok = true;
// readconf_ok = true;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
MBSlave
::
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
MBSlave
::
readItem
(
const
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
);
...
@@ -833,7 +833,7 @@ bool MBSlave::initItem( UniXML_iterator& it )
...
@@ -833,7 +833,7 @@ bool MBSlave::initItem( UniXML_iterator& it )
void
MBSlave
::
initIterators
()
void
MBSlave
::
initIterators
()
{
{
IOMap
::
iterator
it
=
iomap
.
begin
();
IOMap
::
iterator
it
=
iomap
.
begin
();
for
(
;
it
!=
iomap
.
end
();
it
++
)
for
(
;
it
!=
iomap
.
end
();
++
it
)
shm
->
initIterator
(
it
->
second
.
ioit
);
shm
->
initIterator
(
it
->
second
.
ioit
);
shm
->
initIterator
(
itHeartBeat
);
shm
->
initIterator
(
itHeartBeat
);
...
@@ -989,7 +989,7 @@ ModbusRTU::mbErrCode MBSlave::much_real_write( ModbusRTU::ModbusData reg, Modbus
...
@@ -989,7 +989,7 @@ ModbusRTU::mbErrCode MBSlave::much_real_write( ModbusRTU::ModbusData reg, Modbus
if
(
it
->
first
==
reg
)
if
(
it
->
first
==
reg
)
{
{
real_write_it
(
it
,
dat
[
i
]);
real_write_it
(
it
,
dat
[
i
]);
it
++
;
++
it
;
}
}
}
}
...
@@ -1155,7 +1155,7 @@ ModbusRTU::mbErrCode MBSlave::much_real_read( ModbusRTU::ModbusData reg, ModbusR
...
@@ -1155,7 +1155,7 @@ ModbusRTU::mbErrCode MBSlave::much_real_read( ModbusRTU::ModbusData reg, ModbusR
if
(
it
->
first
==
reg
)
if
(
it
->
first
==
reg
)
{
{
real_read_it
(
it
,
val
);
real_read_it
(
it
,
val
);
it
++
;
++
it
;
}
}
dat
[
i
]
=
val
;
dat
[
i
]
=
val
;
}
}
...
@@ -1509,7 +1509,7 @@ ModbusRTU::mbErrCode MBSlave::read4314( ModbusRTU::MEIMessageRDI& query,
...
@@ -1509,7 +1509,7 @@ ModbusRTU::mbErrCode MBSlave::read4314( ModbusRTU::MEIMessageRDI& query,
reply
.
mf
=
0xFF
;
reply
.
mf
=
0xFF
;
reply
.
conformity
=
query
.
devID
;
reply
.
conformity
=
query
.
devID
;
for
(
MEIValMap
::
iterator
i
=
oit
->
second
.
begin
();
i
!=
oit
->
second
.
end
();
i
++
)
for
(
MEIValMap
::
iterator
i
=
oit
->
second
.
begin
();
i
!=
oit
->
second
.
end
();
++
i
)
reply
.
addData
(
i
->
first
,
i
->
second
);
reply
.
addData
(
i
->
first
,
i
->
second
);
return
erNoError
;
return
erNoError
;
...
...
extensions/ModbusSlave/MBSlave.h
View file @
bc62c495
...
@@ -152,7 +152,7 @@ class MBSlave:
...
@@ -152,7 +152,7 @@ class MBSlave:
void
initIterators
();
void
initIterators
();
bool
initItem
(
UniXML_iterator
&
it
);
bool
initItem
(
UniXML_iterator
&
it
);
bool
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
readConfiguration
();
void
readConfiguration
();
bool
check_item
(
UniXML_iterator
&
it
);
bool
check_item
(
UniXML_iterator
&
it
);
...
...
extensions/RRDServer/RRDServer.cc
View file @
bc62c495
...
@@ -30,7 +30,7 @@ prefix(prefix)
...
@@ -30,7 +30,7 @@ prefix(prefix)
}
}
int
tmID
=
1
;
int
tmID
=
1
;
for
(
;
it1
.
getCurrent
();
it1
++
,
tmID
++
)
for
(
;
it1
.
getCurrent
();
++
it1
,
++
tmID
)
initRRD
(
it1
,
tmID
);
initRRD
(
it1
,
tmID
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -320,6 +320,7 @@ void RRDServer::timerInfo( const UniSetTypes::TimerMessage* tm )
...
@@ -320,6 +320,7 @@ void RRDServer::timerInfo( const UniSetTypes::TimerMessage* tm )
rrd_clear_error
();
rrd_clear_error
();
const
char
*
argv
=
v
.
str
().
c_str
();
const
char
*
argv
=
v
.
str
().
c_str
();
if
(
rrd_update_r
(
it
->
filename
.
c_str
(),
NULL
,
1
,
&
argv
)
<
0
)
if
(
rrd_update_r
(
it
->
filename
.
c_str
(),
NULL
,
1
,
&
argv
)
<
0
)
{
{
ostringstream
err
;
ostringstream
err
;
...
...
extensions/SharedMemory/SharedMemory.cc
View file @
bc62c495
...
@@ -340,7 +340,7 @@ void SharedMemory::checkHeartBeat()
...
@@ -340,7 +340,7 @@ void SharedMemory::checkHeartBeat()
wdt
->
ping
();
wdt
->
ping
();
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
SharedMemory
::
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
SharedMemory
::
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
{
{
for
(
ReadSlotList
::
iterator
r
=
lstRSlot
.
begin
();
r
!=
lstRSlot
.
end
();
++
r
)
for
(
ReadSlotList
::
iterator
r
=
lstRSlot
.
begin
();
r
!=
lstRSlot
.
end
();
++
r
)
{
{
...
@@ -354,7 +354,6 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
...
@@ -354,7 +354,6 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
// check history filters
// check history filters
checkHistoryFilter
(
it
);
checkHistoryFilter
(
it
);
if
(
heartbeat_node
.
empty
()
||
it
.
getProp
(
"heartbeat"
).
empty
())
if
(
heartbeat_node
.
empty
()
||
it
.
getProp
(
"heartbeat"
).
empty
())
return
true
;
return
true
;
...
@@ -454,7 +453,7 @@ void SharedMemory::buildEventList( xmlNode* cnode )
...
@@ -454,7 +453,7 @@ void SharedMemory::buildEventList( xmlNode* cnode )
readEventList
(
"services"
);
readEventList
(
"services"
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
SharedMemory
::
readEventList
(
std
::
string
oname
)
void
SharedMemory
::
readEventList
(
const
std
::
string
&
oname
)
{
{
xmlNode
*
enode
=
conf
->
getNode
(
oname
);
xmlNode
*
enode
=
conf
->
getNode
(
oname
);
if
(
enode
==
NULL
)
if
(
enode
==
NULL
)
...
@@ -491,7 +490,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
...
@@ -491,7 +490,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
{
{
TransportMessage
tm
(
sm
.
transport_msg
());
TransportMessage
tm
(
sm
.
transport_msg
());
for
(
EventList
::
iterator
it
=
elst
.
begin
();
it
!=
elst
.
end
();
it
++
)
for
(
EventList
::
iterator
it
=
elst
.
begin
();
it
!=
elst
.
end
();
++
it
)
{
{
bool
ok
=
false
;
bool
ok
=
false
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
for
(
int
i
=
0
;
i
<
2
;
i
++
)
...
@@ -525,14 +524,14 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
...
@@ -525,14 +524,14 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
{
{
dinfo
<<
myname
<<
"(buildHistoryList): ..."
<<
endl
;
dinfo
<<
myname
<<
"(buildHistoryList): ..."
<<
endl
;
UniXML
*
xml
=
conf
->
getConfXML
();
const
UniXML
*
xml
=
conf
->
getConfXML
();
if
(
!
xml
)
if
(
!
xml
)
{
{
dwarn
<<
myname
<<
"(buildHistoryList): xml=NULL?!"
<<
endl
;
dwarn
<<
myname
<<
"(buildHistoryList): xml=NULL?!"
<<
endl
;
return
;
return
;
}
}
xmlNode
*
n
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"History"
,
""
);
xmlNode
*
n
=
const_cast
<
UniXML
*>
(
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
;
...
@@ -540,7 +539,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
...
@@ -540,7 +539,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
return
;
return
;
}
}
UniXML
_
iterator
it
(
n
);
UniXML
::
iterator
it
(
n
);
bool
no_history
=
conf
->
getArgInt
(
"--sm-no-history"
,
it
.
getProp
(
"no_history"
));
bool
no_history
=
conf
->
getArgInt
(
"--sm-no-history"
,
it
.
getProp
(
"no_history"
));
if
(
no_history
)
if
(
no_history
)
...
...
extensions/SharedMemory/SharedMemory.h
View file @
bc62c495
...
@@ -353,10 +353,10 @@ class SharedMemory:
...
@@ -353,10 +353,10 @@ class SharedMemory:
bool
activateObject
();
bool
activateObject
();
// virtual void logging(UniSetTypes::SensorMessage& sm){}
// virtual void logging(UniSetTypes::SensorMessage& sm){}
// virtual void dumpToDB(){}
// virtual void dumpToDB(){}
bool
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
buildEventList
(
xmlNode
*
cnode
);
void
buildEventList
(
xmlNode
*
cnode
);
void
readEventList
(
std
::
string
oname
);
void
readEventList
(
const
std
::
string
&
oname
);
UniSetTypes
::
uniset_rwmutex
mutex_start
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
bc62c495
...
@@ -630,7 +630,7 @@ void UNetExchange::initIterators()
...
@@ -630,7 +630,7 @@ void UNetExchange::initIterators()
if
(
sender2
)
if
(
sender2
)
sender2
->
initIterators
();
sender2
->
initIterators
();
for
(
ReceiverList
::
iterator
it
=
recvlist
.
begin
();
it
!=
recvlist
.
end
();
it
++
)
for
(
ReceiverList
::
iterator
it
=
recvlist
.
begin
();
it
!=
recvlist
.
end
();
++
it
)
it
->
initIterators
(
shm
);
it
->
initIterators
(
shm
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
extensions/UNetUDP/UNetSender.cc
View file @
bc62c495
...
@@ -232,7 +232,7 @@ void UNetSender::readConfiguration()
...
@@ -232,7 +232,7 @@ void UNetSender::readConfiguration()
}
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
UNetSender
::
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
UNetSender
::
readItem
(
const
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
);
...
@@ -319,14 +319,14 @@ std::ostream& operator<<( std::ostream& os, UNetSender::UItem& p )
...
@@ -319,14 +319,14 @@ std::ostream& operator<<( std::ostream& os, UNetSender::UItem& p )
void
UNetSender
::
initIterators
()
void
UNetSender
::
initIterators
()
{
{
DMap
::
iterator
it
=
dlist
.
begin
();
DMap
::
iterator
it
=
dlist
.
begin
();
for
(
;
it
!=
dlist
.
end
();
it
++
)
for
(
;
it
!=
dlist
.
end
();
++
it
)
shm
->
initIterator
(
it
->
ioit
);
shm
->
initIterator
(
it
->
ioit
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UNetSender
::
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
void
UNetSender
::
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
{
{
DMap
::
iterator
it
=
dlist
.
begin
();
DMap
::
iterator
it
=
dlist
.
begin
();
for
(
;
it
!=
dlist
.
end
();
it
++
)
for
(
;
it
!=
dlist
.
end
();
++
it
)
shm
->
askSensor
(
it
->
id
,
cmd
);
shm
->
askSensor
(
it
->
id
,
cmd
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
extensions/UNetUDP/UNetSender.h
View file @
bc62c495
...
@@ -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
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
void
readConfiguration
();
void
readConfiguration
();
...
...
extensions/UniNetwork/UniExchange.cc
View file @
bc62c495
...
@@ -369,7 +369,7 @@ void UniExchange::readConfiguration()
...
@@ -369,7 +369,7 @@ void UniExchange::readConfiguration()
// readconf_ok = true;
// readconf_ok = true;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
UniExchange
::
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
)
bool
UniExchange
::
readItem
(
const
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 @
bc62c495
...
@@ -98,7 +98,7 @@ class UniExchange:
...
@@ -98,7 +98,7 @@ class UniExchange:
NetNodeList
nlst
;
NetNodeList
nlst
;
void
readConfiguration
();
void
readConfiguration
();
bool
readItem
(
UniXML
&
xml
,
UniXML_iterator
&
it
,
xmlNode
*
sec
);
bool
readItem
(
const
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 @
bc62c495
...
@@ -86,7 +86,7 @@ namespace UniSetTypes
...
@@ -86,7 +86,7 @@ namespace UniSetTypes
static
std
::
ostream
&
help
(
std
::
ostream
&
os
);
static
std
::
ostream
&
help
(
std
::
ostream
&
os
);
std
::
string
getRootDir
();
/*!< Получение каталога, в котором находится выполняющаяся программа */
std
::
string
getRootDir
();
/*!< Получение каталога, в котором находится выполняющаяся программа */
inline
int
getArgc
(){
return
_argc
;
}
inline
int
getArgc
()
const
{
return
_argc
;
}
inline
const
char
*
const
*
getArgv
()
const
{
return
_argv
;
}
inline
const
char
*
const
*
getArgv
()
const
{
return
_argv
;
}
inline
ObjectId
getDBServer
()
const
{
return
localDBServer
;
}
/*!< получение идентификатора DBServer-а */
inline
ObjectId
getDBServer
()
const
{
return
localDBServer
;
}
/*!< получение идентификатора DBServer-а */
inline
ObjectId
getLocalNode
()
const
{
return
localNode
;
}
/*!< получение идентификатора локального узла */
inline
ObjectId
getLocalNode
()
const
{
return
localNode
;
}
/*!< получение идентификатора локального узла */
...
@@ -134,8 +134,8 @@ namespace UniSetTypes
...
@@ -134,8 +134,8 @@ namespace UniSetTypes
inline
const
std
::
string
getDocDir
()
const
{
return
docDir
;
}
inline
const
std
::
string
getDocDir
()
const
{
return
docDir
;
}
inline
bool
isLocalIOR
(){
return
localIOR
;
}
inline
bool
isLocalIOR
()
const
{
return
localIOR
;
}
inline
bool
isTransientIOR
(){
return
transientIOR
;
}
inline
bool
isTransientIOR
()
const
{
return
transientIOR
;
}
/*! получить значение указанного параметра, или значение по умолчанию */
/*! получить значение указанного параметра, или значение по умолчанию */
std
::
string
getArgParam
(
const
std
::
string
&
name
,
const
std
::
string
&
defval
=
""
);
std
::
string
getArgParam
(
const
std
::
string
&
name
,
const
std
::
string
&
defval
=
""
);
...
@@ -164,9 +164,9 @@ namespace UniSetTypes
...
@@ -164,9 +164,9 @@ namespace UniSetTypes
IORFile
iorfile
;
IORFile
iorfile
;
/*! указатель на конфигурационный xml */
/*! указатель на конфигурационный xml */
inline
UniXML
*
getConfXML
()
{
return
&
unixml
;
}
inline
const
UniXML
*
getConfXML
()
const
{
return
&
unixml
;
}
CORBA
::
ORB_ptr
getORB
()
{
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
;
}
protected
:
protected
:
...
...
include/IOController.h
View file @
bc62c495
include/IORFile.h
View file @
bc62c495
...
@@ -37,12 +37,12 @@ class IORFile
...
@@ -37,12 +37,12 @@ class IORFile
public
:
public
:
IORFile
();
IORFile
();
std
::
string
getIOR
(
const
ObjectId
id
,
const
ObjectId
node
);
std
::
string
getIOR
(
const
ObjectId
id
,
const
ObjectId
node
)
const
;
void
setIOR
(
const
ObjectId
id
,
const
ObjectId
node
,
const
std
::
string
&
sior
);
void
setIOR
(
const
ObjectId
id
,
const
ObjectId
node
,
const
std
::
string
&
sior
)
const
;
void
unlinkIOR
(
const
ObjectId
id
,
const
ObjectId
node
);
void
unlinkIOR
(
const
ObjectId
id
,
const
ObjectId
node
)
const
;
protected
:
protected
:
std
::
string
genFName
(
const
ObjectId
id
,
const
ObjectId
node
);
std
::
string
genFName
(
const
ObjectId
id
,
const
ObjectId
node
)
const
;
private
:
private
:
};
};
...
...
include/LT_Object.h
View file @
bc62c495
include/MessageType.h
View file @
bc62c495
...
@@ -68,7 +68,7 @@ namespace UniSetTypes
...
@@ -68,7 +68,7 @@ namespace UniSetTypes
Message
(
int
dummy_init
){}
Message
(
int
dummy_init
){}
template
<
class
In
>
template
<
class
In
>
static
TransportMessage
transport
(
const
In
&
msg
)
static
const
TransportMessage
transport
(
const
In
&
msg
)
{
{
TransportMessage
tmsg
;
TransportMessage
tmsg
;
assert
(
sizeof
(
UniSetTypes
::
RawDataOfTransportMessage
)
>=
sizeof
(
msg
));
assert
(
sizeof
(
UniSetTypes
::
RawDataOfTransportMessage
)
>=
sizeof
(
msg
));
...
...
include/NCRestorer.h
View file @
bc62c495
...
@@ -67,9 +67,9 @@ class NCRestorer
...
@@ -67,9 +67,9 @@ class NCRestorer
SInfo
&
operator
=
(
IOController_i
::
SensorIOInfo
&
inf
);
SInfo
&
operator
=
(
IOController_i
::
SensorIOInfo
&
inf
);
};
};
virtual
void
read
(
IONotifyController
*
ic
,
const
std
::
string
&
fn
=
""
)
=
0
;
virtual
void
read
(
IONotifyController
*
ic
,
const
std
::
string
&
fn
=
""
)
=
0
;
virtual
void
dump
(
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerList
&
lst
)
=
0
;
virtual
void
dump
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerList
&
lst
)
=
0
;
virtual
void
dumpThreshold
(
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
)
=
0
;
virtual
void
dumpThreshold
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
)
=
0
;
protected
:
protected
:
...
@@ -144,32 +144,32 @@ class NCRestorer_XML:
...
@@ -144,32 +144,32 @@ class NCRestorer_XML:
*/
*/
void
setReadThresholdItem
(
ReaderSlot
sl
);
void
setReadThresholdItem
(
ReaderSlot
sl
);
typedef
sigc
::
slot
<
bool
,
UniXML
&
,
UniXML_iterator
&
,
xmlNode
*
,
SInfo
&>
NCReaderSlot
;
typedef
sigc
::
slot
<
bool
,
const
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
,
UniXML
&
xml
);
virtual
void
read
(
IONotifyController
*
ic
,
const
UniXML
&
xml
);
virtual
void
dump
(
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerList
&
lst
);
virtual
void
dump
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerList
&
lst
);
virtual
void
dumpThreshold
(
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
);
virtual
void
dumpThreshold
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
);
protected
:
protected
:
bool
check_thresholds_item
(
UniXML_iterator
&
it
);
bool
check_thresholds_item
(
UniXML_iterator
&
it
);
void
read_consumers
(
UniXML
&
xml
,
xmlNode
*
node
,
NCRestorer_XML
::
SInfo
&
inf
,
IONotifyController
*
ic
);
void
read_consumers
(
const
UniXML
&
xml
,
xmlNode
*
node
,
NCRestorer_XML
::
SInfo
&
inf
,
IONotifyController
*
ic
);
void
read_list
(
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
read_list
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
read_thresholds
(
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
read_thresholds
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
);
void
init
(
const
std
::
string
&
fname
);
void
init
(
const
std
::
string
&
fname
);
bool
getBaseInfo
(
UniXML
&
xml
,
xmlNode
*
it
,
IOController_i
::
SensorInfo
&
si
);
bool
getBaseInfo
(
const
UniXML
&
xml
,
xmlNode
*
it
,
IOController_i
::
SensorInfo
&
si
);
bool
getSensorInfo
(
UniXML
&
xml
,
xmlNode
*
snode
,
SInfo
&
si
);
bool
getSensorInfo
(
const
UniXML
&
xml
,
xmlNode
*
snode
,
SInfo
&
si
);
bool
getConsumerList
(
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
::
ConsumerList
&
lst
);
bool
getConsumerList
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
::
ConsumerList
&
lst
);
bool
getThresholdInfo
(
UniXML
&
xml
,
xmlNode
*
tnode
,
IONotifyController
::
ThresholdInfoExt
&
ti
);
bool
getThresholdInfo
(
const
UniXML
&
xml
,
xmlNode
*
tnode
,
IONotifyController
::
ThresholdInfoExt
&
ti
);
static
void
set_dumptime
(
UniXML
&
xml
,
xmlNode
*
node
);
static
void
set_dumptime
(
const
UniXML
&
xml
,
xmlNode
*
node
);
static
xmlNode
*
bind_node
(
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
bind_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
rebind_node
(
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
=
""
);
std
::
string
s_filterField
;
std
::
string
s_filterField
;
std
::
string
s_filterValue
;
std
::
string
s_filterValue
;
...
...
include/ORepHelpers.h
View file @
bc62c495
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
namespace
ORepHelpers
namespace
ORepHelpers
{
{
//! Получение ссылки на корень репозитория
//! Получение ссылки на корень репозитория
CosNaming
::
NamingContext_ptr
getRootNamingContext
(
CORBA
::
ORB_ptr
orb
,
CosNaming
::
NamingContext_ptr
getRootNamingContext
(
const
CORBA
::
ORB_ptr
orb
,
const
std
::
string
&
nsName
,
int
timeOutSec
=
2
);
const
std
::
string
&
nsName
,
int
timeOutSec
=
2
);
//! Получение контекста по заданному имени
//! Получение контекста по заданному имени
...
@@ -44,7 +44,7 @@ namespace ORepHelpers
...
@@ -44,7 +44,7 @@ namespace ORepHelpers
const
char
*
const
*
argv
,
const
std
::
string
&
nsName
)
const
char
*
const
*
argv
,
const
std
::
string
&
nsName
)
throw
(
UniSetTypes
::
ORepFailed
);
throw
(
UniSetTypes
::
ORepFailed
);
CosNaming
::
NamingContext_ptr
getContext
(
CORBA
::
ORB_ptr
orb
,
const
std
::
string
&
cname
,
CosNaming
::
NamingContext_ptr
getContext
(
const
CORBA
::
ORB_ptr
orb
,
const
std
::
string
&
cname
,
const
std
::
string
&
nsName
)
const
std
::
string
&
nsName
)
throw
(
UniSetTypes
::
ORepFailed
);
throw
(
UniSetTypes
::
ORepFailed
);
...
...
include/ObjectRepository.h
View file @
bc62c495
...
@@ -46,34 +46,34 @@
...
@@ -46,34 +46,34 @@
{
{
public
:
public
:
ObjectRepository
(
UniSetTypes
::
Configuration
*
conf
);
ObjectRepository
(
const
UniSetTypes
::
Configuration
*
conf
);
~
ObjectRepository
();
~
ObjectRepository
();
/**
/**
@defgroup ORepGroup Группа функций регистрации в репозитории объектов
@defgroup ORepGroup Группа функций регистрации в репозитории объектов
@{ */
@{ */
//! Функция регистрации объекта по имени с указанием секции
//! Функция регистрации объекта по имени с указанием секции
void
registration
(
const
std
::
string
&
name
,
const
UniSetTypes
::
ObjectPtr
oRef
,
const
std
::
string
&
section
,
bool
force
=
false
)
void
registration
(
const
std
::
string
&
name
,
const
UniSetTypes
::
ObjectPtr
oRef
,
const
std
::
string
&
section
,
bool
force
=
false
)
const
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
ObjectNameAlready
,
UniSetTypes
::
InvalidObjectName
,
UniSetTypes
::
NameNotFound
);
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
ObjectNameAlready
,
UniSetTypes
::
InvalidObjectName
,
UniSetTypes
::
NameNotFound
);
//! Функция регистрации объекта по полному имени.
//! Функция регистрации объекта по полному имени.
void
registration
(
const
std
::
string
&
fullName
,
const
UniSetTypes
::
ObjectPtr
oRef
,
bool
force
=
false
)
void
registration
(
const
std
::
string
&
fullName
,
const
UniSetTypes
::
ObjectPtr
oRef
,
bool
force
=
false
)
const
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
ObjectNameAlready
,
UniSetTypes
::
InvalidObjectName
,
UniSetTypes
::
NameNotFound
);
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
ObjectNameAlready
,
UniSetTypes
::
InvalidObjectName
,
UniSetTypes
::
NameNotFound
);
//! Удаление записи об объекте name в секции section
//! Удаление записи об объекте name в секции section
void
unregistration
(
const
std
::
string
&
name
,
const
std
::
string
&
section
)
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
void
unregistration
(
const
std
::
string
&
name
,
const
std
::
string
&
section
)
const
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
//! Удаление записи об объекте по полному имени
//! Удаление записи об объекте по полному имени
void
unregistration
(
const
std
::
string
&
fullName
)
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
void
unregistration
(
const
std
::
string
&
fullName
)
const
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
// @}
// @}
// end of ORepGroup
// end of ORepGroup
/*! Получение ссылки по заданному полному имени (разыменовывание) */
/*! Получение ссылки по заданному полному имени (разыменовывание) */
UniSetTypes
::
ObjectPtr
resolve
(
const
std
::
string
&
name
,
const
std
::
string
&
NSName
=
"NameService"
)
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
UniSetTypes
::
ObjectPtr
resolve
(
const
std
::
string
&
name
,
const
std
::
string
&
NSName
=
"NameService"
)
const
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
/*! Проверка существования и доступности объекта */
/*! Проверка существования и доступности объекта */
bool
isExist
(
UniSetTypes
::
ObjectPtr
oref
)
;
bool
isExist
(
const
UniSetTypes
::
ObjectPtr
oref
)
const
;
/*! Проверка существования и доступности объекта */
/*! Проверка существования и доступности объекта */
bool
isExist
(
const
std
::
string
&
fullName
);
bool
isExist
(
const
std
::
string
&
fullName
)
const
;
/**
/**
@defgroup ORepServiceGroup Группа сервисных функций Репозитория объектов
@defgroup ORepServiceGroup Группа сервисных функций Репозитория объектов
...
@@ -99,14 +99,14 @@
...
@@ -99,14 +99,14 @@
protected
:
protected
:
ObjectRepository
();
ObjectRepository
();
std
::
string
nsName
;
mutable
std
::
string
nsName
;
UniSetTypes
::
Configuration
*
uconf
;
const
UniSetTypes
::
Configuration
*
uconf
;
bool
list
(
const
std
::
string
&
section
,
UniSetTypes
::
ListObjectName
*
ls
,
unsigned
int
how_many
,
ObjectType
type
);
bool
list
(
const
std
::
string
&
section
,
UniSetTypes
::
ListObjectName
*
ls
,
unsigned
int
how_many
,
ObjectType
type
);
private
:
private
:
bool
init
();
bool
init
()
const
;
CosNaming
::
NamingContext_var
localctx
;
mutable
CosNaming
::
NamingContext_var
localctx
;
};
};
//};
//};
...
...
include/Restorer.h
View file @
bc62c495
...
@@ -48,7 +48,7 @@ class Restorer_XML
...
@@ -48,7 +48,7 @@ class Restorer_XML
\param sec - итератор (указатель) на корневой узел секции (SubscriberList)
\param sec - итератор (указатель) на корневой узел секции (SubscriberList)
\return TRUE - если чтение параметров прошло успешно, FALSE - если нет
\return TRUE - если чтение параметров прошло успешно, FALSE - если нет
*/
*/
typedef
sigc
::
slot
<
bool
,
UniXML
&
,
UniXML_iterator
&
,
xmlNode
*>
ReaderSlot
;
typedef
sigc
::
slot
<
bool
,
const
UniXML
&
,
UniXML_iterator
&
,
xmlNode
*>
ReaderSlot
;
/*! установить функцию для callback-вызова при чтении списка сообщений
/*! установить функцию для callback-вызова при чтении списка сообщений
For example:
For example:
...
@@ -98,7 +98,7 @@ class Restorer_XML
...
@@ -98,7 +98,7 @@ class Restorer_XML
UniSetTypes
::
ObjectId
&
cid
,
UniSetTypes
::
ObjectId
&
cnode
);
UniSetTypes
::
ObjectId
&
cid
,
UniSetTypes
::
ObjectId
&
cnode
);
/*! Функция поиска по текущему уровню (без рекурсии для дочерних узлов) */
/*! Функция поиска по текущему уровню (без рекурсии для дочерних узлов) */
static
xmlNode
*
find_node
(
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
static
xmlNode
*
find_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
const
std
::
string
&
nodename
,
const
std
::
string
&
nm
=
""
);
protected
:
protected
:
...
...
include/UInterface.h
View file @
bc62c495
This diff is collapsed.
Click to expand it.
include/UniSetObject.h
View file @
bc62c495
...
@@ -74,6 +74,8 @@ class UniSetObject:
...
@@ -74,6 +74,8 @@ class UniSetObject:
virtual
CORBA
::
Boolean
exist
();
virtual
CORBA
::
Boolean
exist
();
virtual
char
*
getName
(){
return
(
char
*
)
myname
.
c_str
();}
virtual
char
*
getName
(){
return
(
char
*
)
myname
.
c_str
();}
virtual
UniSetTypes
::
ObjectId
getId
(){
return
myid
;
}
virtual
UniSetTypes
::
ObjectId
getId
(){
return
myid
;
}
const
UniSetTypes
::
ObjectId
getId
()
const
{
return
myid
;
}
virtual
UniSetTypes
::
ObjectType
getType
()
{
return
UniSetTypes
::
getObjectType
(
"UniSetObject"
);
}
virtual
UniSetTypes
::
ObjectType
getType
()
{
return
UniSetTypes
::
getObjectType
(
"UniSetObject"
);
}
virtual
UniSetTypes
::
SimpleInfo
*
getInfo
();
virtual
UniSetTypes
::
SimpleInfo
*
getInfo
();
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
UniSetObject
&
obj
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
UniSetObject
&
obj
);
...
@@ -82,7 +84,7 @@ class UniSetObject:
...
@@ -82,7 +84,7 @@ class UniSetObject:
virtual
void
push
(
const
UniSetTypes
::
TransportMessage
&
msg
);
virtual
void
push
(
const
UniSetTypes
::
TransportMessage
&
msg
);
/*! получить ссылку (на себя) */
/*! получить ссылку (на себя) */
inline
UniSetTypes
::
ObjectPtr
getRef
()
inline
UniSetTypes
::
ObjectPtr
getRef
()
const
{
{
UniSetTypes
::
uniset_rwmutex_rlock
lock
(
refmutex
);
UniSetTypes
::
uniset_rwmutex_rlock
lock
(
refmutex
);
return
(
UniSetTypes
::
ObjectPtr
)
CORBA
::
Object
::
_duplicate
(
oref
);
return
(
UniSetTypes
::
ObjectPtr
)
CORBA
::
Object
::
_duplicate
(
oref
);
...
@@ -232,7 +234,7 @@ class UniSetObject:
...
@@ -232,7 +234,7 @@ class UniSetObject:
UniSetTypes
::
uniset_rwmutex
qmutex
;
UniSetTypes
::
uniset_rwmutex
qmutex
;
/*! замок для блокирования совместного доступа к очереди */
/*! замок для блокирования совместного доступа к очереди */
UniSetTypes
::
uniset_rwmutex
refmutex
;
mutable
UniSetTypes
::
uniset_rwmutex
refmutex
;
/*! размер очереди сообщений (при превышении происходит очистка) */
/*! размер очереди сообщений (при превышении происходит очистка) */
unsigned
int
SizeOfMessageQueue
;
unsigned
int
SizeOfMessageQueue
;
...
...
include/UniXML.h
View file @
bc62c495
...
@@ -46,11 +46,11 @@ class UniXML_iterator:
...
@@ -46,11 +46,11 @@ class UniXML_iterator:
{}
{}
UniXML_iterator
()
{}
UniXML_iterator
()
{}
std
::
string
getProp
(
const
std
::
string
&
name
)
const
;
std
::
string
getProp
(
const
std
::
string
&
name
);
std
::
string
getPropUtf8
(
const
std
::
string
&
name
)
const
;
std
::
string
getPropUtf8
(
const
std
::
string
&
name
);
int
getIntProp
(
const
std
::
string
&
name
)
const
;
int
getIntProp
(
const
std
::
string
&
name
);
/// if value if not positive ( <= 0 ), returns def
/// if value if not positive ( <= 0 ), returns def
int
getPIntProp
(
const
std
::
string
&
name
,
int
def
)
const
;
int
getPIntProp
(
const
std
::
string
&
name
,
int
def
)
;
void
setProp
(
const
std
::
string
&
name
,
const
std
::
string
&
text
);
void
setProp
(
const
std
::
string
&
name
,
const
std
::
string
&
text
);
bool
findName
(
const
std
::
string
&
node
,
const
std
::
string
&
searchname
);
bool
findName
(
const
std
::
string
&
node
,
const
std
::
string
&
searchname
);
...
@@ -87,7 +87,7 @@ class UniXML_iterator:
...
@@ -87,7 +87,7 @@ class UniXML_iterator:
bool
goChildren
();
bool
goChildren
();
// Получить текущий узел
// Получить текущий узел
xmlNode
*
getCurrent
()
const
xmlNode
*
getCurrent
()
{
{
return
curNode
;
return
curNode
;
}
}
...
@@ -134,6 +134,12 @@ public:
...
@@ -134,6 +134,12 @@ public:
return
xmlDocGetRootElement
(
doc
);
return
xmlDocGetRootElement
(
doc
);
}
}
inline
xmlNode
*
getFirstNode
()
const
{
return
xmlDocGetRootElement
(
doc
);
}
/*! возвращает итератор на самый первый узел документа */
/*! возвращает итератор на самый первый узел документа */
inline
iterator
begin
()
inline
iterator
begin
()
{
{
...
@@ -194,11 +200,11 @@ public:
...
@@ -194,11 +200,11 @@ public:
// После проверки исправить рекурсивный алгоритм на обычный,
// После проверки исправить рекурсивный алгоритм на обычный,
// используя ->parent
// используя ->parent
xmlNode
*
findNode
(
xmlNode
*
node
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
)
const
;
xmlNode
*
findNode
(
xmlNode
*
node
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
)
const
;
xmlNode
*
findNodeUtf8
(
xmlNode
*
node
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
)
const
;
xmlNode
*
findNodeUtf8
(
xmlNode
*
node
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
)
const
;
xmlNode
*
extFindNode
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
,
bool
top
=
true
)
;
xmlNode
*
extFindNode
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
,
bool
top
=
true
)
const
;
xmlNode
*
extFindNodeUtf8
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
,
bool
top
=
true
)
;
xmlNode
*
extFindNodeUtf8
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
std
::
string
&
searchnode
,
const
std
::
string
&
name
=
""
,
bool
top
=
true
)
const
;
protected
:
protected
:
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
bc62c495
...
@@ -2616,7 +2616,7 @@ std::ostream& ModbusRTU::operator<<(std::ostream& os, MEIMessageRetRDI& m )
...
@@ -2616,7 +2616,7 @@ std::ostream& ModbusRTU::operator<<(std::ostream& os, MEIMessageRetRDI& m )
if
(
!
m
.
dlist
.
empty
()
)
if
(
!
m
.
dlist
.
empty
()
)
{
{
os
<<
endl
;
os
<<
endl
;
for
(
RDIObjectList
::
iterator
it
=
m
.
dlist
.
begin
();
it
!=
m
.
dlist
.
end
();
it
++
)
for
(
RDIObjectList
::
iterator
it
=
m
.
dlist
.
begin
();
it
!=
m
.
dlist
.
end
();
++
it
)
os
<<
" "
<<
rdi2str
(
it
->
id
)
<<
" : "
<<
it
->
val
<<
endl
;
os
<<
" "
<<
rdi2str
(
it
->
id
)
<<
" : "
<<
it
->
val
<<
endl
;
}
}
...
@@ -2632,7 +2632,7 @@ std::ostream& ModbusRTU::operator<<(std::ostream& os,RDIObjectList& dlist )
...
@@ -2632,7 +2632,7 @@ std::ostream& ModbusRTU::operator<<(std::ostream& os,RDIObjectList& dlist )
{
{
if
(
!
dlist
.
empty
()
)
if
(
!
dlist
.
empty
()
)
{
{
for
(
RDIObjectList
::
iterator
it
=
dlist
.
begin
();
it
!=
dlist
.
end
();
it
++
)
for
(
RDIObjectList
::
iterator
it
=
dlist
.
begin
();
it
!=
dlist
.
end
();
++
it
)
os
<<
" "
<<
rdi2str
(
it
->
id
)
<<
" : "
<<
it
->
val
<<
endl
;
os
<<
" "
<<
rdi2str
(
it
->
id
)
<<
" : "
<<
it
->
val
<<
endl
;
}
}
...
...
src/Interfaces/UInterface.cc
View file @
bc62c495
This diff is collapsed.
Click to expand it.
src/ObjectRepository/IORFile.cc
View file @
bc62c495
...
@@ -37,7 +37,7 @@ IORFile::IORFile()
...
@@ -37,7 +37,7 @@ IORFile::IORFile()
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
string
IORFile
::
getIOR
(
const
ObjectId
id
,
const
ObjectId
node
)
string
IORFile
::
getIOR
(
const
ObjectId
id
,
const
ObjectId
node
)
const
{
{
string
fname
(
genFName
(
id
,
node
)
);
string
fname
(
genFName
(
id
,
node
)
);
ifstream
ior_file
(
fname
.
c_str
());
ifstream
ior_file
(
fname
.
c_str
());
...
@@ -47,7 +47,7 @@ string IORFile::getIOR( const ObjectId id, const ObjectId node )
...
@@ -47,7 +47,7 @@ string IORFile::getIOR( const ObjectId id, const ObjectId node )
return
sior
;
return
sior
;
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
void
IORFile
::
setIOR
(
const
ObjectId
id
,
const
ObjectId
node
,
const
string
&
sior
)
void
IORFile
::
setIOR
(
const
ObjectId
id
,
const
ObjectId
node
,
const
string
&
sior
)
const
{
{
string
fname
(
genFName
(
id
,
node
)
);
string
fname
(
genFName
(
id
,
node
)
);
ofstream
ior_file
(
fname
.
c_str
(),
ios
::
out
|
ios
::
trunc
);
ofstream
ior_file
(
fname
.
c_str
(),
ios
::
out
|
ios
::
trunc
);
...
@@ -62,30 +62,14 @@ void IORFile::setIOR( const ObjectId id, const ObjectId node, const string& sior
...
@@ -62,30 +62,14 @@ void IORFile::setIOR( const ObjectId id, const ObjectId node, const string& sior
ior_file
.
close
();
ior_file
.
close
();
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
void
IORFile
::
unlinkIOR
(
const
ObjectId
id
,
const
ObjectId
node
)
void
IORFile
::
unlinkIOR
(
const
ObjectId
id
,
const
ObjectId
node
)
const
{
{
string
fname
(
genFName
(
id
,
node
)
);
string
fname
(
genFName
(
id
,
node
)
);
// ostringstream cmd;
// cmd << "unlink " << fname;
// system(cmd.str().c_str());
unlink
(
fname
.
c_str
());
unlink
(
fname
.
c_str
());
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
string
IORFile
::
genFName
(
const
ObjectId
id
,
const
ObjectId
node
)
string
IORFile
::
genFName
(
const
ObjectId
id
,
const
ObjectId
node
)
const
{
{
/*
string oname(conf->oind->getMapName(id));
string nodename(conf->oind->getMapName(node));
oname = ORepHelpers::getShortName(oname);
nodename = conf->oind->getFullNodeName(nodename);
ostringstream fname;
if( oname.empty() )
fname << conf->getLockDir() << id << "." << node;
else
fname << conf->getLockDir() << oname << "." << nodename;
*/
ostringstream
fname
;
ostringstream
fname
;
fname
<<
conf
->
getLockDir
()
<<
id
<<
"."
<<
node
;
fname
<<
conf
->
getLockDir
()
<<
id
<<
"."
<<
node
;
return
fname
.
str
();
return
fname
.
str
();
...
...
src/ObjectRepository/ORepHelpers.cc
View file @
bc62c495
...
@@ -42,14 +42,14 @@ namespace ORepHelpers
...
@@ -42,14 +42,14 @@ namespace ORepHelpers
* \param cname - полное имя контекста ссылку на который, возвратит функция.
* \param cname - полное имя контекста ссылку на который, возвратит функция.
* \param argc, argv - параметры инициализации ORB
* \param argc, argv - параметры инициализации ORB
*/
*/
CosNaming
::
NamingContext_ptr
getContext
(
const
string
&
cname
,
int
argc
,
const
char
*
const
*
argv
,
const
string
&
nsName
)
throw
(
ORepFailed
)
CosNaming
::
NamingContext_ptr
getContext
(
const
string
&
cname
,
int
argc
,
const
char
*
const
*
argv
,
const
string
&
nsName
)
throw
(
ORepFailed
)
{
{
CORBA
::
ORB_var
orb
=
CORBA
::
ORB_init
(
argc
,
(
char
**
)
argv
);
CORBA
::
ORB_var
orb
=
CORBA
::
ORB_init
(
argc
,
(
char
**
)
argv
);
ulogrep
<<
"OREPHELP: orb init ok"
<<
endl
;
ulogrep
<<
"OREPHELP: orb init ok"
<<
endl
;
return
getContext
(
orb
,
cname
,
nsName
);
return
getContext
(
orb
,
cname
,
nsName
);
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
CosNaming
::
NamingContext_ptr
getContext
(
CORBA
::
ORB_ptr
orb
,
const
string
&
cname
,
const
string
&
servname
)
throw
(
ORepFailed
)
CosNaming
::
NamingContext_ptr
getContext
(
const
CORBA
::
ORB_ptr
orb
,
const
string
&
cname
,
const
string
&
servname
)
throw
(
ORepFailed
)
{
{
CosNaming
::
NamingContext_var
rootC
;
CosNaming
::
NamingContext_var
rootC
;
...
@@ -139,7 +139,7 @@ namespace ORepHelpers
...
@@ -139,7 +139,7 @@ namespace ORepHelpers
// ---------------------------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------------------
/*! \param orb - ссылка на ORB */
/*! \param orb - ссылка на ORB */
CosNaming
::
NamingContext_ptr
getRootNamingContext
(
CORBA
::
ORB_ptr
orb
,
const
string
&
nsName
,
int
timeoutSec
)
CosNaming
::
NamingContext_ptr
getRootNamingContext
(
const
CORBA
::
ORB_ptr
orb
,
const
string
&
nsName
,
int
timeoutSec
)
{
{
CosNaming
::
NamingContext_var
rootContext
;
CosNaming
::
NamingContext_var
rootContext
;
try
try
...
...
src/ObjectRepository/ObjectIndex_XML.cc
View file @
bc62c495
...
@@ -61,7 +61,7 @@ ObjectId ObjectIndex_XML::getIdByName( const string& name )
...
@@ -61,7 +61,7 @@ ObjectId ObjectIndex_XML::getIdByName( const string& name )
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
string
ObjectIndex_XML
::
getMapName
(
const
ObjectId
id
)
string
ObjectIndex_XML
::
getMapName
(
const
ObjectId
id
)
{
{
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>=
0
&&
(
unsigned
)
id
<
omap
.
size
()
)
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>=
0
)
return
omap
[
id
].
repName
;
return
omap
[
id
].
repName
;
return
""
;
return
""
;
...
@@ -69,7 +69,7 @@ string ObjectIndex_XML::getMapName( const ObjectId id )
...
@@ -69,7 +69,7 @@ string ObjectIndex_XML::getMapName( const ObjectId id )
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
string
ObjectIndex_XML
::
getTextName
(
const
ObjectId
id
)
string
ObjectIndex_XML
::
getTextName
(
const
ObjectId
id
)
{
{
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>=
0
&&
(
unsigned
)
id
<
omap
.
size
()
)
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>=
0
)
return
omap
[
id
].
textName
;
return
omap
[
id
].
textName
;
return
""
;
return
""
;
...
@@ -234,7 +234,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
...
@@ -234,7 +234,7 @@ 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
()
)
{
{
...
@@ -278,7 +278,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
...
@@ -278,7 +278,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string& sec, u
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_XML
::
getObjectInfo
(
const
ObjectId
id
)
const
ObjectInfo
*
ObjectIndex_XML
::
getObjectInfo
(
const
ObjectId
id
)
{
{
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>=
0
&&
(
unsigned
)
id
<
omap
.
size
()
)
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>=
0
)
return
&
omap
[
id
];
return
&
omap
[
id
];
return
NULL
;
return
NULL
;
...
...
src/ObjectRepository/ObjectIndex_idXML.cc
View file @
bc62c495
...
@@ -182,8 +182,6 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
...
@@ -182,8 +182,6 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
throw
NameNotFound
(
msg
.
str
());
throw
NameNotFound
(
msg
.
str
());
}
}
string
secname
=
xml
.
getProp
(
root
,
"section"
);
for
(
;
it
.
getCurrent
();
it
.
goNext
()
)
for
(
;
it
.
getCurrent
();
it
.
goNext
()
)
{
{
ObjectInfo
inf
;
ObjectInfo
inf
;
...
@@ -215,8 +213,6 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
...
@@ -215,8 +213,6 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
inf
.
data
=
(
void
*
)(
xmlNode
*
)(
it
);
inf
.
data
=
(
void
*
)(
xmlNode
*
)(
it
);
// omap[inf.id] = inf;
// mok[nodename] = inf.id;
omap
.
insert
(
MapObjects
::
value_type
(
inf
.
id
,
inf
));
// omap[inf.id] = inf;
omap
.
insert
(
MapObjects
::
value_type
(
inf
.
id
,
inf
));
// omap[inf.id] = inf;
mok
.
insert
(
MapObjectKey
::
value_type
(
nodename
,
inf
.
id
));
// mok[name] = inf.id;
mok
.
insert
(
MapObjectKey
::
value_type
(
nodename
,
inf
.
id
));
// mok[name] = inf.id;
}
}
...
@@ -234,7 +230,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id )
...
@@ -234,7 +230,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id )
const
ObjectInfo
*
ObjectIndex_idXML
::
getObjectInfo
(
const
std
::
string
&
name
)
const
ObjectInfo
*
ObjectIndex_idXML
::
getObjectInfo
(
const
std
::
string
&
name
)
{
{
const
char
*
n
=
name
.
c_str
();
const
char
*
n
=
name
.
c_str
();
for
(
MapObjects
::
iterator
it
=
omap
.
begin
();
it
!=
omap
.
end
();
it
++
)
for
(
MapObjects
::
iterator
it
=
omap
.
begin
();
it
!=
omap
.
end
();
++
it
)
{
{
if
(
!
strcmp
(
it
->
second
.
repName
,
n
)
)
if
(
!
strcmp
(
it
->
second
.
repName
,
n
)
)
return
&
(
it
->
second
);
return
&
(
it
->
second
);
...
...
src/ObjectRepository/ObjectRepository.cc
View file @
bc62c495
...
@@ -35,16 +35,8 @@ using namespace omni;
...
@@ -35,16 +35,8 @@ using namespace omni;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
using
namespace
std
;
using
namespace
std
;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
/*
ObjectRepository::ObjectRepository(int* argc, char* **argv, const char* NSName):
argc(*argc),
argv(*argv),
nsName(NSName)
{
}
*/
ObjectRepository
::
ObjectRepository
(
Configuration
*
_conf
)
:
ObjectRepository
::
ObjectRepository
(
const
Configuration
*
_conf
)
:
nsName
(
_conf
->
getNSName
()),
nsName
(
_conf
->
getNSName
()),
uconf
(
_conf
)
uconf
(
_conf
)
{
{
...
@@ -62,7 +54,7 @@ nsName("NameService")
...
@@ -62,7 +54,7 @@ nsName("NameService")
init
();
init
();
}
}
bool
ObjectRepository
::
init
()
bool
ObjectRepository
::
init
()
const
{
{
try
try
{
{
...
@@ -93,7 +85,7 @@ bool ObjectRepository::init()
...
@@ -93,7 +85,7 @@ bool ObjectRepository::init()
* \exception ORepFailed - генерируется если произошла ошибка при регистрации
* \exception ORepFailed - генерируется если произошла ошибка при регистрации
* \sa registration(const string fullName, const CORBA::Object_ptr oRef)
* \sa registration(const string fullName, const CORBA::Object_ptr oRef)
*/
*/
void
ObjectRepository
::
registration
(
const
string
&
name
,
const
ObjectPtr
oRef
,
const
string
&
section
,
bool
force
)
void
ObjectRepository
::
registration
(
const
string
&
name
,
const
ObjectPtr
oRef
,
const
string
&
section
,
bool
force
)
const
throw
(
ORepFailed
,
ObjectNameAlready
,
InvalidObjectName
,
NameNotFound
)
throw
(
ORepFailed
,
ObjectNameAlready
,
InvalidObjectName
,
NameNotFound
)
{
{
ostringstream
err
;
ostringstream
err
;
...
@@ -174,7 +166,7 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
...
@@ -174,7 +166,7 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
* \exception ORepFailed - генерируется если произошла ошибка при регистрации
* \exception ORepFailed - генерируется если произошла ошибка при регистрации
* \sa registration(const string name, const ObjectPtr oRef, const string section)
* \sa registration(const string name, const ObjectPtr oRef, const string section)
*/
*/
void
ObjectRepository
::
registration
(
const
std
::
string
&
fullName
,
const
UniSetTypes
::
ObjectPtr
oRef
,
bool
force
)
void
ObjectRepository
::
registration
(
const
std
::
string
&
fullName
,
const
UniSetTypes
::
ObjectPtr
oRef
,
bool
force
)
const
throw
(
ORepFailed
,
ObjectNameAlready
,
InvalidObjectName
,
NameNotFound
)
throw
(
ORepFailed
,
ObjectNameAlready
,
InvalidObjectName
,
NameNotFound
)
{
{
// string n(ORepHelpers::getShortName(fullName));
// string n(ORepHelpers::getShortName(fullName));
...
@@ -192,7 +184,7 @@ void ObjectRepository::registration( const std::string& fullName, const UniSetTy
...
@@ -192,7 +184,7 @@ void ObjectRepository::registration( const std::string& fullName, const UniSetTy
* проверки на, то не является ли имя ссылкой на объект или контекст
* проверки на, то не является ли имя ссылкой на объект или контекст
* т.к. для удаления ссылки на контекст нужен алгоритм посложнее...
* т.к. для удаления ссылки на контекст нужен алгоритм посложнее...
*/
*/
void
ObjectRepository
::
unregistration
(
const
string
&
name
,
const
string
&
section
)
void
ObjectRepository
::
unregistration
(
const
string
&
name
,
const
string
&
section
)
const
throw
(
ORepFailed
,
NameNotFound
)
throw
(
ORepFailed
,
NameNotFound
)
{
{
ostringstream
err
;
ostringstream
err
;
...
@@ -231,7 +223,7 @@ void ObjectRepository::unregistration(const string& name, const string& section)
...
@@ -231,7 +223,7 @@ void ObjectRepository::unregistration(const string& name, const string& section)
* \exception ORepFailed - генерируется если произошла ошибка при удалении
* \exception ORepFailed - генерируется если произошла ошибка при удалении
* \sa unregistration(const string name, const string section)
* \sa unregistration(const string name, const string section)
*/
*/
void
ObjectRepository
::
unregistration
(
const
string
&
fullName
)
void
ObjectRepository
::
unregistration
(
const
string
&
fullName
)
const
throw
(
ORepFailed
,
NameNotFound
)
throw
(
ORepFailed
,
NameNotFound
)
{
{
// string n(ORepHelpers::getShortName(fullName));
// string n(ORepHelpers::getShortName(fullName));
...
@@ -241,7 +233,7 @@ void ObjectRepository::unregistration(const string& fullName)
...
@@ -241,7 +233,7 @@ void ObjectRepository::unregistration(const string& fullName)
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
ObjectPtr
ObjectRepository
::
resolve
(
const
string
&
name
,
const
string
&
NSName
)
ObjectPtr
ObjectRepository
::
resolve
(
const
string
&
name
,
const
string
&
NSName
)
const
throw
(
ORepFailed
,
NameNotFound
)
throw
(
ORepFailed
,
NameNotFound
)
{
{
ostringstream
err
;
ostringstream
err
;
...
@@ -281,8 +273,8 @@ ObjectPtr ObjectRepository::resolve( const string& name, const string& NSName )
...
@@ -281,8 +273,8 @@ ObjectPtr ObjectRepository::resolve( const string& name, const string& NSName )
err
<<
"ObjectRepository(resolve): catch ... для "
<<
name
;
err
<<
"ObjectRepository(resolve): catch ... для "
<<
name
;
}
}
if
(
err
.
str
().
empty
()
)
if
(
err
.
str
().
empty
()
)
err
<<
"ObjectRepository(resolve):
??? для "
<<
name
;
err
<<
"ObjectRepository(resolve):
unknown error for '"
<<
name
<<
"'"
;
throw
ORepFailed
(
err
.
str
().
c_str
());
throw
ORepFailed
(
err
.
str
().
c_str
());
}
}
...
@@ -392,7 +384,7 @@ bool ObjectRepository::list(const string& section, ListObjectName *ls, unsigned
...
@@ -392,7 +384,7 @@ bool ObjectRepository::list(const string& section, ListObjectName *ls, unsigned
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
bool
ObjectRepository
::
isExist
(
const
string
&
fullName
)
bool
ObjectRepository
::
isExist
(
const
string
&
fullName
)
const
{
{
try
try
{
{
...
@@ -406,7 +398,7 @@ bool ObjectRepository::isExist( const string& fullName )
...
@@ -406,7 +398,7 @@ bool ObjectRepository::isExist( const string& fullName )
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
bool
ObjectRepository
::
isExist
(
ObjectPtr
oref
)
bool
ObjectRepository
::
isExist
(
const
ObjectPtr
oref
)
const
{
{
try
try
{
{
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
bc62c495
...
@@ -223,7 +223,7 @@ using namespace UniSetTypes;
...
@@ -223,7 +223,7 @@ using namespace UniSetTypes;
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
UniSetTypes
::
is_digit
(
const
std
::
string
&
s
)
bool
UniSetTypes
::
is_digit
(
const
std
::
string
&
s
)
{
{
for
(
std
::
string
::
const_iterator
it
=
s
.
begin
();
it
!=
s
.
end
();
it
++
)
for
(
std
::
string
::
const_iterator
it
=
s
.
begin
();
it
!=
s
.
end
();
++
it
)
{
{
if
(
!
isdigit
(
*
it
)
)
if
(
!
isdigit
(
*
it
)
)
return
false
;
return
false
;
...
...
src/Processes/IOController.cc
View file @
bc62c495
src/Processes/IONotifyController.cc
View file @
bc62c495
...
@@ -376,6 +376,8 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li,
...
@@ -376,6 +376,8 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li,
*/
*/
void
IONotifyController
::
send
(
ConsumerList
&
lst
,
UniSetTypes
::
SensorMessage
&
sm
)
void
IONotifyController
::
send
(
ConsumerList
&
lst
,
UniSetTypes
::
SensorMessage
&
sm
)
{
{
TransportMessage
tmsg
;
for
(
ConsumerList
::
iterator
li
=
lst
.
begin
();
li
!=
lst
.
end
();
++
li
)
for
(
ConsumerList
::
iterator
li
=
lst
.
begin
();
li
!=
lst
.
end
();
++
li
)
{
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
// на каждый объект по две поптыки
for
(
int
i
=
0
;
i
<
2
;
i
++
)
// на каждый объект по две поптыки
...
@@ -389,7 +391,15 @@ void IONotifyController::send(ConsumerList& lst, UniSetTypes::SensorMessage& sm)
...
@@ -389,7 +391,15 @@ void IONotifyController::send(ConsumerList& lst, UniSetTypes::SensorMessage& sm)
}
}
sm
.
consumer
=
li
->
id
;
sm
.
consumer
=
li
->
id
;
li
->
ref
->
push
(
sm
.
transport_msg
()
);
// Для оптимизации, чтобы избежать лишее копирование и создание TransportMessage
// не используем sm.transport_msg()
// а формируем TransportMessage самостоятельно..
assert
(
sizeof
(
UniSetTypes
::
RawDataOfTransportMessage
)
>=
sizeof
(
sm
));
memcpy
(
&
tmsg
.
data
,
&
sm
,
sizeof
(
sm
));
li
->
ref
->
push
(
tmsg
);
li
->
attempt
=
maxAttemtps
;
// reinit attempts
li
->
attempt
=
maxAttemtps
;
// reinit attempts
break
;
break
;
}
}
...
...
src/Processes/NCRestorer.cc
View file @
bc62c495
...
@@ -127,43 +127,6 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
...
@@ -127,43 +127,6 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
ic
->
askTMap
[
k
].
type
=
inf
.
type
;
ic
->
askTMap
[
k
].
type
=
inf
.
type
;
ic
->
askTMap
[
k
].
list
=
lst
;
ic
->
askTMap
[
k
].
list
=
lst
;
ic
->
askTMap
[
k
].
ait
=
ic
->
myioEnd
();
ic
->
askTMap
[
k
].
ait
=
ic
->
myioEnd
();
// Начальная инициализация делается в IOController (IONotifyContoller) в момент "активации". см. IOController::activateInit()
#if 0
try
{
switch( inf.type )
{
case UniversalIO::DI:
case UniversalIO::DO:
break;
case UniversalIO::AO:
case UniversalIO::AI:
{
IOController::IOStateList::iterator it(ic->myioEnd());
ic->checkThreshold(it,inf.si,false);
}
break;
default:
break;
}
}
catch( Exception& ex )
{
uwarn << ic->getName() << "(NCRestorer::addthresholdlist): " << ex
<< " для " << conf->oind->getNameById(inf.si.id, inf.si.node) << endl;
throw;
}
catch( CORBA::SystemException& ex )
{
uwarn << ic->getName() << "(NCRestorer::addthresholdlist): "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << " недоступен!!(CORBA::SystemException): "
<< ex.NP_minorString() << endl;
throw;
}
#endif
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
NCRestorer
::
SInfo
&
NCRestorer
::
SInfo
::
operator
=
(
IOController_i
::
SensorIOInfo
&
inf
)
NCRestorer
::
SInfo
&
NCRestorer
::
SInfo
::
operator
=
(
IOController_i
::
SensorIOInfo
&
inf
)
...
...
src/Processes/NCRestorer_XML.cc
View file @
bc62c495
...
@@ -85,7 +85,7 @@ void NCRestorer_XML::init( const std::string& fname )
...
@@ -85,7 +85,7 @@ void NCRestorer_XML::init( const std::string& fname )
try
try
{
{
if
(
fname
==
conf
->
getConfFileName
()
)
if
(
fname
==
conf
->
getConfFileName
()
)
uxml
=
con
f
->
getConfXML
(
);
uxml
=
con
st_cast
<
UniXML
*>
(
conf
->
getConfXML
()
);
else
else
uxml
=
new
UniXML
(
fname
);
uxml
=
new
UniXML
(
fname
);
}
}
...
@@ -95,19 +95,19 @@ void NCRestorer_XML::init( const std::string& fname )
...
@@ -95,19 +95,19 @@ void NCRestorer_XML::init( const std::string& fname )
}
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
dump
(
IONotifyController
*
ic
,
SInfo
&
inf
,
void
NCRestorer_XML
::
dump
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ConsumerList
&
lst
)
const
IONotifyController
::
ConsumerList
&
lst
)
{
{
uwarn
<<
"NCRestorer_XML::dump NOT SUPPORT!!!!"
<<
endl
;
uwarn
<<
"NCRestorer_XML::dump NOT SUPPORT!!!!"
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
dumpThreshold
(
IONotifyController
*
ic
,
SInfo
&
inf
,
void
NCRestorer_XML
::
dumpThreshold
(
const
IONotifyController
*
ic
,
SInfo
&
inf
,
const
IONotifyController
::
ThresholdExtList
&
lst
)
const
IONotifyController
::
ThresholdExtList
&
lst
)
{
{
uwarn
<<
"NCRestorer_XML::dumpThreshold NOT SUPPORT!!!!"
<<
endl
;
uwarn
<<
"NCRestorer_XML::dumpThreshold NOT SUPPORT!!!!"
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
read_list
(
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
)
void
NCRestorer_XML
::
read_list
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
)
{
{
UniXML_iterator
it
(
node
);
UniXML_iterator
it
(
node
);
if
(
!
it
.
goChildren
()
)
if
(
!
it
.
goChildren
()
)
...
@@ -162,7 +162,7 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController*
...
@@ -162,7 +162,7 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController*
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
read
(
IONotifyController
*
ic
,
const
string
&
fn
)
void
NCRestorer_XML
::
read
(
IONotifyController
*
ic
,
const
string
&
fn
)
{
{
UniXML
*
confxml
=
conf
->
getConfXML
();
const
UniXML
*
confxml
=
conf
->
getConfXML
();
if
(
!
fn
.
empty
()
)
if
(
!
fn
.
empty
()
)
{
{
...
@@ -192,14 +192,14 @@ void NCRestorer_XML::read( IONotifyController* ic, const string& fn )
...
@@ -192,14 +192,14 @@ void NCRestorer_XML::read( IONotifyController* ic, const string& fn )
}
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
read
(
IONotifyController
*
ic
,
UniXML
&
xml
)
void
NCRestorer_XML
::
read
(
IONotifyController
*
ic
,
const
UniXML
&
xml
)
{
{
xmlNode
*
node
;
xmlNode
*
node
;
if
(
(
&
xml
)
==
conf
->
getConfXML
()
)
if
(
(
&
xml
)
==
conf
->
getConfXML
()
)
node
=
conf
->
getXMLSensorsSection
();
node
=
conf
->
getXMLSensorsSection
();
else
else
node
=
xml
.
findNode
(
xml
.
getFirstNode
(),
"sensors"
);
node
=
xml
.
findNode
(
xml
.
getFirstNode
(),
"sensors"
);
if
(
node
)
if
(
node
)
{
{
...
@@ -215,7 +215,7 @@ void NCRestorer_XML::read( IONotifyController* ic, UniXML& xml )
...
@@ -215,7 +215,7 @@ void NCRestorer_XML::read( IONotifyController* ic, UniXML& xml )
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
NCRestorer_XML
::
getBaseInfo
(
UniXML
&
xml
,
xmlNode
*
it
,
IOController_i
::
SensorInfo
&
si
)
bool
NCRestorer_XML
::
getBaseInfo
(
const
UniXML
&
xml
,
xmlNode
*
it
,
IOController_i
::
SensorInfo
&
si
)
{
{
string
sname
(
xml
.
getProp
(
it
,
"name"
));
string
sname
(
xml
.
getProp
(
it
,
"name"
));
if
(
sname
.
empty
()
)
if
(
sname
.
empty
()
)
...
@@ -255,7 +255,7 @@ bool NCRestorer_XML::getBaseInfo( UniXML& xml, xmlNode* it, IOController_i::Sens
...
@@ -255,7 +255,7 @@ bool NCRestorer_XML::getBaseInfo( UniXML& xml, xmlNode* it, IOController_i::Sens
return
true
;
return
true
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
NCRestorer_XML
::
getSensorInfo
(
UniXML
&
xml
,
xmlNode
*
it
,
SInfo
&
inf
)
bool
NCRestorer_XML
::
getSensorInfo
(
const
UniXML
&
xml
,
xmlNode
*
it
,
SInfo
&
inf
)
{
{
if
(
!
getBaseInfo
(
xml
,
it
,
inf
.
si
)
)
if
(
!
getBaseInfo
(
xml
,
it
,
inf
.
si
)
)
return
false
;
return
false
;
...
@@ -328,7 +328,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
...
@@ -328,7 +328,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
return
true
;
return
true
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
read_thresholds
(
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
)
void
NCRestorer_XML
::
read_thresholds
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
*
ic
)
{
{
UniXML_iterator
it
(
node
);
UniXML_iterator
it
(
node
);
if
(
!
it
.
goChildren
()
)
if
(
!
it
.
goChildren
()
)
...
@@ -398,7 +398,7 @@ void NCRestorer_XML::read_thresholds(UniXML& xml, xmlNode* node, IONotifyControl
...
@@ -398,7 +398,7 @@ void NCRestorer_XML::read_thresholds(UniXML& xml, xmlNode* node, IONotifyControl
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
NCRestorer_XML
::
read_consumers
(
UniXML
&
xml
,
xmlNode
*
it
,
void
NCRestorer_XML
::
read_consumers
(
const
UniXML
&
xml
,
xmlNode
*
it
,
NCRestorer_XML
::
SInfo
&
inf
,
IONotifyController
*
ic
)
NCRestorer_XML
::
SInfo
&
inf
,
IONotifyController
*
ic
)
{
{
// в новых ask-файлах список выделен <consumers>...</consumers>,
// в новых ask-файлах список выделен <consumers>...</consumers>,
...
@@ -416,7 +416,7 @@ void NCRestorer_XML::read_consumers( UniXML& xml, xmlNode* it,
...
@@ -416,7 +416,7 @@ void NCRestorer_XML::read_consumers( UniXML& xml, xmlNode* it,
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
NCRestorer_XML
::
getConsumerList
(
UniXML
&
xml
,
xmlNode
*
node
,
bool
NCRestorer_XML
::
getConsumerList
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
::
ConsumerList
&
lst
)
IONotifyController
::
ConsumerList
&
lst
)
{
{
UniXML_iterator
it
(
node
);
UniXML_iterator
it
(
node
);
...
@@ -438,7 +438,7 @@ bool NCRestorer_XML::getConsumerList( UniXML& xml,xmlNode* node,
...
@@ -438,7 +438,7 @@ bool NCRestorer_XML::getConsumerList( UniXML& xml,xmlNode* node,
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
bool
NCRestorer_XML
::
getThresholdInfo
(
UniXML
&
xml
,
xmlNode
*
node
,
bool
NCRestorer_XML
::
getThresholdInfo
(
const
UniXML
&
xml
,
xmlNode
*
node
,
IONotifyController
::
ThresholdInfoExt
&
ti
)
IONotifyController
::
ThresholdInfoExt
&
ti
)
{
{
UniXML_iterator
uit
(
node
);
UniXML_iterator
uit
(
node
);
...
...
src/Various/LT_Object.cc
View file @
bc62c495
src/Various/Restorer_XML.cc
View file @
bc62c495
...
@@ -125,7 +125,7 @@ bool Restorer_XML::check_consumer_item( UniXML_iterator& it )
...
@@ -125,7 +125,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
(
UniXML
&
xml
,
xmlNode
*
root
,
xmlNode
*
Restorer_XML
::
find_node
(
const
UniXML
&
xml
,
xmlNode
*
root
,
const
string
&
nodename
,
const
string
&
nm
)
const
string
&
nodename
,
const
string
&
nm
)
{
{
UniXML_iterator
it
(
root
);
UniXML_iterator
it
(
root
);
...
...
src/Various/UniXML.cc
View file @
bc62c495
...
@@ -230,29 +230,30 @@ xmlNode* UniXML::nextNode(xmlNode* n)
...
@@ -230,29 +230,30 @@ xmlNode* UniXML::nextNode(xmlNode* n)
return
n
;
return
n
;
}
}
xmlNode
*
UniXML
::
findNode
(
xmlNode
*
node
,
const
string
&
searchnode
,
const
string
&
name
)
const
xmlNode
*
UniXML
::
findNode
(
xmlNode
*
node
,
const
string
&
searchnode
,
const
string
&
name
)
const
{
{
while
(
node
!=
NULL
)
xmlNode
*
fnode
=
node
;
while
(
fnode
!=
NULL
)
{
{
if
(
searchnode
==
(
const
char
*
)
node
->
name
)
if
(
searchnode
==
(
const
char
*
)
f
node
->
name
)
{
{
/* Если name не задано, не сверяем. Иначе ищем, пока не найдём с таким именем */
/* Если name не задано, не сверяем. Иначе ищем, пока не найдём с таким именем */
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
return
node
;
return
f
node
;
if
(
name
==
getProp
(
node
,
"name"
)
)
if
(
name
==
getProp
(
f
node
,
"name"
)
)
return
node
;
return
f
node
;
}
}
xmlNode
*
nodeFound
=
findNode
(
node
->
children
,
searchnode
,
name
);
xmlNode
*
nodeFound
=
findNode
(
f
node
->
children
,
searchnode
,
name
);
if
(
nodeFound
!=
NULL
)
if
(
nodeFound
!=
NULL
)
return
nodeFound
;
return
nodeFound
;
node
=
node
->
next
;
fnode
=
f
node
->
next
;
}
}
return
NULL
;
return
NULL
;
}
}
xmlNode
*
UniXML
::
findNodeUtf8
(
xmlNode
*
node
,
const
string
&
searchnode
,
const
string
&
name
)
const
xmlNode
*
UniXML
::
findNodeUtf8
(
xmlNode
*
node
,
const
string
&
searchnode
,
const
string
&
name
)
const
{
{
return
findNode
(
node
,
searchnode
,
name
);
return
findNode
(
node
,
searchnode
,
name
);
}
}
...
@@ -264,33 +265,34 @@ xmlNode* UniXML::findNodeUtf8(xmlNode* node, const string& searchnode, const str
...
@@ -264,33 +265,34 @@ xmlNode* UniXML::findNodeUtf8(xmlNode* node, const string& searchnode, const str
//width means number of nodes of the same level as node in 1-st parameter (width number includes first node)
//width means number of nodes of the same level as node in 1-st parameter (width number includes first node)
//depth means number of times we can go to the children, if 0 we can't go only to elements of the same level
//depth means number of times we can go to the children, if 0 we can't go only to elements of the same level
xmlNode
*
UniXML
::
extFindNode
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
string
&
searchnode
,
const
string
&
name
,
bool
top
)
xmlNode
*
UniXML
::
extFindNode
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
string
&
searchnode
,
const
string
&
name
,
bool
top
)
const
{
{
int
i
=
0
;
int
i
=
0
;
while
(
node
!=
NULL
)
xmlNode
*
fnode
=
node
;
while
(
fnode
!=
NULL
)
{
{
if
(
top
&&
(
i
>=
width
))
return
NULL
;
if
(
top
&&
(
i
>=
width
))
return
NULL
;
if
(
searchnode
==
(
const
char
*
)
node
->
name
)
if
(
searchnode
==
(
const
char
*
)
f
node
->
name
)
{
{
if
(
name
==
getProp
(
node
,
"name"
)
)
if
(
name
==
getProp
(
f
node
,
"name"
)
)
return
node
;
return
f
node
;
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
return
node
;
return
node
;
}
}
if
(
depth
>
0
)
if
(
depth
>
0
)
{
{
xmlNode
*
nodeFound
=
extFindNode
(
node
->
children
,
depth
-
1
,
width
,
searchnode
,
name
,
false
);
xmlNode
*
nodeFound
=
extFindNode
(
f
node
->
children
,
depth
-
1
,
width
,
searchnode
,
name
,
false
);
if
(
nodeFound
!=
NULL
)
if
(
nodeFound
!=
NULL
)
return
nodeFound
;
return
nodeFound
;
}
}
i
++
;
i
++
;
node
=
node
->
next
;
fnode
=
f
node
->
next
;
}
}
return
NULL
;
return
NULL
;
}
}
xmlNode
*
UniXML
::
extFindNodeUtf8
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
string
&
searchnode
,
const
string
&
name
,
bool
top
)
xmlNode
*
UniXML
::
extFindNodeUtf8
(
xmlNode
*
node
,
int
depth
,
int
width
,
const
string
&
searchnode
,
const
string
&
name
,
bool
top
)
const
{
{
return
extFindNode
(
node
,
depth
,
width
,
searchnode
,
name
,
top
);
return
extFindNode
(
node
,
depth
,
width
,
searchnode
,
name
,
top
);
}
}
...
@@ -381,7 +383,7 @@ bool UniXML_iterator::goChildren()
...
@@ -381,7 +383,7 @@ bool UniXML_iterator::goChildren()
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string
UniXML_iterator
::
getProp
(
const
string
&
name
)
const
string
UniXML_iterator
::
getProp
(
const
string
&
name
)
{
{
return
UniXML
::
getProp
(
curNode
,
name
);
return
UniXML
::
getProp
(
curNode
,
name
);
}
}
...
@@ -395,18 +397,18 @@ const string UniXML_iterator::getContent() const
...
@@ -395,18 +397,18 @@ const string UniXML_iterator::getContent() const
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string
UniXML_iterator
::
getPropUtf8
(
const
string
&
name
)
const
string
UniXML_iterator
::
getPropUtf8
(
const
string
&
name
)
{
{
return
UniXML
::
getProp
(
curNode
,
name
);
return
UniXML
::
getProp
(
curNode
,
name
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
int
UniXML_iterator
::
getIntProp
(
const
string
&
name
)
const
int
UniXML_iterator
::
getIntProp
(
const
string
&
name
)
{
{
return
UniSetTypes
::
uni_atoi
(
UniXML
::
getProp
(
curNode
,
name
));
return
UniSetTypes
::
uni_atoi
(
UniXML
::
getProp
(
curNode
,
name
));
}
}
int
UniXML_iterator
::
getPIntProp
(
const
string
&
name
,
int
def
)
const
int
UniXML_iterator
::
getPIntProp
(
const
string
&
name
,
int
def
)
{
{
int
i
=
getIntProp
(
name
);
int
i
=
getIntProp
(
name
);
if
(
i
<=
0
)
if
(
i
<=
0
)
...
...
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