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
9b14a94b
Commit
9b14a94b
authored
Jun 11, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
global make style
parent
7a75750e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
189 additions
and
146 deletions
+189
-146
admin.cc
Utilities/Admin/admin.cc
+4
-4
log.cc
Utilities/ULog/log.cc
+10
-10
logserver.cc
Utilities/ULog/logserver.cc
+3
-1
TestGen.cc
Utilities/codegen/tests/TestGen.cc
+4
-4
TestGen.h
Utilities/codegen/tests/TestGen.h
+2
-2
test.xml
conf/test.xml
+9
-0
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+3
-1
MBTCPTestServer.cc
extensions/ModbusMaster/tests/MBTCPTestServer.cc
+1
-1
MBTCPTestServer.h
extensions/ModbusMaster/tests/MBTCPTestServer.h
+4
-1
MBTCPMultiSlave.cc
extensions/ModbusSlave/MBTCPMultiSlave.cc
+3
-1
test_mbslave.cc
extensions/ModbusSlave/tests/test_mbslave.cc
+2
-2
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+3
-1
UObject_SK.h
extensions/include/UObject_SK.h
+0
-0
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
smemory-test.cc
extensions/tests/SMemoryTest/smemory-test.cc
+1
-1
VMonitor.h
include/VMonitor.h
+11
-5
ModbusTCPMaster.h
include/modbus/ModbusTCPMaster.h
+8
-2
LogAgregator.cc
src/Log/LogAgregator.cc
+10
-6
LogReader.cc
src/Log/LogReader.cc
+9
-6
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+6
-4
IONotifyController.cc
src/Processes/IONotifyController.cc
+1
-0
VMonitor.cc
src/Various/VMonitor.cc
+85
-85
develop.cc
tests/develop.cc
+3
-3
test_logserver.cc
tests/test_logserver.cc
+1
-0
test_utypes.cc
tests/test_utypes.cc
+6
-6
No files found.
Utilities/Admin/admin.cc
View file @
9b14a94b
...
...
@@ -751,10 +751,10 @@ int getChangedTime( const std::string& args, UInterface& ui )
{
cout
<<
" name: ("
<<
it
.
si
.
id
<<
") "
<<
it
.
fname
<<
endl
;
cout
<<
" text: "
<<
conf
->
oind
->
getTextName
(
it
.
si
.
id
)
<<
"
\n\n
"
;
cout
<<
ui
.
getChangedTime
(
it
.
si
.
id
,
it
.
si
.
node
)
<<
endl
;
cout
<<
ui
.
getChangedTime
(
it
.
si
.
id
,
it
.
si
.
node
)
<<
endl
;
}
else
cout
<<
ui
.
getChangedTime
(
it
.
si
.
id
,
it
.
si
.
node
);
cout
<<
ui
.
getChangedTime
(
it
.
si
.
id
,
it
.
si
.
node
);
}
catch
(
const
Exception
&
ex
)
{
...
...
@@ -845,14 +845,14 @@ int oinfo( const string& args, UInterface& ui )
auto
conf
=
uniset_conf
();
auto
sl
=
UniSetTypes
::
getSInfoList
(
args
,
conf
);
for
(
auto
&&
it
:
sl
)
for
(
auto
&&
it
:
sl
)
{
if
(
it
.
si
.
node
==
DefaultObjectId
)
it
.
si
.
node
=
conf
->
getLocalNode
();
try
{
UniSetTypes
::
ObjectVar
o
=
ui
.
resolve
(
it
.
si
.
id
,
it
.
si
.
node
);
UniSetTypes
::
ObjectVar
o
=
ui
.
resolve
(
it
.
si
.
id
,
it
.
si
.
node
);
UniSetObject_i_var
obj
=
UniSetObject_i
::
_narrow
(
o
);
if
(
CORBA
::
is_nil
(
obj
))
...
...
Utilities/ULog/log.cc
View file @
9b14a94b
...
...
@@ -139,7 +139,7 @@ int main( int argc, char** argv )
if
(
arg2
)
filter
=
string
(
arg2
);
vcmd
.
push_back
(
LogReader
::
Command
(
LogServerTypes
::
cmdList
,
0
,
filter
)
);
vcmd
.
push_back
(
LogReader
::
Command
(
LogServerTypes
::
cmdList
,
0
,
filter
)
);
cmdlist
=
true
;
}
break
;
...
...
@@ -239,15 +239,15 @@ int main( int argc, char** argv )
lr
.
setinTimeout
(
tout
);
lr
.
setReconnectDelay
(
rdelay
);
/*
if( cmdlist && vcmd.size() == 1 )
{
cmdonly = 1;
lr.setReadCount(1);
lr.sendCommand(addr, port, vcmd, cmdonly, verb);
return 0;
}
*/
/*
if( cmdlist && vcmd.size() == 1 )
{
cmdonly = 1;
lr.setReadCount(1);
lr.sendCommand(addr, port, vcmd, cmdonly, verb);
return 0;
}
*/
if
(
!
vcmd
.
empty
()
)
lr
.
sendCommand
(
addr
,
port
,
vcmd
,
cmdonly
,
verb
);
...
...
Utilities/ULog/logserver.cc
View file @
9b14a94b
...
...
@@ -123,7 +123,7 @@ int main( int argc, char** argv )
la2
->
add
(
dlog
);
la2
->
add
(
dlog2
);
la
->
add
(
la2
);
if
(
la
->
getLog
(
"la2/dlog3"
)
==
nullptr
)
...
...
@@ -139,6 +139,7 @@ int main( int argc, char** argv )
auto
dlog6
=
la3
->
create
(
"dlog6"
);
la
->
add
(
la3
);
#if 0
for( int i = 0; i < 15; i++ )
{
ostringstream s;
...
...
@@ -151,6 +152,7 @@ int main( int argc, char** argv )
la->add(l);
}
#endif
#if 0
...
...
Utilities/codegen/tests/TestGen.cc
View file @
9b14a94b
...
...
@@ -30,12 +30,12 @@ void TestGen::step()
myinfo
<<
str
(
input2_s
)
<<
endl
;
ulog
()
->
info
()
<<
"ulog: "
<<
str
(
input2_s
)
<<
endl
;
int_var
++
;
bool_var
^=
true
;
bool_var
^=
true
;
cout
<<
vmon
<<
endl
;
// cout << vmon.pretty_str() << endl;
// cout << vmon.pretty_str() << endl;
}
// -----------------------------------------------------------------------------
void
TestGen
::
sensorInfo
(
const
SensorMessage
*
sm
)
...
...
Utilities/codegen/tests/TestGen.h
View file @
9b14a94b
...
...
@@ -21,8 +21,8 @@ class TestGen:
virtual
void
sigterm
(
int
signo
)
override
;
private
:
bool
bool_var
=
{
false
};
int
int_var
=
{
0
};
bool
bool_var
=
{
false
};
int
int_var
=
{
0
};
};
// -----------------------------------------------------------------------------
#endif // TestGen_H_
...
...
conf/test.xml
View file @
9b14a94b
...
...
@@ -176,6 +176,7 @@
<item
id=
"3101"
ip=
"127.0.0.1"
name=
"LocalhostNode"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"2048"
/>
</specnet>
<GroupAnalogSensors
name=
"TestGroup"
ok_c=
"D106_S"
/>
</settings>
<ObjectsMap
idfromfile=
"1"
>
<!--
...
...
@@ -261,6 +262,13 @@
<item
id=
"100"
iotype=
"AI"
name=
"AI100_AS"
textname=
"AI100"
mbaddr=
"0x01"
mbfunc=
"0x03"
mbreg=
"100"
mbtype=
"rtu"
tcp=
"6"
vtype=
"F2"
precision=
"1"
mbtcp=
"3"
/>
<item
id=
"102"
iotype=
"AI"
name=
"AI102_AS"
textname=
"AI101"
mbaddr=
"0x01"
mbfunc=
"0x03"
mbreg=
"102"
mbtype=
"rtu"
tcp=
"6"
/>
<item
id=
"103"
iotype=
"AI"
name=
"AI103_AS"
textname=
"AI102"
mbaddr=
"0x01"
mbfunc=
"0x03"
mbreg=
"99"
mbtype=
"rtu"
tcp=
"6"
/>
<item
id=
"104"
iotype=
"AI"
name=
"AI104_AS"
textname=
"AI104"
ag=
"2"
ag_min=
"100"
ag_max=
"120"
/>
<item
id=
"105"
iotype=
"AI"
name=
"AI105_AS"
textname=
"AI105"
ag=
"1"
ag_min=
"0"
ag_max=
"40"
ag_status=
"AI107_AS"
/>
<item
id=
"106"
iotype=
"DI"
name=
"D106_S"
textname=
"D106"
/>
<item
id=
"107"
iotype=
"AI"
name=
"AI107_AS"
textname=
"AI107"
default=
"1"
/>
<item
id=
"108"
iotype=
"AI"
name=
"AI108_AS"
textname=
"AI108"
ag=
"1"
ag_min=
"30"
ag_max=
"40"
ag_invert=
"1"
/>
</sensors>
<thresholds
name=
"thresholds"
>
<sensor
iotype=
"AI"
name=
"AI_AS"
>
...
...
@@ -368,6 +376,7 @@
<item
id=
"6085"
name=
"MBSlave8"
/>
<item
id=
"6086"
name=
"MBSlave9"
/>
<item
id=
"6087"
name=
"MBSlave10"
/>
<item
id=
"6088"
name=
"TestGroup"
/>
</objects>
</ObjectsMap>
<messages
idfromfile=
"1"
name=
"messages"
>
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
9b14a94b
...
...
@@ -497,8 +497,10 @@ UniSetTypes::SimpleInfo* MBTCPMultiMaster::getInfo()
inf
<<
i
->
info
<<
endl
;
inf
<<
"Gates: "
<<
endl
;
for
(
const
auto
&
m
:
mblist
)
for
(
const
auto
&
m
:
mblist
)
inf
<<
" "
<<
m
.
getShortInfo
()
<<
endl
;
inf
<<
endl
;
i
->
info
=
inf
.
str
().
c_str
();
...
...
extensions/ModbusMaster/tests/MBTCPTestServer.cc
View file @
9b14a94b
...
...
@@ -356,7 +356,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::writeOutputRegisters( ModbusRTU::WriteOutp
if
(
query
.
start
==
41
)
{
VTypes
::
F2
f2
(
query
.
data
,
VTypes
::
F2
::
wsize
());
VTypes
::
F2
f2
(
query
.
data
,
VTypes
::
F2
::
wsize
());
f2_test_value
=
(
float
)
f2
;
}
...
...
extensions/ModbusMaster/tests/MBTCPTestServer.h
View file @
9b14a94b
...
...
@@ -64,7 +64,10 @@ class MBTCPTestServer
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
MBTCPTestServer
*
m
);
inline
float
getF2TestValue
(){
return
f2_test_value
;
}
inline
float
getF2TestValue
()
{
return
f2_test_value
;
}
protected
:
// действия при завершении работы
...
...
extensions/ModbusSlave/MBTCPMultiSlave.cc
View file @
9b14a94b
...
...
@@ -371,8 +371,10 @@ UniSetTypes::SimpleInfo* MBTCPMultiSlave::getInfo()
inf
<<
i
->
info
<<
endl
;
inf
<<
"Clients: "
<<
endl
;
for
(
const
auto
&
m
:
cmap
)
for
(
const
auto
&
m
:
cmap
)
inf
<<
" "
<<
m
.
second
.
getShortInfo
()
<<
endl
;
inf
<<
endl
;
i
->
info
=
inf
.
str
().
c_str
();
...
...
extensions/ModbusSlave/tests/test_mbslave.cc
View file @
9b14a94b
...
...
@@ -1170,11 +1170,11 @@ TEST_CASE("(0x10): write register outputs or memories [F2](precision)", "[modbus
REQUIRE
(
ui
->
getValue
(
tID
)
==
2004
);
// read..
ui
->
setValue
(
tID
,
203
);
ui
->
setValue
(
tID
,
203
);
ModbusRTU
::
ReadOutputRetMessage
ret2
=
mb
->
read03
(
slaveaddr
,
tREG
,
2
);
F2
r_f2
(
ret2
.
data
,
F2
::
wsize
());
F2
r_f2
(
ret2
.
data
,
F2
::
wsize
());
REQUIRE
(
(
float
)
r_f2
==
20.3
f
);
}
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
9b14a94b
...
...
@@ -904,13 +904,15 @@ UniSetTypes::SimpleInfo* UNetExchange::getInfo()
inf
<<
"LogServer: "
<<
logserv_host
<<
":"
<<
logserv_port
<<
endl
;
inf
<<
endl
;
inf
<<
"Receivers: "
<<
endl
;
for
(
const
auto
&
r
:
recvlist
)
for
(
const
auto
&
r
:
recvlist
)
{
inf
<<
"[ "
<<
endl
;
inf
<<
" chan1: "
<<
(
r
.
r1
?
r
.
r1
->
getShortInfo
()
:
"disable"
)
<<
endl
;
inf
<<
" chan2: "
<<
(
r
.
r2
?
r
.
r2
->
getShortInfo
()
:
"disable"
)
<<
endl
;
inf
<<
"]"
<<
endl
;
}
inf
<<
endl
;
inf
<<
"Senders: "
<<
endl
;
...
...
extensions/include/UObject_SK.h
View file @
9b14a94b
This diff is collapsed.
Click to expand it.
extensions/lib/UObject_SK.cc
View file @
9b14a94b
This diff is collapsed.
Click to expand it.
extensions/tests/SMemoryTest/smemory-test.cc
View file @
9b14a94b
...
...
@@ -40,7 +40,7 @@ int main(int argc, const char** argv)
cout
<<
"..create "
<<
s
.
str
()
<<
endl
;
auto
tp
=
make_shared
<
TestProc
>
(
conf
->
getObjectID
(
s
.
str
()));
// tp->init_dlog(dlog());
// tp->init_dlog(dlog());
act
->
add
(
tp
);
}
...
...
include/VMonitor.h
View file @
9b14a94b
...
...
@@ -110,7 +110,7 @@
class
VMonitor
{
public
:
VMonitor
(){}
VMonitor
()
{}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
VMonitor
&
m
);
...
...
@@ -125,13 +125,19 @@ class VMonitor
VMON_DEF_FUNC
(
bool
);
VMON_DEF_FUNC
(
float
);
VMON_DEF_FUNC
(
double
);
// VMON_DEF_FUNC(UniSetTypes::ObjectId); // <--- long
// VMON_DEF_FUNC(UniSetTypes::ObjectId); // <--- long
void
add
(
const
std
::
string
&
name
,
const
std
::
string
&
v
);
const
std
::
string
pretty_str
(
const
std
::
string
&
name
,
const
std
::
string
*
v
);
inline
int
getNameWidth
(){
return
nameWidth
;
}
inline
void
setNameWidth
(
int
w
){
nameWidth
=
w
;
}
inline
int
getNameWidth
()
{
return
nameWidth
;
}
inline
void
setNameWidth
(
int
w
)
{
nameWidth
=
w
;
}
protected
:
...
...
@@ -145,7 +151,7 @@ class VMonitor
VMON_DEF_MAP
(
float
);
VMON_DEF_MAP
(
double
);
// VMON_DEF_MAP3(UniSetTypes::ObjectId,ObjectId); // <-- long
VMON_DEF_MAP3
(
std
::
string
,
string
);
VMON_DEF_MAP3
(
std
::
string
,
string
);
int
nameWidth
=
{
30
};
};
...
...
include/modbus/ModbusTCPMaster.h
View file @
9b14a94b
...
...
@@ -38,8 +38,14 @@ class ModbusTCPMaster:
cleanInputStream
();
}
inline
std
::
string
getAddress
(){
return
iaddr
;
}
inline
int
getPort
(){
return
port
;
}
inline
std
::
string
getAddress
()
{
return
iaddr
;
}
inline
int
getPort
()
{
return
port
;
}
protected
:
...
...
src/Log/LogAgregator.cc
View file @
9b14a94b
...
...
@@ -55,7 +55,7 @@ std::shared_ptr<DebugStream> LogAgregator::create( const std::string& logname )
auto
l
=
std
::
make_shared
<
DebugStream
>
();
l
->
setLogName
(
logname
);
auto
conn
=
l
->
signal_stream_event
().
connect
(
sigc
::
mem_fun
(
this
,
&
LogAgregator
::
logOnEvent
)
);
conmap
.
emplace
(
l
,
conn
);
conmap
.
emplace
(
l
,
conn
);
lmap
[
logname
]
=
l
;
return
l
;
}
...
...
@@ -83,13 +83,15 @@ void LogAgregator::addLogAgregator( std::shared_ptr<LogAgregator> la, const std:
return
;
auto
lst
=
la
->
getLogList
();
for
(
auto
&&
l
:
lst
)
for
(
auto
&&
l
:
lst
)
{
auto
c
=
conmap
.
find
(
l
.
log
);
if
(
c
==
conmap
.
end
()
)
{
auto
conn
=
l
.
log
->
signal_stream_event
().
connect
(
sigc
::
mem_fun
(
this
,
&
LogAgregator
::
logOnEvent
)
);
conmap
.
emplace
(
l
.
log
,
conn
);
conmap
.
emplace
(
l
.
log
,
conn
);
}
}
...
...
@@ -106,10 +108,11 @@ void LogAgregator::addLog( std::shared_ptr<DebugStream> l, const std::string& ln
if
(
connect
)
{
auto
c
=
conmap
.
find
(
l
);
if
(
c
==
conmap
.
end
()
)
{
auto
conn
=
l
->
signal_stream_event
().
connect
(
sigc
::
mem_fun
(
this
,
&
LogAgregator
::
logOnEvent
)
);
conmap
.
emplace
(
l
,
conn
);
conmap
.
emplace
(
l
,
conn
);
}
}
...
...
@@ -157,7 +160,7 @@ std::ostream& LogAgregator::printLogList( std::ostream& os, const std::string& r
else
lst
=
getLogList
(
regexp_str
);
return
printLogList
(
os
,
lst
);
return
printLogList
(
os
,
lst
);
}
// -------------------------------------------------------------------------
std
::
ostream
&
LogAgregator
::
printLogList
(
std
::
ostream
&
os
,
std
::
list
<
iLog
>&
lst
)
...
...
@@ -233,13 +236,14 @@ std::vector<std::string> LogAgregator::splitFirst( const std::string& lname, con
// -------------------------------------------------------------------------
bool
LogAgregator
::
logExist
(
std
::
shared_ptr
<
DebugStream
>&
log
)
{
for
(
const
auto
&
l
:
lmap
)
for
(
const
auto
&
l
:
lmap
)
{
if
(
l
.
second
==
log
)
return
true
;
bool
res
=
false
;
auto
ag
=
dynamic_pointer_cast
<
LogAgregator
>
(
l
.
second
);
if
(
ag
)
res
=
ag
->
logExist
(
log
);
...
...
src/Log/LogReader.cc
View file @
9b14a94b
...
...
@@ -180,7 +180,7 @@ void LogReader::sendCommand( const std::string& _addr, ost::tpport_t _port, std:
if
(
c
.
cmd
==
LogServerTypes
::
cmdList
)
{
listfilter
=
c
.
logfilter
;
n
=
0
;
n
=
0
;
continue
;
}
...
...
@@ -218,6 +218,7 @@ void LogReader::sendCommand( const std::string& _addr, ost::tpport_t _port, std:
while
(
a
>
0
&&
tcp
->
isPending
(
ost
::
Socket
::
pendingInput
,
reply_timeout
)
)
{
int
n
=
tcp
->
peek
(
buf
,
sizeof
(
buf
)
-
1
);
if
(
n
>
0
)
{
tcp
->
read
(
buf
,
n
);
...
...
@@ -280,7 +281,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
{
rlog
.
warn
()
<<
"(LogReader): **** connection timeout.."
<<
endl
;
if
(
rcount
>
0
&&
readcount
>
0
)
if
(
rcount
>
0
&&
readcount
>
0
)
rcount
--
;
if
(
rcount
==
0
)
...
...
@@ -299,6 +300,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
while
(
tcp
->
isPending
(
ost
::
Socket
::
pendingInput
,
inTimeout
)
)
{
int
n
=
tcp
->
peek
(
buf
,
sizeof
(
buf
)
-
1
);
if
(
n
>
0
)
{
tcp
->
read
(
buf
,
n
);
...
...
@@ -307,18 +309,19 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
log
<<
buf
;
}
if
(
rcount
>
0
&&
readcount
>
0
)
if
(
rcount
>
0
&&
readcount
>
0
)
rcount
--
;
if
(
readcount
>
0
&&
rcount
==
0
)
if
(
readcount
>
0
&&
rcount
==
0
)
break
;
}
if
(
rcount
>
0
&&
readcount
>
0
)
if
(
rcount
>
0
&&
readcount
>
0
)
rcount
--
;
if
(
rcount
!=
0
)
rlog
.
warn
()
<<
"(LogReader): ...connection timeout..."
<<
endl
;
disconnect
();
}
catch
(
const
ost
::
SockException
&
e
)
...
...
@@ -330,7 +333,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
cerr
<<
"(LogReader): "
<<
ex
.
what
()
<<
endl
;
}
if
(
rcount
==
0
&&
readcount
>
0
)
if
(
rcount
==
0
&&
readcount
>
0
)
break
;
}
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
9b14a94b
...
...
@@ -119,14 +119,14 @@ long UniSetTypes::setoutregion(long ret, long calMin, long calMax)
UniSetTypes
::
IDList
::
IDList
(
std
::
vector
<
std
::
string
>&&
svec
)
:
UniSetTypes
::
IDList
::
IDList
()
{
for
(
const
auto
&
s
:
svec
)
for
(
const
auto
&
s
:
svec
)
add
(
uni_atoi
(
s
)
);
}
// ------------------------------------------------------------------
UniSetTypes
::
IDList
::
IDList
(
std
::
vector
<
std
::
string
>&
svec
)
:
UniSetTypes
::
IDList
::
IDList
()
{
for
(
const
auto
&
s
:
svec
)
for
(
const
auto
&
s
:
svec
)
add
(
uni_atoi
(
s
)
);
}
// -------------------------------------------------------------------------
...
...
@@ -209,7 +209,7 @@ bool UniSetTypes::file_exist( const std::string& filename )
// -------------------------------------------------------------------------
UniSetTypes
::
IDList
UniSetTypes
::
explode
(
const
string
&
str
,
char
sep
)
{
UniSetTypes
::
IDList
l
(
explode_str
(
str
,
sep
)
);
UniSetTypes
::
IDList
l
(
explode_str
(
str
,
sep
)
);
return
std
::
move
(
l
);
}
// -------------------------------------------------------------------------
...
...
@@ -230,9 +230,11 @@ std::vector<std::string> UniSetTypes::explode_str( const string& str, char sep )
if
(
pos
==
string
::
npos
)
{
string
s
(
str
.
substr
(
prev
,
sz
-
prev
));
string
s
(
str
.
substr
(
prev
,
sz
-
prev
));
if
(
!
s
.
empty
()
)
v
.
emplace_back
(
s
);
break
;
}
...
...
src/Processes/IONotifyController.cc
View file @
9b14a94b
...
...
@@ -160,6 +160,7 @@ void IONotifyController::askSensor(const UniSetTypes::ObjectId sid,
if
(
cmd
==
UniversalIO
::
UIONotify
||
(
cmd
==
UIONotifyFirstNotNull
&&
li
->
second
->
value
)
)
{
SensorMessage
smsg
(
li
->
second
->
makeSensorMessage
());
try
{
ui
->
send
(
ci
.
id
,
std
::
move
(
smsg
.
transport_msg
()),
ci
.
node
);
...
...
src/Various/VMonitor.cc
View file @
9b14a94b
...
...
@@ -5,97 +5,97 @@
#include "VMonitor.h"
// --------------------------------------------------------------------------
#define VMON_IMPL_ADD(T) void VMonitor::add( const std::string& name, const T& v ) \
{\
m_##T.emplace(&v,name); \
} \
\
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
{\
m_##T.emplace(&v,name); \
} \
\
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_ADD2(T) \
void VMonitor::add( const std::string& name, const T& v ) \
{\
m_##T.emplace(&v,name); \
} \
void VMonitor::add( const std::string& name, const unsigned T& v ) \
{\
m_unsigned_##T.emplace(&v,name); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const unsigned T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
void VMonitor::add( const std::string& name, const T& v ) \
{\
m_##T.emplace(&v,name); \
} \
void VMonitor::add( const std::string& name, const unsigned T& v ) \
{\
m_unsigned_##T.emplace(&v,name); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const unsigned T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_ADD3(T,M) void VMonitor::add( const std::string& name, const T& v ) \
{\
m_##M.emplace(&v,name); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
{\
m_##M.emplace(&v,name); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRN(M,T) \
{\
for( const auto& e: M.m_##T ) \
os << e.second << "=" << *(e.first) << std::endl;\
}
{\
for( const auto& e: M.m_##T ) \
os << e.second << "=" << *(e.first) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRN2(M,T) \
{\
for( const auto& e: M.m_##T ) \
os << e.second << "=" << *(e.first) << std::endl;\
\
for( const auto& e: M.m_unsigned_##T ) \
os << e.second << "=" << *(e.first) << std::endl;\
}
{\
for( const auto& e: M.m_##T ) \
os << e.second << "=" << *(e.first) << std::endl;\
\
for( const auto& e: M.m_unsigned_##T ) \
os << e.second << "=" << *(e.first) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRN_CHAR(M) \
{\
for( const auto& e: M.m_char ) \
os << e.second << "=" << (int)(*(e.first)) << std::endl;\
\
for( const auto& e: M.m_unsigned_char) \
os << e.second << "=" << (int)(*(e.first)) << std::endl;\
}
{\
for( const auto& e: M.m_char ) \
os << e.second << "=" << (int)(*(e.first)) << std::endl;\
\
for( const auto& e: M.m_unsigned_char) \
os << e.second << "=" << (int)(*(e.first)) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET(T) \
{\
for( const auto& e: m_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
}
{\
for( const auto& e: m_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET2(T) \
{\
for( const auto& e: m_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
\
for( const auto& e: m_unsigned_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
}
{\
for( const auto& e: m_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
\
for( const auto& e: m_unsigned_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET_CHAR \
{\
for( const auto& e: m_char ) \
os << std::right << std::setw(nameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
\
for( const auto& e: m_unsigned_char ) \
os << std::right << std::setw(nameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
}
{\
for( const auto& e: m_char ) \
os << std::right << std::setw(nameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
\
for( const auto& e: m_unsigned_char ) \
os << std::right << std::setw(nameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
}
// --------------------------------------------------------------------------
VMON_IMPL_ADD2
(
int
)
VMON_IMPL_ADD2
(
long
)
...
...
@@ -104,20 +104,20 @@ VMON_IMPL_ADD2(char)
VMON_IMPL_ADD
(
bool
)
VMON_IMPL_ADD
(
float
)
VMON_IMPL_ADD
(
double
)
VMON_IMPL_ADD3
(
std
::
string
,
string
)
VMON_IMPL_ADD3
(
std
::
string
,
string
)
//VMON_IMPL_ADD3(UniSetTypes::ObjectId,ObjectId)
// --------------------------------------------------------------------------
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
VMonitor
&
m
)
{
VMON_IMPL_PRN2
(
m
,
int
);
VMON_IMPL_PRN2
(
m
,
long
);
VMON_IMPL_PRN2
(
m
,
short
);
VMON_IMPL_PRN2
(
m
,
int
);
VMON_IMPL_PRN2
(
m
,
long
);
VMON_IMPL_PRN2
(
m
,
short
);
VMON_IMPL_PRN_CHAR
(
m
);
VMON_IMPL_PRN
(
m
,
bool
);
VMON_IMPL_PRN
(
m
,
float
);
VMON_IMPL_PRN
(
m
,
double
);
VMON_IMPL_PRN
(
m
,
string
);
// VMON_IMPL_PRN(m,ObjectId);
VMON_IMPL_PRN
(
m
,
bool
);
VMON_IMPL_PRN
(
m
,
float
);
VMON_IMPL_PRN
(
m
,
double
);
VMON_IMPL_PRN
(
m
,
string
);
// VMON_IMPL_PRN(m,ObjectId);
return
os
;
}
...
...
@@ -141,7 +141,7 @@ std::string VMonitor::pretty_str()
VMON_IMPL_PRET
(
float
);
VMON_IMPL_PRET
(
double
);
VMON_IMPL_PRET
(
string
);
// VMON_IMPL_PRET(ObjectId);
// VMON_IMPL_PRET(ObjectId);
return
std
::
move
(
os
.
str
());
}
...
...
tests/develop.cc
View file @
9b14a94b
...
...
@@ -11,7 +11,7 @@ class VMon
{
public
:
std
::
tuple
<
std
::
unordered_map
<
const
Args
*
,
const
std
::
string
>
...
>
m_tuple
;
std
::
tuple
<
std
::
unordered_map
<
const
Args
*
,
const
std
::
string
>
...
>
m_tuple
;
};
// ------------------------------------------------------------------------------
...
...
@@ -19,9 +19,9 @@ using namespace std;
int
main
(
int
argc
,
const
char
**
argv
)
{
// VMon<int,double,char> vmon;
// VMon<int,double,char> vmon;
// cout << std::get<0>(vmon.m_tuple).size() << endl;
// cout << std::get<0>(vmon.m_tuple).size() << endl;
return
0
;
}
tests/test_logserver.cc
View file @
9b14a94b
...
...
@@ -169,6 +169,7 @@ TEST_CASE("LogServer", "[LogServer]" )
g_read_cancel
=
true
;
msleep
(
readTimeout
);
if
(
r_thr
->
joinable
()
)
r_thr
->
join
();
}
...
...
tests/test_utypes.cc
View file @
9b14a94b
...
...
@@ -78,29 +78,29 @@ TEST_CASE("UniSetTypes: explode", "[utypes][explode]" )
{
const
std
::
string
str1
(
"id1/wed/wedwed/"
);
auto
t1
=
UniSetTypes
::
explode_str
(
str1
,
'/'
);
auto
t1
=
UniSetTypes
::
explode_str
(
str1
,
'/'
);
CHECK
(
t1
.
size
()
==
3
);
auto
t2
=
UniSetTypes
::
explode_str
(
str1
,
'.'
);
auto
t2
=
UniSetTypes
::
explode_str
(
str1
,
'.'
);
CHECK
(
t2
.
size
()
==
1
);
const
std
::
string
str2
(
"id1/wed/wedwed/f"
);
auto
t3
=
UniSetTypes
::
explode_str
(
str2
,
'/'
);
auto
t3
=
UniSetTypes
::
explode_str
(
str2
,
'/'
);
CHECK
(
t3
.
size
()
==
4
);
const
std
::
string
str3
(
"/id1/wed/wedwed/"
);
auto
t4
=
UniSetTypes
::
explode_str
(
str3
,
'/'
);
auto
t4
=
UniSetTypes
::
explode_str
(
str3
,
'/'
);
CHECK
(
t4
.
size
()
==
3
);
const
std
::
string
str4
(
""
);
auto
t5
=
UniSetTypes
::
explode_str
(
str4
,
'/'
);
auto
t5
=
UniSetTypes
::
explode_str
(
str4
,
'/'
);
CHECK
(
t5
.
size
()
==
0
);
const
std
::
string
str5
(
"/"
);
auto
t6
=
UniSetTypes
::
explode_str
(
str5
,
'/'
);
auto
t6
=
UniSetTypes
::
explode_str
(
str5
,
'/'
);
CHECK
(
t6
.
size
()
==
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