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
f2e95a15
Commit
f2e95a15
authored
Jul 12, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(LogicProcessor): небольшой рефакторинг
(ProxyManager): update todo list
parent
c9d1055e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
54 deletions
+81
-54
Element.cc
extensions/LogicProcessor/Element.cc
+34
-0
Element.h
extensions/LogicProcessor/Element.h
+7
-28
LProcessor.cc
extensions/LogicProcessor/LProcessor.cc
+20
-0
LProcessor.h
extensions/LogicProcessor/LProcessor.h
+5
-17
PassiveLProcessor.cc
extensions/LogicProcessor/PassiveLProcessor.cc
+4
-4
TDelay.cc
extensions/LogicProcessor/TDelay.cc
+5
-0
TDelay.h
extensions/LogicProcessor/TDelay.h
+1
-4
PassiveObject.h
include/PassiveObject.h
+2
-0
ProxyManager.h
include/ProxyManager.h
+3
-1
No files found.
extensions/LogicProcessor/Element.cc
View file @
f2e95a15
...
...
@@ -70,6 +70,11 @@ namespace uniset
}
}
}
// -------------------------------------------------------------------------
size_t
Element
::
outCount
()
const
{
return
outs
.
size
();
}
// -------------------------------------------------------------------------
void
Element
::
setChildOut
()
...
...
@@ -80,6 +85,11 @@ namespace uniset
it
.
el
->
setIn
(
it
.
num
,
_myout
);
}
// -------------------------------------------------------------------------
Element
::
ElementID
Element
::
getId
()
const
{
return
myid
;
}
// -------------------------------------------------------------------------
std
::
shared_ptr
<
Element
>
Element
::
find
(
const
ElementID
&
id
)
{
for
(
const
auto
&
it
:
outs
)
...
...
@@ -120,4 +130,28 @@ namespace uniset
}
}
// -------------------------------------------------------------------------
size_t
Element
::
inCount
()
const
{
return
ins
.
size
();
}
// -------------------------------------------------------------------------
ostream
&
operator
<<
(
ostream
&
os
,
Element
&
el
)
{
return
os
<<
"["
<<
el
.
getType
()
<<
"]"
<<
el
.
getId
();
}
ostream
&
operator
<<
(
ostream
&
os
,
std
::
shared_ptr
<
Element
>
el
)
{
if
(
el
)
return
os
<<
(
*
(
el
.
get
()));
return
os
;
}
// -------------------------------------------------------------------------
long
TOR
::
getOut
()
const
{
return
(
myout
?
1
:
0
);
}
// -------------------------------------------------------------------------
}
// end of namespace uniset
extensions/LogicProcessor/Element.h
View file @
f2e95a15
...
...
@@ -63,10 +63,8 @@ namespace uniset
virtual
void
setIn
(
size_t
num
,
long
value
)
=
0
;
virtual
long
getOut
()
const
=
0
;
inline
ElementID
getId
()
const
{
return
myid
;
}
ElementID
getId
()
const
;
virtual
std
::
string
getType
()
const
{
return
"?type?"
;
...
...
@@ -76,30 +74,14 @@ namespace uniset
virtual
void
addChildOut
(
std
::
shared_ptr
<
Element
>
el
,
size_t
in_num
);
virtual
void
delChildOut
(
std
::
shared_ptr
<
Element
>
el
);
inline
size_t
outCount
()
const
{
return
outs
.
size
();
}
size_t
outCount
()
const
;
virtual
void
addInput
(
size_t
num
,
long
value
=
0
);
virtual
void
delInput
(
size_t
num
);
inline
size_t
inCount
()
const
{
return
ins
.
size
();
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Element
&
el
)
{
return
os
<<
"["
<<
el
.
getType
()
<<
"]"
<<
el
.
getId
();
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
std
::
shared_ptr
<
Element
>
el
)
{
if
(
el
)
return
os
<<
(
*
(
el
.
get
()));
size_t
inCount
()
const
;
return
os
;
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Element
&
el
)
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
std
::
shared_ptr
<
Element
>
el
);
protected
:
Element
()
:
myid
(
DefaultElementID
)
{};
// нельзя создать элемент без id
...
...
@@ -146,10 +128,7 @@ namespace uniset
virtual
~
TOR
();
virtual
void
setIn
(
size_t
num
,
long
value
)
override
;
virtual
long
getOut
()
const
override
{
return
(
myout
?
1
:
0
);
}
virtual
long
getOut
()
const
override
;
virtual
std
::
string
getType
()
const
override
{
...
...
extensions/LogicProcessor/LProcessor.cc
View file @
f2e95a15
...
...
@@ -59,6 +59,11 @@ void LProcessor::open( const string& lfile )
build
(
lfile
);
}
// -------------------------------------------------------------------------
bool
LProcessor
::
isOpen
()
const
{
return
!
fSchema
.
empty
();
}
// -------------------------------------------------------------------------
void
LProcessor
::
execute
(
const
std
::
string
&
lfile
)
{
if
(
!
lfile
.
empty
()
)
...
...
@@ -87,6 +92,21 @@ void LProcessor::execute( const std::string& lfile )
}
}
// -------------------------------------------------------------------------
void
LProcessor
::
terminate
()
{
canceled
=
true
;
}
// -------------------------------------------------------------------------
std
::
shared_ptr
<
SchemaXML
>
LProcessor
::
getSchema
()
{
return
sch
;
}
// -------------------------------------------------------------------------
timeout_t
LProcessor
::
getSleepTime
()
const
noexcept
{
return
sleepTime
;
}
// -------------------------------------------------------------------------
void
LProcessor
::
step
()
{
getInputs
();
...
...
extensions/LogicProcessor/LProcessor.h
View file @
f2e95a15
...
...
@@ -124,27 +124,15 @@ namespace uniset
void
open
(
const
std
::
string
&
lfile
);
inline
bool
isOpen
()
const
{
return
!
fSchema
.
empty
();
}
bool
isOpen
()
const
;
virtual
void
execute
(
const
std
::
string
&
lfile
=
""
)
;
timeout_t
getSleepTime
()
const
noexcept
;
virtual
void
terminate
()
{
canceled
=
true
;
}
std
::
shared_ptr
<
SchemaXML
>
getSchema
();
inline
std
::
shared_ptr
<
SchemaXML
>
getSchema
()
{
return
sch
;
}
virtual
void
execute
(
const
std
::
string
&
lfile
=
""
);
inline
int
getSleepTime
()
const
{
return
sleepTime
;
}
virtual
void
terminate
();
protected
:
...
...
extensions/LogicProcessor/PassiveLProcessor.cc
View file @
f2e95a15
...
...
@@ -117,7 +117,7 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
{
try
{
for
(
auto
&
it
:
extInputs
)
for
(
auto
&
&
it
:
extInputs
)
shm
->
askSensor
(
it
.
sid
,
cmd
);
}
catch
(
const
uniset
::
Exception
&
ex
)
...
...
@@ -129,7 +129,7 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
// -------------------------------------------------------------------------
void
PassiveLProcessor
::
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
{
for
(
auto
&
it
:
extInputs
)
for
(
auto
&
&
it
:
extInputs
)
{
if
(
it
.
sid
==
sm
->
id
)
it
.
value
=
sm
->
value
;
...
...
@@ -230,7 +230,7 @@ void PassiveLProcessor::initIterators()
void
PassiveLProcessor
::
setOuts
()
{
// выcтавляем выходы
for
(
auto
&
it
:
extOuts
)
for
(
auto
&
&
it
:
extOuts
)
{
try
{
...
...
@@ -249,7 +249,7 @@ void PassiveLProcessor::setOuts()
// -------------------------------------------------------------------------
void
PassiveLProcessor
::
sigterm
(
int
signo
)
{
for
(
auto
&
it
:
extOuts
)
for
(
auto
&
&
it
:
extOuts
)
{
try
{
...
...
extensions/LogicProcessor/TDelay.cc
View file @
f2e95a15
...
...
@@ -101,5 +101,10 @@ namespace uniset
{
delay
=
timeMS
;
}
timeout_t
TDelay
::
getDelay
()
const
{
return
delay
;
}
// -------------------------------------------------------------------------
}
// end of namespace uniset
extensions/LogicProcessor/TDelay.h
View file @
f2e95a15
...
...
@@ -42,10 +42,7 @@ namespace uniset
}
void
setDelay
(
timeout_t
timeMS
);
inline
timeout_t
getDelay
()
const
{
return
delay
;
}
timeout_t
getDelay
()
const
;
protected
:
TDelay
()
:
myout
(
false
),
delay
(
0
)
{};
...
...
include/PassiveObject.h
View file @
f2e95a15
...
...
@@ -34,6 +34,8 @@ namespace uniset
* Пасивный объект не имеющий самостоятельного потока обработки сообщений, но имеющий
* уникальный идентификатор. Предназначен для работы под управлением ProxyManager.
*
* \todo Перейти на shared_ptr, weak_ptr для взаимодействия с ProxyManager
*
*/
class
PassiveObject
{
...
...
include/ProxyManager.h
View file @
f2e95a15
...
...
@@ -33,7 +33,9 @@ namespace uniset
//----------------------------------------------------------------------------
/*! \class ProxyManager
* Менеджер пассивных объектов, который выступает вместо них во всех внешних связях....
* Менеджер пассивных объектов, который выступает вместо них во всех внешних связях...
*
* \todo Перейти на shared_ptr, weak_ptr для взаимодействия с PassiveObject
*/
class
ProxyManager
:
public
UniSetObject
...
...
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