|
|
@ -104,30 +104,31 @@ void Grid::applyOverwrites(std::string& str, std::vector<Configuration>& configu |
|
|
|
if (!config.overwrite_) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
for (auto& index : config.index_) { |
|
|
|
size_t start_pos; |
|
|
|
std::string search; |
|
|
|
|
|
|
|
if (config.type_ == ConfigType::Formula) { |
|
|
|
start_pos = str.find("formula " + config.identifier_); |
|
|
|
search = "formula " + config.identifier_; |
|
|
|
} else if (config.type_ == ConfigType::Label) { |
|
|
|
start_pos = str.find("label " + config.identifier_); |
|
|
|
search = "label " + config.identifier_; |
|
|
|
} else if (config.type_ == ConfigType::Module) { |
|
|
|
auto iter = boost::find_nth(str, config.identifier_, config.index_); |
|
|
|
start_pos = std::distance(str.begin(), iter.begin()); |
|
|
|
search = config.identifier_; |
|
|
|
} |
|
|
|
else if (config.type_ == ConfigType::Constant) { |
|
|
|
start_pos = str.find(config.identifier_); |
|
|
|
|
|
|
|
if (start_pos == std::string::npos) { |
|
|
|
std::cout << "Couldn't find overwrite:" << config.expression_ << std::endl; |
|
|
|
} |
|
|
|
search = config.identifier_; |
|
|
|
} |
|
|
|
|
|
|
|
auto iter = boost::find_nth(str, search, index); |
|
|
|
start_pos = std::distance(str.begin(), iter.begin()); |
|
|
|
size_t end_pos = str.find(';', start_pos) + 1; |
|
|
|
|
|
|
|
if (end_pos != std::string::npos && end_pos != 0) { |
|
|
|
std::string expression = config.expression_; |
|
|
|
|
|
|
|
str.replace(start_pos, end_pos - start_pos , expression); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void Grid::printToPrism(std::ostream& os, std::vector<Configuration>& configuration ,const prism::ModelType& modelType) { |
|
|
|
cells northRestriction, eastRestriction, southRestriction, westRestriction; |
|
|
|