Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
cc93da89
Commit
cc93da89
authored
Apr 13, 2010
by
Sebastian Eichelbaum
Browse files
[CHANGE] - compatible modules are now sorted alphabetically.
parent
89f6b6f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
+2
-2
src/kernel/WModuleFactory.cpp
src/kernel/WModuleFactory.cpp
+20
-4
src/kernel/WModuleFactory.h
src/kernel/WModuleFactory.h
+1
-1
No files found.
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
View file @
cc93da89
...
...
@@ -454,9 +454,9 @@ void WQtDatasetBrowser::buildPropTab( boost::shared_ptr< WProperties > props )
void
WQtDatasetBrowser
::
createCompatibleButtons
(
boost
::
shared_ptr
<
WModule
>
module
)
{
// every module may have compatibles: create ribbon menu entry
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
std
::
vector
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
for
(
std
::
vector
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>::
const_
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
{
if
(
!
m_moduleWhiteList
.
empty
()
)
{
...
...
src/kernel/WModuleFactory.cpp
View file @
cc93da89
...
...
@@ -212,9 +212,22 @@ const boost::shared_ptr< WModule > WModuleFactory::getPrototypeByInstance( boost
return
getPrototypeByName
(
instance
->
getName
()
);
}
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
WModuleFactory
::
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
)
/**
* Sorting function for sorting the compatibles list. It uses the alphabetical order of the names.
*
* \param lhs the first combiner
* \param rhs the second combiner
*
* \return true if lhs < rhs
*/
bool
compatiblesSort
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
lhs
,
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
rhs
)
{
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
compatibles
;
return
(
lhs
->
getTargetPrototype
()
->
getName
()
<
rhs
->
getTargetPrototype
()
->
getName
()
);
}
std
::
vector
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
WModuleFactory
::
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
)
{
std
::
vector
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
compatibles
;
// for this a read lock is sufficient
boost
::
shared_lock
<
boost
::
shared_mutex
>
slock
=
boost
::
shared_lock
<
boost
::
shared_mutex
>
(
m_prototypesLock
);
...
...
@@ -229,7 +242,7 @@ std::set< boost::shared_ptr< WApplyPrototypeCombiner > > WModuleFactory::getComp
std
::
set
<
boost
::
shared_ptr
<
WModuleInputConnector
>
>
pcons
=
(
*
listIter
)
->
getInputConnectors
();
if
(
pcons
.
size
()
==
0
)
{
compatibles
.
insert
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
(
new
WApplyPrototypeCombiner
(
module
,
""
,
*
listIter
,
""
)
)
);
compatibles
.
push_back
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
(
new
WApplyPrototypeCombiner
(
module
,
""
,
*
listIter
,
""
)
)
);
}
}
...
...
@@ -269,7 +282,7 @@ std::set< boost::shared_ptr< WApplyPrototypeCombiner > > WModuleFactory::getComp
if
(
(
*
cons
.
begin
()
)
->
connectable
(
*
pcons
.
begin
()
)
&&
(
*
pcons
.
begin
()
)
->
connectable
(
*
cons
.
begin
()
)
)
{
// it is compatible -> add to list
compatibles
.
insert
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
(
compatibles
.
push_back
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
(
new
WApplyPrototypeCombiner
(
module
,
(
*
cons
.
begin
()
)
->
getName
(),
*
listIter
,
(
*
pcons
.
begin
()
)
->
getName
()
)
)
);
}
...
...
@@ -277,6 +290,9 @@ std::set< boost::shared_ptr< WApplyPrototypeCombiner > > WModuleFactory::getComp
slock
.
unlock
();
// sort the compatibles
std
::
sort
(
compatibles
.
begin
(),
compatibles
.
end
(),
compatiblesSort
);
return
compatibles
;
}
src/kernel/WModuleFactory.h
View file @
cc93da89
...
...
@@ -121,7 +121,7 @@ public:
*
* \return set of compatible combiners.
*/
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
);
std
::
vector
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
);
/**
* This method uses a newly created instance of WModule and initializes it properly. After using this method, the module is
...
...
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