Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
f841caf2
Commit
f841caf2
authored
Jun 29, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] - module factory now provides prototypes by type. Needed later for our IO modules
parent
aebf63cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
src/core/kernel/WModuleFactory.cpp
src/core/kernel/WModuleFactory.cpp
+20
-0
src/core/kernel/WModuleFactory.h
src/core/kernel/WModuleFactory.h
+9
-0
No files found.
src/core/kernel/WModuleFactory.cpp
View file @
f841caf2
...
...
@@ -182,6 +182,26 @@ const boost::shared_ptr< WModule > WModuleFactory::getPrototypeByInstance( boost
return
getPrototypeByName
(
instance
->
getName
()
);
}
std
::
vector
<
WModule
::
ConstSPtr
>
WModuleFactory
::
getPrototypesByType
(
MODULE_TYPE
type
)
{
std
::
vector
<
WModule
::
ConstSPtr
>
ret
;
// for this a read lock is sufficient, gets unlocked if it looses scope
PrototypeSharedContainerType
::
ReadTicket
l
=
m_prototypes
.
getReadTicket
();
// find first and only prototype (ensured during load())
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
const_iterator
listIter
=
l
->
get
().
begin
();
listIter
!=
l
->
get
().
end
();
++
listIter
)
{
if
(
(
*
listIter
)
->
getType
()
==
type
)
{
ret
.
push_back
(
*
listIter
);
}
}
return
ret
;
}
WModuleFactory
::
PrototypeSharedContainerType
::
ReadTicket
WModuleFactory
::
getPrototypes
()
const
{
return
m_prototypes
.
getReadTicket
();
...
...
src/core/kernel/WModuleFactory.h
View file @
f841caf2
...
...
@@ -125,6 +125,15 @@ public:
*/
const
boost
::
shared_ptr
<
WModule
>
getPrototypeByInstance
(
boost
::
shared_ptr
<
WModule
>
instance
);
/**
* Finds a prototype using an type.
*
* \param type the type of module.
*
* \return the prototypes as list.
*/
std
::
vector
<
WModule
::
ConstSPtr
>
getPrototypesByType
(
MODULE_TYPE
type
);
/**
* This method gives read access to the list of all prototypes.
*
...
...
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