Skip to content

Commit e2928a4

Browse files
committed
More refactoring
1 parent 5cd2aad commit e2928a4

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/Dataflow/Engine/Controller/NetworkEditorController.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

341341
void 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

350346
void 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

359352
void 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+
373373
NetworkHandle NetworkEditorController::getNetwork() const
374374
{
375375
return theNetwork_;

src/Dataflow/Engine/Controller/NetworkEditorController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ namespace Engine {
145145
private:
146146
void printNetwork() const;
147147
Networks::ModuleHandle addModuleImpl(const std::string& moduleName);
148+
149+
void executeGeneric(const Networks::ExecutableLookup* lookup, Networks::ModuleFilter filter);
148150
void initExecutor();
149151
ExecutionContextHandle createExecutionContext(const Networks::ExecutableLookup* lookup, Networks::ModuleFilter filter);
150152

0 commit comments

Comments
 (0)