32 #include "../common/WLogger.h"
33 #include "combiner/WApplyCombiner.h"
34 #include "exceptions/WPrototypeNotUnique.h"
35 #include "exceptions/WPrototypeUnknown.h"
37 #include "WModuleCombiner.h"
38 #include "WModuleFactory.h"
67 std::set< std::string > names;
69 while( listIter != l->get().end() )
74 if( names.count( ( *listIter )->getName() ) )
77 "\" is not unique. Modules have to have a unique name. Ignoring this module." ),
78 "ModuleFactory", LL_ERROR );
80 l->get().erase( listIter++ );
85 names.insert( ( *listIter )->getName() );
102 return ( ticket->get().count( module ) != 0 );
107 wlog::debug(
"ModuleFactory" ) <<
"Creating new instance of prototype \"" << prototype->getName() <<
"\".";
115 throw WPrototypeUnknown( std::string(
"Could not clone module \"" + prototype->getName() +
"\" since it is no prototype." ) );
122 boost::shared_ptr< WModule > clone = boost::shared_ptr< WModule >( prototype->factory() );
123 clone->setLocalPath( prototype->getLocalPath() );
131 module->initialize();
151 boost::shared_ptr< WModule > ret = boost::shared_ptr< WModule >();
152 for( std::set< boost::shared_ptr< WModule > >::const_iterator listIter = l->get().begin(); listIter != l->get().end();
155 if( ( *listIter )->getName() == name )
170 if( ret == boost::shared_ptr< WModule >() )
172 throw WPrototypeUnknown( std::string(
"Could not find prototype \"" + name +
"\"." ) );
185 std::vector< WModule::ConstSPtr > ret;
191 for( std::set< boost::shared_ptr< WModule > >::const_iterator listIter = l->get().begin(); listIter != l->get().end();
194 if( ( *listIter )->getType() == type )
196 ret.push_back( *listIter );
210 WCombinerTypes::WCompatiblesList compatibles;
216 bool addModulesWithoutInput = !module;
218 if( addModulesWithoutInput )
226 if( pcons.size() == 0 )
229 WCombinerTypes::WOneToOneCombiners lComp;
232 lComp.push_back( boost::shared_ptr< WApplyCombiner >(
new WApplyCombiner( module,
"", *listIter,
"" ) ) );
235 compatibles.push_back( WCombinerTypes::WCompatiblesGroup( ( *listIter ), lComp ) );
247 WCombinerTypes::WOneToOneCombiners lComp = WApplyCombiner::createCombinerList< WApplyCombiner >( module, ( *listIter ) );
250 if( lComp.size() != 0 )
252 compatibles.push_back( WCombinerTypes::WCompatiblesGroup( ( *listIter ), lComp ) );
261 std::sort( compatibles.begin(), compatibles.end(), WCombinerTypes::compatiblesSort );
268 WCombinerTypes::WCompatiblesList compatibles;
278 WCombinerTypes::WOneToOneCombiners lComp;
281 lComp.push_back( boost::shared_ptr< WApplyCombiner >(
new WApplyCombiner( *listIter ) ) );
284 compatibles.push_back( WCombinerTypes::WCompatiblesGroup( ( *listIter ), lComp ) );
291 std::sort( compatibles.begin(), compatibles.end(), WCombinerTypes::compatiblesSort );