OpenWalnut
1.2.5
|
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 #include "../WExportKernel.h" 00037 00038 /** 00039 * Base class for all combiners which apply one connection between two connectors of two modules. 00040 */ 00041 class OWKERNEL_EXPORT WModuleOneToOneCombiner: public WModuleCombiner 00042 { 00043 public: 00044 00045 /** 00046 * Creates a combiner which sets up the specified modules and prototype combination. Specifying a NULL pointer to the srcModule parameter 00047 * causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any 00048 * input which must be connected. It is possible to specify prototypes here. The will get created upon apply. 00049 * 00050 * 00051 * \param target the target container 00052 * \param srcModule the module whose output should be connected with the prototypes input 00053 * \param srcConnector the output connector of the module 00054 * \param targetModule the module/prototype to use for connecting the module with 00055 * \param targetConnector the input connector of the prototype to connect with srcConnector. 00056 */ 00057 WModuleOneToOneCombiner( boost::shared_ptr< WModuleContainer > target, 00058 boost::shared_ptr< WModule > srcModule, std::string srcConnector, 00059 boost::shared_ptr< WModule > targetModule, std::string targetConnector ); 00060 00061 /** 00062 * Creates a combiner which sets up the specified modules and prototype combination. This constructor automatically uses the kernel's root 00063 * container as target container. Specifying a NULL pointer to the srcModule parameter 00064 * causes the combiner to only add the target module without any connections. This is especially useful for modules which do not provide any 00065 * input which must be connected. It is possible to specify prototypes here. The will get created upon apply. 00066 * 00067 * \param srcModule the module whose output should be connected with the prototypes input 00068 * \param srcConnector the output connector of the module 00069 * \param targetModule the module/prototype to use for connecting the module with 00070 * \param targetConnector the input connector of the prototype to connect with srcConnector. 00071 */ 00072 WModuleOneToOneCombiner( boost::shared_ptr< WModule > srcModule, std::string srcConnector, 00073 boost::shared_ptr< WModule > targetModule, std::string targetConnector ); 00074 00075 /** 00076 * Destructor. 00077 */ 00078 virtual ~WModuleOneToOneCombiner(); 00079 00080 /** 00081 * Apply the internal module structure to the target container. Be aware, that this operation might take some time, as modules can be 00082 * connected only if they are "ready", which, at least with WMData modules, might take some time. It applies the loaded project file. 00083 */ 00084 virtual void apply() = 0; 00085 00086 /** 00087 * Gets the source module. This module's output connector is connected with the target. 00088 * 00089 * \return the source module. 00090 */ 00091 boost::shared_ptr< WModule > getSrcModule() const; 00092 00093 /** 00094 * The output connector of m_srcModule to connect with m_targetConnector. 00095 * 00096 * \return the source module's output connector. 00097 */ 00098 std::string getSrcConnector() const; 00099 00100 /** 00101 * The module/prototype to connect with m_srcModule. 00102 * 00103 * \return the target module prototype. 00104 */ 00105 boost::shared_ptr< WModule > getTargetModule() const; 00106 00107 /** 00108 * The input connector the target module to connect with m_srcConnector. 00109 * 00110 * \return the target module's input connector. 00111 */ 00112 std::string getTargetConnector() const; 00113 00114 protected: 00115 00116 /** 00117 * The source module to connect with the target 00118 */ 00119 boost::shared_ptr< WModule > m_srcModule; 00120 00121 /** 00122 * The output connector of m_srcModule to connect with m_targetConnector. 00123 */ 00124 std::string m_srcConnector; 00125 00126 /** 00127 * The module/prototype to connect with m_srcMdodule. 00128 */ 00129 boost::shared_ptr< WModule > m_targetModule; 00130 00131 /** 00132 * The input connector the target module to connect with m_srcConnector. 00133 */ 00134 std::string m_targetConnector; 00135 00136 private: 00137 }; 00138 00139 #endif // WMODULEONETOONECOMBINER_H 00140 00141