-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkFlow.cpp
More file actions
25 lines (21 loc) · 938 Bytes
/
Copy pathWorkFlow.cpp
File metadata and controls
25 lines (21 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <memory>
#include "WorkFlow.h"
#include "BlockFactory.h"
void WorkFlow::executeWorkFlow(const std::string& filename) {
parser.readWorkFlowFile(filename);
auto scheme = parser.getScheme();
auto blockArgsMap = parser.getBunchOfBlocksArgs();
InOutTypesForBlock prevOutType = InOutTypesForBlock::NO;
InOutTypesForBlock currentInType;
std::list<std::string> text;
for (auto it = scheme.begin(); it != scheme.end(); ++it) {
BlockArguments blockArgs = blockArgsMap.at(*it);
std::shared_ptr<Worker> block(BlockFactory::Instance().create(blockArgs.getName()));
currentInType = block->getInType(currentInType);
if (currentInType != prevOutType) {
throw UnavailableWorkFlowException("Workflow is incorrect");
}
prevOutType = block->getOutType(prevOutType);
text = block->execute(blockArgs.getParams(), text);
}
}