OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WMODULEONETOONECOMBINER_H 00026 #define WMODULEONETOONECOMBINER_H 00027 00028 #include <string> 00029 00030 #include <boost/shared_ptr.hpp> 00031 00032 #include "../WModule.h" 00033 #include "../WModuleCombiner.h" 00034 #include "../WModuleCombinerTypes.h" 00035 00036 00037 00038 /** 00039 * Base class for all combiners which apply one connection between two connectors of two modules. 00040 */ 00041 class WModuleOneToOneCombiner: public WModuleCombiner 00042 { 00043 public: 00044 /** 00045 * Creates a combiner which sets up the specified modules and prototype combination. Specifying a NULL pointer to the srcModule parameter 00046 * causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any 00047 * input which must be connected. It is possible to specify prototypes here. The will get created upon apply. 00048 * 00049 * 00050 * \param target the target container 00051 * \param srcModule the module whose output should be connected with the prototypes input 00052 * \param srcConnector the output connector of the module 00053 * \param targetModule the module/prototype to use for connecting the module with 00054 * \param targetConnector the input connector of the prototype to connect with srcConnector. 00055 */ 00056 WModuleOneToOneCombiner( boost::shared_ptr< WModuleContainer > target, 00057 boost::shared_ptr< WModule > srcModule, std::string srcConnector, 00058 boost::shared_ptr< WModule > targetModule, std::string targetConnector ); 00059 00060 /** 00061 * Creates a combiner which sets up the specified modules and prototype combination. This constructor automatically uses the kernel's root 00062 * container as target container. Specifying a NULL pointer to the srcModule parameter 00063 * causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any 00064 * input which must be connected. It is possible to specify prototypes here. The will get created upon apply. 00065 * 00066 * \param srcModule the module whose output should be connected with the prototypes input 00067 * \param srcConnector the output connector of the module 00068 * \param targetModule the module/prototype to use for connecting the module with 00069 * \param targetConnector the input connector of the prototype to connect with srcConnector. 00070 */ 00071 WModuleOneToOneCombiner( boost::shared_ptr< WModule > srcModule, std::string srcConnector, 00072 boost::shared_ptr< WModule > targetModule, std::string targetConnector ); 00073 00074 /** 00075 * Destructor. 00076 */ 00077 virtual ~WModuleOneToOneCombiner(); 00078 00079 /** 00080 * Apply the internal module structure to the target container. Be aware, that this operation might take some time, as modules can be 00081 * connected only if they are "ready", which, at least with WMData modules, might take some time. It applies the loaded project file. 00082 */ 00083 virtual void apply() = 0; 00084 00085 /** 00086 * Gets the source module. This module's output connector is connected with the target. 00087 * 00088 * \return the source module. 00089 */ 00090 boost::shared_ptr< WModule > getSrcModule() const; 00091 00092 /** 00093 * The output connector of m_srcModule to connect with m_targetConnector. 00094 * 00095 * \return the source module's output connector. 00096 */ 00097 std::string getSrcConnector() const; 00098 00099 /** 00100 * The module/prototype to connect with m_srcModule. 00101 * 00102 * \return the target module prototype. 00103 */ 00104 boost::shared_ptr< WModule > getTargetModule() const; 00105 00106 /** 00107 * The input connector the target module to connect with m_srcConnector. 00108 * 00109 * \return the target module's input connector. 00110 */ 00111 std::string getTargetConnector() const; 00112 00113 protected: 00114 /** 00115 * The source module to connect with the target 00116 */ 00117 boost::shared_ptr< WModule > m_srcModule; 00118 00119 /** 00120 * The output connector of m_srcModule to connect with m_targetConnector. 00121 */ 00122 std::string m_srcConnector; 00123 00124 /** 00125 * The module/prototype to connect with m_srcMdodule. 00126 */ 00127 boost::shared_ptr< WModule > m_targetModule; 00128 00129 /** 00130 * The input connector the target module to connect with m_srcConnector. 00131 */ 00132 std::string m_targetConnector; 00133 00134 private: 00135 }; 00136 00137 #endif // WMODULEONETOONECOMBINER_H 00138 00139