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
ca499bb7
Commit
ca499bb7
authored
Sep 30, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UniSetManager): use std::function
parent
469532a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
25 deletions
+19
-25
UniSetManager.h
include/UniSetManager.h
+5
-4
UniSetManager.cc
src/Core/UniSetManager.cc
+14
-21
No files found.
include/UniSetManager.h
View file @
ca499bb7
...
...
@@ -126,10 +126,11 @@ namespace uniset
// Функции для работы со списками подчиненных объектов
// ---------------
UniSetManagerList
::
const_iterator
beginMList
();
UniSetManagerList
::
const_iterator
endMList
();
ObjectsList
::
const_iterator
beginOList
();
ObjectsList
::
const_iterator
endOList
();
typedef
std
::
function
<
void
(
const
std
::
shared_ptr
<
UniSetObject
>&
)
>
OFunction
;
void
apply_for_objects
(
OFunction
f
);
typedef
std
::
function
<
void
(
const
std
::
shared_ptr
<
UniSetManager
>&
)
>
MFunction
;
void
apply_for_managers
(
MFunction
f
);
private
:
...
...
src/Core/UniSetManager.cc
View file @
ca499bb7
...
...
@@ -25,6 +25,7 @@
#include <functional>
#include <algorithm>
#include "Configuration.h"
#include "Exceptions.h"
#include "ORepHelpers.h"
#include "UInterface.h"
...
...
@@ -247,7 +248,7 @@ void UniSetManager::managers( OManagerCommand cmd )
//lock
uniset_rwmutex_rlock
lock
(
mlistMutex
);
for
(
auto
&
li
:
mlist
)
for
(
const
auto
&
li
:
mlist
)
{
if
(
!
li
)
continue
;
...
...
@@ -346,7 +347,7 @@ void UniSetManager::objects(OManagerCommand cmd)
//lock
uniset_rwmutex_rlock
lock
(
olistMutex
);
for
(
auto
&
li
:
olist
)
for
(
const
auto
&
li
:
olist
)
{
if
(
!
li
)
continue
;
...
...
@@ -606,11 +607,11 @@ int UniSetManager::getObjectsInfo( const std::shared_ptr<UniSetManager>& mngr, S
if
(
ind
>
uplimit
)
return
ind
;
for
(
auto
it
=
mngr
->
beginOList
();
it
!=
mngr
->
endOList
();
++
i
t
)
for
(
const
auto
&
o
:
olis
t
)
{
try
{
SimpleInfo_var
si
=
(
*
it
)
->
getInfo
(
userparam
);
SimpleInfo_var
si
=
o
->
getInfo
(
userparam
);
(
*
seq
)[
ind
]
=
si
;
ind
++
;
...
...
@@ -624,7 +625,7 @@ int UniSetManager::getObjectsInfo( const std::shared_ptr<UniSetManager>& mngr, S
catch
(...)
{
uwarn
<<
myname
<<
"(getObjectsInfo): не смог получить у объекта "
<<
uniset_conf
()
->
oind
->
getNameById
(
(
*
it
)
->
getId
()
)
<<
" информацию"
<<
endl
;
<<
uniset_conf
()
->
oind
->
getNameById
(
o
->
getId
()
)
<<
" информацию"
<<
endl
;
}
}
...
...
@@ -632,9 +633,9 @@ int UniSetManager::getObjectsInfo( const std::shared_ptr<UniSetManager>& mngr, S
return
ind
;
// а далее у его менеджеров (рекурсивно)
for
(
auto
&
i
:
mlist
)
for
(
const
auto
&
m
:
mlist
)
{
ind
=
getObjectsInfo
(
i
,
seq
,
ind
,
uplimit
,
userparam
);
ind
=
getObjectsInfo
(
m
,
seq
,
ind
,
uplimit
,
userparam
);
if
(
ind
>
uplimit
)
break
;
...
...
@@ -664,24 +665,16 @@ SimpleInfoSeq* UniSetManager::getObjectsInfo(CORBA::Long maxlength, const char*
}
// ------------------------------------------------------------------------------------------
UniSetManagerList
::
const_iterator
UniSetManager
::
beginMList
(
)
void
UniSetManager
::
apply_for_objects
(
OFunction
f
)
{
return
mlist
.
begin
();
for
(
const
auto
&
o
:
olist
)
f
(
o
);
}
// ------------------------------------------------------------------------------------------
UniSetManagerList
::
const_iterator
UniSetManager
::
endMList
(
)
void
UniSetManager
::
apply_for_managers
(
UniSetManager
::
MFunction
f
)
{
return
mlist
.
end
();
}
// ------------------------------------------------------------------------------------------
ObjectsList
::
const_iterator
UniSetManager
::
beginOList
()
{
return
olist
.
begin
();
}
// ------------------------------------------------------------------------------------------
ObjectsList
::
const_iterator
UniSetManager
::
endOList
()
{
return
olist
.
end
();
for
(
const
auto
&
m
:
mlist
)
f
(
m
);
}
// ------------------------------------------------------------------------------------------
size_t
UniSetManager
::
objectsCount
()
const
...
...
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