@@ -334,26 +334,19 @@ void NetworkEditorController::clear()
334334}
335335
336336// TODO:
337- // - [ ] refactor duplication
337+ // - [X ] refactor duplication
338338// - [ ] set up execution context queue
339339// - [ ] separate threads for looping through queue: another producer/consumer pair
340340
341341void NetworkEditorController::executeAll (const ExecutableLookup* lookup)
342342{
343- initExecutor ();
344-
345- ExecuteAllModules filter;
346- auto context = createExecutionContext (lookup, filter);
347- currentExecutor_->execute (*context);
343+ executeGeneric (lookup, ExecuteAllModules::Instance ());
348344}
349345
350346void NetworkEditorController::executeModule (const ModuleHandle& module , const ExecutableLookup* lookup)
351347{
352- initExecutor ();
353-
354348 ExecuteSingleModule filter (module , *theNetwork_);
355- auto context = createExecutionContext (lookup, filter);
356- currentExecutor_->execute (*context);
349+ executeGeneric (lookup, filter);
357350}
358351
359352void NetworkEditorController::initExecutor ()
@@ -370,6 +363,13 @@ ExecutionContextHandle NetworkEditorController::createExecutionContext(const Exe
370363 return boost::make_shared<ExecutionContext>(*theNetwork_, lookup ? *lookup : *theNetwork_, filter);
371364}
372365
366+ void NetworkEditorController::executeGeneric (const ExecutableLookup* lookup, ModuleFilter filter)
367+ {
368+ initExecutor ();
369+ auto context = createExecutionContext (lookup, filter);
370+ currentExecutor_->execute (*context);
371+ }
372+
373373NetworkHandle NetworkEditorController::getNetwork () const
374374{
375375 return theNetwork_;
0 commit comments