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
419a7f42
Commit
419a7f42
authored
Apr 11, 2010
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - added new combiner which is used for adding and finding compatible modules in the GUI
parent
67c7be29
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
301 additions
and
91 deletions
+301
-91
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+1
-12
src/gui/qt4/WMainWindow.h
src/gui/qt4/WMainWindow.h
+0
-18
src/gui/qt4/WQt4Gui.cpp
src/gui/qt4/WQt4Gui.cpp
+1
-3
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
+9
-8
src/gui/qt4/guiElements/WQtPushButton.cpp
src/gui/qt4/guiElements/WQtPushButton.cpp
+0
-4
src/gui/qt4/guiElements/WQtPushButton.h
src/gui/qt4/guiElements/WQtPushButton.h
+0
-8
src/kernel/CMakeLists.txt
src/kernel/CMakeLists.txt
+2
-2
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+0
-1
src/kernel/WModule.cpp
src/kernel/WModule.cpp
+0
-5
src/kernel/WModule.h
src/kernel/WModule.h
+0
-7
src/kernel/WModuleFactory.cpp
src/kernel/WModuleFactory.cpp
+9
-7
src/kernel/WModuleFactory.h
src/kernel/WModuleFactory.h
+5
-4
src/kernel/combiner/WApplyPrototypeCombiner.cpp
src/kernel/combiner/WApplyPrototypeCombiner.cpp
+127
-0
src/kernel/combiner/WApplyPrototypeCombiner.h
src/kernel/combiner/WApplyPrototypeCombiner.h
+135
-0
src/kernel/combiner/WModuleProjectFileCombiner.cpp
src/kernel/combiner/WModuleProjectFileCombiner.cpp
+11
-11
src/kernel/combiner/WModuleProjectFileCombiner.h
src/kernel/combiner/WModuleProjectFileCombiner.h
+1
-1
No files found.
src/gui/qt4/WMainWindow.cpp
View file @
419a7f42
...
...
@@ -52,7 +52,7 @@
#include "../../common/WColor.h"
#include "../../common/WPreferences.h"
#include "../../kernel/WKernel.h"
#include "../../kernel/WModuleProjectFileCombiner.h"
#include "../../kernel/
combiner/
WModuleProjectFileCombiner.h"
#include "../../modules/data/WMData.h"
#include "../../modules/navSlices/WMNavSlices.h"
...
...
@@ -447,11 +447,6 @@ boost::signals2::signal1< void, std::vector< std::string > >* WMainWindow::getLo
return
&
m_loaderSignal
;
}
boost
::
signals2
::
signal2
<
void
,
boost
::
shared_ptr
<
WModule
>
,
boost
::
shared_ptr
<
WModule
>
>*
WMainWindow
::
getModuleButtonSignal
()
{
return
&
m_moduleButtonSignal
;
}
WIconManager
*
WMainWindow
::
getIconManager
()
{
return
&
m_iconManager
;
...
...
@@ -594,12 +589,6 @@ void WMainWindow::closeCustomDockWidget( std::string title )
//m_customDockWidgetsLock.unlock();
}
void
WMainWindow
::
slotActivateModule
(
QString
module
)
{
// TODO(schurade): do we really need the signal? Why can't we use the kernel directly?
m_moduleButtonSignal
(
getDatasetBrowser
()
->
getSelectedModule
(),
WModuleFactory
::
getModuleFactory
()
->
getPrototypeByName
(
module
.
toStdString
()
)
);
}
void
WMainWindow
::
newRoi
()
{
// do nothing if we can not get
...
...
src/gui/qt4/WMainWindow.h
View file @
419a7f42
...
...
@@ -101,13 +101,6 @@ public:
*/
boost
::
signals2
::
signal1
<
void
,
std
::
vector
<
std
::
string
>
>*
getLoaderSignal
();
/**
* Returns the signal emitted by those module buttons in the compatibility tab.
*
* \return the signal.
*/
boost
::
signals2
::
signal2
<
void
,
boost
::
shared_ptr
<
WModule
>
,
boost
::
shared_ptr
<
WModule
>
>*
getModuleButtonSignal
();
/**
* Searches for a custom dock widget with a given name and returns it, if
* found.
...
...
@@ -170,12 +163,6 @@ public slots:
*/
void
openAboutDialog
();
/**
* get called when a module button
* \param module name of teh module
*/
void
slotActivateModule
(
QString
module
);
/**
* gets called when the button new roi is pressed
*/
...
...
@@ -227,11 +214,6 @@ private:
boost
::
signals2
::
signal1
<
void
,
std
::
vector
<
std
::
string
>
>
m_loaderSignal
;
//!< boost signal for open file dialog
/**
* boost signal object
*/
boost
::
signals2
::
signal2
<
void
,
boost
::
shared_ptr
<
WModule
>
,
boost
::
shared_ptr
<
WModule
>
>
m_moduleButtonSignal
;
/**
* Combine a module with a prototype only if the module is available. Else, nothing happens.
*
...
...
src/gui/qt4/WQt4Gui.cpp
View file @
419a7f42
...
...
@@ -38,7 +38,7 @@
#include "../../common/WIOTools.h"
#include "../../graphicsEngine/WGraphicsEngine.h"
#include "../../kernel/WKernel.h"
#include "../../kernel/WModuleProjectFileCombiner.h"
#include "../../kernel/
combiner/
WModuleProjectFileCombiner.h"
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WSubject.h"
#include "WOpenCustomDockWidgetEvent.h"
...
...
@@ -142,8 +142,6 @@ int WQt4Gui::run()
getLoadButtonSignal
()
->
connect
(
boost
::
bind
(
&
WKernel
::
loadDataSets
,
m_kernel
,
_1
)
);
#endif
m_mainWindow
->
getModuleButtonSignal
()
->
connect
(
boost
::
bind
(
&
WKernel
::
applyModule
,
m_kernel
,
_1
,
_2
)
);
WCondition
::
t_ConditionNotifierType
newDatasetSignal
=
boost
::
bind
(
&
WQt4Gui
::
slotUpdateTextureSorter
,
this
);
WDataHandler
::
getDefaultSubject
()
->
getListChangeCondition
()
->
subscribeSignal
(
newDatasetSignal
);
...
...
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
View file @
419a7f42
...
...
@@ -453,12 +453,13 @@ 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
<
WModule
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>
comps
=
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
module
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
{
if
(
!
m_moduleWhiteList
.
empty
()
)
{
const
std
::
string
tmpName
=
(
*
iter
)
->
getName
();
const
std
::
string
tmpName
=
(
*
iter
)
->
get
TargetPrototype
()
->
get
Name
();
if
(
std
::
find
(
m_moduleWhiteList
.
begin
(),
m_moduleWhiteList
.
end
(),
tmpName
)
==
m_moduleWhiteList
.
end
()
)
{
continue
;
//do nothing for modules that are not in white list
...
...
@@ -468,13 +469,13 @@ void WQtDatasetBrowser::createCompatibleButtons( boost::shared_ptr< WModule >mod
QString
buttonText
=
""
;
if
(
m_showToolBarText
)
{
buttonText
=
(
*
iter
)
->
getName
().
c_str
();
buttonText
=
(
*
iter
)
->
get
TargetPrototype
()
->
get
Name
().
c_str
();
}
WQtPushButton
*
button
=
m_mainWindow
->
getCompatiblesToolBar
()
->
addPushButton
(
QString
(
(
*
iter
)
->
getName
().
c_str
()
),
m_mainWindow
->
getIconManager
()
->
getIcon
(
(
*
iter
)
->
getName
().
c_str
()
),
buttonText
);
button
->
setToolTip
(
(
*
iter
)
->
getName
().
c_str
()
);
connect
(
button
,
SIGNAL
(
pushButtonPressed
(
QString
)
),
m_mainWindow
,
SLOT
(
slotActivateModule
(
QString
)
)
);
WQtPushButton
*
button
=
m_mainWindow
->
getCompatiblesToolBar
()
->
addPushButton
(
QString
(
(
*
iter
)
->
get
TargetPrototype
()
->
get
Name
().
c_str
()
),
m_mainWindow
->
getIconManager
()
->
getIcon
(
(
*
iter
)
->
get
TargetPrototype
()
->
get
Name
().
c_str
()
),
buttonText
);
button
->
setToolTip
(
(
*
iter
)
->
get
TargetPrototype
()
->
get
Name
().
c_str
()
);
//
connect( button, SIGNAL( pushButtonPressed( QString ) ), m_mainWindow, SLOT( slotActivateModule( QString ) ) );
}
}
...
...
src/gui/qt4/guiElements/WQtPushButton.cpp
View file @
419a7f42
...
...
@@ -52,9 +52,5 @@ QString WQtPushButton::getName()
void
WQtPushButton
::
emitPressed
()
{
emit
pushButtonPressed
(
m_name
);
// Strangely we need the inverted isChecked here.
// I think this is the case as the change of the checked flag happens after the call of this function.
emit
pushButtonToggled
(
m_name
,
!
this
->
isChecked
()
);
}
src/gui/qt4/guiElements/WQtPushButton.h
View file @
419a7f42
...
...
@@ -84,14 +84,6 @@ signals:
* \param name the name of the button.
*/
void
pushButtonPressed
(
QString
name
);
/**
* Signals whenever the button got toggled.
*
* \param name the name of the button.
* \param value true if toggled.
*/
void
pushButtonToggled
(
QString
name
,
bool
value
);
};
#endif // WQTPUSHBUTTON_H
src/kernel/CMakeLists.txt
View file @
419a7f42
...
...
@@ -2,10 +2,10 @@ FILE( GLOB KERNEL_SRC "*.cpp" "*.h" )
FILE
(
GLOB_RECURSE MODULES_SRC
"../modules/*.cpp"
"../modules/*.h"
)
ADD_SUBDIRECTORY
(
exceptions
)
FILE
(
GLOB KERNEL_EXCEPTIONS_SRC
"exceptions/*.cpp"
"exceptions/*.h"
)
FILE
(
GLOB KERNEL_COMBINER_SRC
"combiner/*.cpp"
"combiner/*.h"
)
ADD_LIBRARY
(
kernel
${
KERNEL_SRC
}
${
MODULES_SRC
}
${
KERNEL_EXCEPTIONS_SRC
}
)
ADD_LIBRARY
(
kernel
${
KERNEL_SRC
}
${
MODULES_SRC
}
${
KERNEL_EXCEPTIONS_SRC
}
${
KERNEL_COMBINER_SRC
}
)
TARGET_LINK_LIBRARIES
(
kernel common dataHandler ge
${
OPENSCENEGRAPH_LIBRARIES
}
)
...
...
src/kernel/WKernel.cpp
View file @
419a7f42
...
...
@@ -46,7 +46,6 @@
#include "WKernel.h"
#include "WModule.h"
#include "WModuleFactory.h"
#include "WModuleProjectFileCombiner.h"
/**
* Used for program wide access to the kernel.
...
...
src/kernel/WModule.cpp
View file @
419a7f42
...
...
@@ -271,11 +271,6 @@ const t_GenericSignalHandlerType WModule::getSignalHandler( MODULE_CONNECTOR_SIG
}
}
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>
WModule
::
getCompatibles
()
{
return
WModuleFactory
::
getModuleFactory
()
->
getCompatiblePrototypes
(
shared_from_this
()
);
}
const
WBoolFlag
&
WModule
::
isInitialized
()
const
{
return
m_initialized
;
...
...
src/kernel/WModule.h
View file @
419a7f42
...
...
@@ -205,13 +205,6 @@ public:
*/
virtual
boost
::
signals2
::
connection
subscribeSignal
(
MODULE_SIGNAL
signal
,
t_ModuleErrorSignalHandlerType
notifier
);
/**
* Returns a set of prototypes compatible with this module's connectors.
*
* \return set of prototypes.
*/
virtual
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>
getCompatibles
();
/**
* Gets the modules base progress. This is actually a progress combiner, which bundles all progresses.
*
...
...
src/kernel/WModuleFactory.cpp
View file @
419a7f42
...
...
@@ -57,6 +57,7 @@
#include "WModuleFactory.h"
#include "exceptions/WPrototypeNotUnique.h"
#include "exceptions/WPrototypeUnknown.h"
#include "combiner/WApplyPrototypeCombiner.h"
// factory instance as singleton
boost
::
shared_ptr
<
WModuleFactory
>
WModuleFactory
::
m_instance
=
boost
::
shared_ptr
<
WModuleFactory
>
();
...
...
@@ -211,9 +212,9 @@ const boost::shared_ptr< WModule > WModuleFactory::getPrototypeByInstance( boost
return
getPrototypeByName
(
instance
->
getName
()
);
}
std
::
set
<
boost
::
shared_ptr
<
W
Module
>
>
WModuleFactory
::
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
)
std
::
set
<
boost
::
shared_ptr
<
W
ApplyPrototypeCombiner
>
>
WModuleFactory
::
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
)
{
std
::
set
<
boost
::
shared_ptr
<
W
Module
>
>
compatibles
;
std
::
set
<
boost
::
shared_ptr
<
W
ApplyPrototypeCombiner
>
>
compatibles
;
// for this a read lock is sufficient
boost
::
shared_lock
<
boost
::
shared_mutex
>
slock
=
boost
::
shared_lock
<
boost
::
shared_mutex
>
(
m_prototypesLock
);
...
...
@@ -221,14 +222,14 @@ std::set< boost::shared_ptr< WModule > > WModuleFactory::getCompatiblePrototypes
// get offered outputs
std
::
set
<
boost
::
shared_ptr
<
WModuleOutputConnector
>
>
cons
=
module
->
getOutputConnectors
();
// First add all modules with no input connector.
// First
,
add all modules with no input connector.
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
iterator
listIter
=
m_prototypes
.
begin
();
listIter
!=
m_prototypes
.
end
();
++
listIter
)
{
// get connectors of this prototype
std
::
set
<
boost
::
shared_ptr
<
WModuleInputConnector
>
>
pcons
=
(
*
listIter
)
->
getInputConnectors
();
if
(
pcons
.
size
()
==
0
)
{
compatibles
.
insert
(
*
listIter
);
compatibles
.
insert
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
(
new
WApplyPrototypeCombiner
(
module
,
""
,
*
listIter
,
""
)
)
);
}
}
...
...
@@ -239,8 +240,6 @@ std::set< boost::shared_ptr< WModule > > WModuleFactory::getCompatiblePrototypes
return
compatibles
;
}
// TODO(ebaum): see ticket #178 for this
if
(
cons
.
size
()
>
1
)
{
wlog
::
warn
(
"ModuleFactory"
)
<<
"Can not find compatibles for "
<<
module
->
getName
()
<<
" module (more than 1 output connector). Using "
...
...
@@ -270,7 +269,10 @@ std::set< boost::shared_ptr< WModule > > WModuleFactory::getCompatiblePrototypes
if
(
(
*
cons
.
begin
()
)
->
connectable
(
*
pcons
.
begin
()
)
&&
(
*
pcons
.
begin
()
)
->
connectable
(
*
cons
.
begin
()
)
)
{
// it is compatible -> add to list
compatibles
.
insert
(
*
listIter
);
compatibles
.
insert
(
boost
::
shared_ptr
<
WApplyPrototypeCombiner
>
(
new
WApplyPrototypeCombiner
(
module
,
(
*
cons
.
begin
()
)
->
getName
(),
*
listIter
,
(
*
pcons
.
begin
()
)
->
getName
()
)
)
);
}
}
...
...
src/kernel/WModuleFactory.h
View file @
419a7f42
...
...
@@ -32,6 +32,7 @@
#include <boost/thread.hpp>
#include "../modules/data/WMData.h" // this is the ONLY module with a special meaning. Every one knowing the factory also knows this
#include "combiner/WApplyPrototypeCombiner.h"
#include "WModule.h"
/**
...
...
@@ -114,13 +115,13 @@ public:
static
bool
isA
(
boost
::
shared_ptr
<
WModule
>
module
);
/**
* Returns a set of modules compatible with the specified one.
* Returns a set of module
combiners with module combination
s compatible with the specified one.
*
* \param module the module to find
prototype
for.
* \param module the module to find
the compatibles
for.
*
* \return set of compatible
prototype
s.
* \return set of compatible
combiner
s.
*/
std
::
set
<
boost
::
shared_ptr
<
W
Module
>
>
getCompatiblePrototypes
(
boost
::
shared_ptr
<
WModule
>
module
);
std
::
set
<
boost
::
shared_ptr
<
W
ApplyPrototypeCombiner
>
>
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
...
...
src/kernel/combiner/WApplyPrototypeCombiner.cpp
0 → 100644
View file @
419a7f42
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <map>
#include <list>
#include <string>
#include <utility>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include "../WKernel.h"
#include "../WModuleCombiner.h"
#include "../WModuleFactory.h"
#include "../WModuleConnector.h"
#include "../WModule.h"
#include "../WModuleInputConnector.h"
#include "../WModuleOutputConnector.h"
#include "../exceptions/WModuleConnectorNotFound.h"
#include "../../common/WLogger.h"
#include "WApplyPrototypeCombiner.h"
WApplyPrototypeCombiner
::
WApplyPrototypeCombiner
(
boost
::
shared_ptr
<
WModuleContainer
>
target
,
boost
::
shared_ptr
<
WModule
>
srcModule
,
std
::
string
srcConnector
,
boost
::
shared_ptr
<
WModule
>
prototype
,
std
::
string
targetConnector
)
:
WModuleCombiner
(
target
),
m_srcModule
(
srcModule
),
m_srcConnector
(
srcConnector
),
m_targetPrototype
(
prototype
),
m_targetConnector
(
targetConnector
)
{
}
WApplyPrototypeCombiner
::
WApplyPrototypeCombiner
(
boost
::
shared_ptr
<
WModule
>
srcModule
,
std
::
string
srcConnector
,
boost
::
shared_ptr
<
WModule
>
prototype
,
std
::
string
targetConnector
)
:
WModuleCombiner
(
WKernel
::
getRunningKernel
()
->
getRootContainer
()
),
m_srcModule
(
srcModule
),
m_srcConnector
(
srcConnector
),
m_targetPrototype
(
prototype
),
m_targetConnector
(
targetConnector
)
{
}
WApplyPrototypeCombiner
::~
WApplyPrototypeCombiner
()
{
// cleanup
}
boost
::
shared_ptr
<
WModule
>
WApplyPrototypeCombiner
::
getSrcModule
()
const
{
return
m_srcModule
;
}
std
::
string
WApplyPrototypeCombiner
::
getSrcConnector
()
const
{
return
m_srcConnector
;
}
boost
::
shared_ptr
<
WModule
>
WApplyPrototypeCombiner
::
getTargetPrototype
()
const
{
return
m_targetPrototype
;
}
std
::
string
WApplyPrototypeCombiner
::
getTargetConnector
()
const
{
return
m_targetConnector
;
}
void
WApplyPrototypeCombiner
::
apply
()
{
// create module instance
boost
::
shared_ptr
<
WModule
>
targetModule
=
WModuleFactory
::
getModuleFactory
()
->
create
(
m_targetPrototype
);
// add the target module to the container
m_container
->
add
(
targetModule
);
// NOTE: here, we assume the src module already to be in the container. If not, connect will fail with an exception -> so no need for a
// separate exception here
// wait
m_srcModule
->
isReadyOrCrashed
().
wait
();
if
(
m_srcModule
->
isCrashed
()()
)
{
wlog
::
error
(
"Prototype Combiner"
)
<<
"The source module
\"
"
<<
m_srcModule
->
getName
()
<<
"
\"
has crashed. Abort."
;
return
;
}
targetModule
->
isReadyOrCrashed
().
wait
();
if
(
targetModule
->
isCrashed
()()
)
{
wlog
::
error
(
"Prototype Combiner"
)
<<
"The target module
\"
"
<<
targetModule
->
getName
()
<<
"
\"
has crashed. Abort."
;
return
;
}
// if the target connector is an empty string -> do not connect, just add
if
(
m_targetConnector
.
empty
()
)
{
return
;
}
// and connect them finally:
targetModule
->
getInputConnector
(
m_targetConnector
)
->
connect
(
m_srcModule
->
getOutputConnector
(
m_srcConnector
)
);
}
src/kernel/combiner/WApplyPrototypeCombiner.h
0 → 100644
View file @
419a7f42
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WAPPLYPROTOTYPECOMBINER_H
#define WAPPLYPROTOTYPECOMBINER_H
#include <list>
#include <map>
#include <string>
#include <utility>
#include <boost/shared_ptr.hpp>
#include "../WModule.h"
#include "../WModuleCombiner.h"
/**
* This class combines an existing module with an specified prototype. The connections to use must be explicitly known.
*/
class
WApplyPrototypeCombiner
:
public
WModuleCombiner
{
public:
/**
* Creates a combiner which sets up the specified modules and prototype combination.
*
* \param target the target container
* \param srcModule the module whose output should be connected with the prototypes input
* \param srcConnector the output connector of the module
* \param prototype the prototype to use for connecting the module with
* \param targetConnector the input connector of the prototype to connect with srcConnector.
*/
WApplyPrototypeCombiner
(
boost
::
shared_ptr
<
WModuleContainer
>
target
,
boost
::
shared_ptr
<
WModule
>
srcModule
,
std
::
string
srcConnector
,
boost
::
shared_ptr
<
WModule
>
prototype
,
std
::
string
targetConnector
);
/**
* Creates a combiner which sets up the specified modules and prototype combination. This constructor automatically uses the kernel's root
* container as target container.
*
* \param srcModule the module whose output should be connected with the prototypes input
* \param srcConnector the output connector of the module
* \param prototype the prototype to use for connecting the module with
* \param targetConnector the input connector of the prototype to connect with srcConnector.
*/
WApplyPrototypeCombiner
(
boost
::
shared_ptr
<
WModule
>
srcModule
,
std
::
string
srcConnector
,
boost
::
shared_ptr
<
WModule
>
prototype
,
std
::
string
targetConnector
);
/**
* Destructor.
*/
virtual
~
WApplyPrototypeCombiner
();
/**
* Apply the internal module structure to the target container. Be aware, that this operation might take some time, as modules can be
* connected only if they are "ready", which, at least with WMData modules, might take some time. It applies the loaded project file.
*/
virtual
void
apply
();
/**
* Gets the source module. This module's output connector is connected with the target.
*
* \return the source module.
*/
boost
::
shared_ptr
<
WModule
>
getSrcModule
()
const
;
/**
* The output connector of m_srcModule to connect with m_targetConnector.
*
* \return the source module's output connector.
*/
std
::
string
getSrcConnector
()
const
;
/**
* The module prototype to connect with m_srcMdodule.
*
* \return the target module prototype.
*/
boost
::
shared_ptr
<
WModule
>
getTargetPrototype
()
const
;
/**
* The input connector the target module to connect with m_srcConnector.
*
* \return the target module's input connector.
*/
std
::
string
getTargetConnector
()
const
;
protected:
/**
* The source module to connect with the target
*/
boost
::
shared_ptr
<
WModule
>
m_srcModule
;
/**
* The output connector of m_srcModule to connect with m_targetConnector.
*/
std
::
string
m_srcConnector
;
/**
* The module prototype to connect with m_srcMdodule.
*/
boost
::
shared_ptr
<
WModule
>
m_targetPrototype
;
/**
* The input connector the target module to connect with m_srcConnector.
*/
std
::
string
m_targetConnector
;
private:
};
#endif // WAPPLYPROTOTYPECOMBINER_H
src/kernel/WModuleProjectFileCombiner.cpp
→
src/kernel/
combiner/
WModuleProjectFileCombiner.cpp
View file @
419a7f42
...
...
@@ -31,17 +31,17 @@
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include "WKernel.h"
#include "WModuleCombiner.h"
#include "WModuleFactory.h"
#include "WModuleConnector.h"
#include "WModule.h"
#include "WModuleInputConnector.h"
#include "WModuleOutputConnector.h"
#include "exceptions/WModuleConnectorNotFound.h"
#include "../common/exceptions/WFileNotFound.h"
#include "../common/WLogger.h"
#include "
../
WKernel.h"
#include "
../
WModuleCombiner.h"
#include "
../
WModuleFactory.h"
#include "
../
WModuleConnector.h"
#include "
../
WModule.h"
#include "
../
WModuleInputConnector.h"
#include "
../
WModuleOutputConnector.h"
#include "
../
exceptions/WModuleConnectorNotFound.h"
#include "../
../
common/exceptions/WFileNotFound.h"
#include "../
../
common/WLogger.h"
#include "WModuleProjectFileCombiner.h"
...
...
src/kernel/WModuleProjectFileCombiner.h
→
src/kernel/
combiner/
WModuleProjectFileCombiner.h
View file @
419a7f42
...
...
@@ -33,7 +33,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/filesystem.hpp>
#include "WModuleCombiner.h"
#include "
../
WModuleCombiner.h"
/**
* This is a base class for all module combination classes. The basic idea is to hide the actual combination work from others. These classes may
...
...
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