OpenWalnut  1.4.0
WModuleOneToOneCombiner.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
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.
14 //
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.
19 //
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/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMODULEONETOONECOMBINER_H
26 #define WMODULEONETOONECOMBINER_H
27 
28 #include <string>
29 
30 #ifndef Q_MOC_RUN
31 #include <boost/shared_ptr.hpp>
32 #endif
33 
34 #include "../WModule.h"
35 #include "../WModuleCombiner.h"
36 #include "../WModuleCombinerTypes.h"
37 
38 
39 
40 /**
41  * Base class for all combiners which apply one connection between two connectors of two modules.
42  */
44 {
45 public:
46  /**
47  * Creates a combiner which sets up the specified modules and prototype combination. Specifying a NULL pointer to the srcModule parameter
48  * causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any
49  * input which must be connected. It is possible to specify prototypes here. The will get created upon apply.
50  *
51  *
52  * \param target the target container
53  * \param srcModule the module whose output should be connected with the prototypes input
54  * \param srcConnector the output connector of the module
55  * \param targetModule the module/prototype to use for connecting the module with
56  * \param targetConnector the input connector of the prototype to connect with srcConnector.
57  */
58  WModuleOneToOneCombiner( boost::shared_ptr< WModuleContainer > target,
59  boost::shared_ptr< WModule > srcModule, std::string srcConnector,
60  boost::shared_ptr< WModule > targetModule, std::string targetConnector );
61 
62  /**
63  * Creates a combiner which sets up the specified modules and prototype combination. This constructor automatically uses the kernel's root
64  * container as target container. Specifying a NULL pointer to the srcModule parameter
65  * causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any
66  * input which must be connected. It is possible to specify prototypes here. The will get created upon apply.
67  *
68  * \param srcModule the module whose output should be connected with the prototypes input
69  * \param srcConnector the output connector of the module
70  * \param targetModule the module/prototype to use for connecting the module with
71  * \param targetConnector the input connector of the prototype to connect with srcConnector.
72  */
73  WModuleOneToOneCombiner( boost::shared_ptr< WModule > srcModule, std::string srcConnector,
74  boost::shared_ptr< WModule > targetModule, std::string targetConnector );
75 
76  /**
77  * Destructor.
78  */
79  virtual ~WModuleOneToOneCombiner();
80 
81  /**
82  * Apply the internal module structure to the target container. Be aware, that this operation might take some time, as modules can be
83  * connected only if they are "ready", which, at least with WMData modules, might take some time. It applies the loaded project file.
84  */
85  virtual void apply() = 0;
86 
87  /**
88  * Gets the source module. This module's output connector is connected with the target.
89  *
90  * \return the source module.
91  */
92  boost::shared_ptr< WModule > getSrcModule() const;
93 
94  /**
95  * The output connector of m_srcModule to connect with m_targetConnector.
96  *
97  * \return the source module's output connector.
98  */
99  std::string getSrcConnector() const;
100 
101  /**
102  * The module/prototype to connect with m_srcModule.
103  *
104  * \return the target module prototype.
105  */
106  boost::shared_ptr< WModule > getTargetModule() const;
107 
108  /**
109  * The input connector the target module to connect with m_srcConnector.
110  *
111  * \return the target module's input connector.
112  */
113  std::string getTargetConnector() const;
114 
115 protected:
116  /**
117  * The source module to connect with the target
118  */
119  boost::shared_ptr< WModule > m_srcModule;
120 
121  /**
122  * The output connector of m_srcModule to connect with m_targetConnector.
123  */
124  std::string m_srcConnector;
125 
126  /**
127  * The module/prototype to connect with m_srcMdodule.
128  */
129  boost::shared_ptr< WModule > m_targetModule;
130 
131  /**
132  * The input connector the target module to connect with m_srcConnector.
133  */
134  std::string m_targetConnector;
135 
136 private:
137 };
138 
139 #endif // WMODULEONETOONECOMBINER_H
140 
141 
virtual void apply()=0
Apply the internal module structure to the target container.
boost::shared_ptr< WModule > getTargetModule() const
The module/prototype to connect with m_srcModule.
boost::shared_ptr< WModule > m_targetModule
The module/prototype to connect with m_srcMdodule.
std::string m_targetConnector
The input connector the target module to connect with m_srcConnector.
virtual ~WModuleOneToOneCombiner()
Destructor.
std::string m_srcConnector
The output connector of m_srcModule to connect with m_targetConnector.
This is a base class for all module combination classes.
std::string getSrcConnector() const
The output connector of m_srcModule to connect with m_targetConnector.
boost::shared_ptr< WModule > m_srcModule
The source module to connect with the target.
boost::shared_ptr< WModule > getSrcModule() const
Gets the source module.
Base class for all combiners which apply one connection between two connectors of two modules...
std::string getTargetConnector() const
The input connector the target module to connect with m_srcConnector.
WModuleOneToOneCombiner(boost::shared_ptr< WModuleContainer > target, boost::shared_ptr< WModule > srcModule, std::string srcConnector, boost::shared_ptr< WModule > targetModule, std::string targetConnector)
Creates a combiner which sets up the specified modules and prototype combination. ...