1
//---------------------------------------------------------------------------
3
// Project: OpenWalnut ( http://www.openwalnut.org )
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
8
// This file is part of OpenWalnut.
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
23
//---------------------------------------------------------------------------
25
#ifndef WMODULEONETOONECOMBINER_H
26
#define WMODULEONETOONECOMBINER_H
30
#include <boost/shared_ptr.hpp>
32
#include "../WModule.h"
33
#include "../WModuleCombiner.h"
34
#include "../WModuleCombinerTypes.h"
39
* Base class for all combiners which apply one connection between two connectors of two modules.
41
class WModuleOneToOneCombiner: public WModuleCombiner
45
* Creates a combiner which sets up the specified modules and prototype combination. Specifying a NULL pointer to the srcModule parameter
46
* causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any
47
* input which must be connected. It is possible to specify prototypes here. The will get created upon apply.
50
* \param target the target container
51
* \param srcModule the module whose output should be connected with the prototypes input
52
* \param srcConnector the output connector of the module
53
* \param targetModule the module/prototype to use for connecting the module with
54
* \param targetConnector the input connector of the prototype to connect with srcConnector.
56
WModuleOneToOneCombiner( boost::shared_ptr< WModuleContainer > target,
57
boost::shared_ptr< WModule > srcModule, std::string srcConnector,
58
boost::shared_ptr< WModule > targetModule, std::string targetConnector );
61
* Creates a combiner which sets up the specified modules and prototype combination. This constructor automatically uses the kernel's root
62
* container as target container. Specifying a NULL pointer to the srcModule parameter
63
* causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any
64
* input which must be connected. It is possible to specify prototypes here. The will get created upon apply.
66
* \param srcModule the module whose output should be connected with the prototypes input
67
* \param srcConnector the output connector of the module
68
* \param targetModule the module/prototype to use for connecting the module with
69
* \param targetConnector the input connector of the prototype to connect with srcConnector.
71
WModuleOneToOneCombiner( boost::shared_ptr< WModule > srcModule, std::string srcConnector,
72
boost::shared_ptr< WModule > targetModule, std::string targetConnector );
77
virtual ~WModuleOneToOneCombiner();
80
* Apply the internal module structure to the target container. Be aware, that this operation might take some time, as modules can be
81
* connected only if they are "ready", which, at least with WMData modules, might take some time. It applies the loaded project file.
83
virtual void apply() = 0;
86
* Gets the source module. This module's output connector is connected with the target.
88
* \return the source module.
90
boost::shared_ptr< WModule > getSrcModule() const;
93
* The output connector of m_srcModule to connect with m_targetConnector.
95
* \return the source module's output connector.
97
std::string getSrcConnector() const;
100
* The module/prototype to connect with m_srcModule.
102
* \return the target module prototype.
104
boost::shared_ptr< WModule > getTargetModule() const;
107
* The input connector the target module to connect with m_srcConnector.
109
* \return the target module's input connector.
111
std::string getTargetConnector() const;
115
* The source module to connect with the target
117
boost::shared_ptr< WModule > m_srcModule;
120
* The output connector of m_srcModule to connect with m_targetConnector.
122
std::string m_srcConnector;
125
* The module/prototype to connect with m_srcMdodule.
127
boost::shared_ptr< WModule > m_targetModule;
130
* The input connector the target module to connect with m_srcConnector.
132
std::string m_targetConnector;
137
#endif // WMODULEONETOONECOMBINER_H