Skip to content

Commit

Permalink
added some consts to track the YAML_FOLDER
Browse files Browse the repository at this point in the history
  • Loading branch information
clayness committed Jan 24, 2019
1 parent 5cd5fe9 commit d8f266e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions include/pladapt/SDPAdaptationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class SDPAdaptationManager : public AdaptationManager
static const char* REACH_PREFIX;
static const char* REACH_MODEL;
static const char* REACH_SCOPE;
static const char* YAML_FOLDER;

SDPAdaptationManager();

Expand Down
37 changes: 25 additions & 12 deletions src/SDPAdaptationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const char* SDPAdaptationManager::REACH_PATH = "reachPath";
const char* SDPAdaptationManager::REACH_PREFIX = "reachPrefix";
const char* SDPAdaptationManager::REACH_MODEL = "reachModel";
const char* SDPAdaptationManager::REACH_SCOPE = "reachScope";
const char* SDPAdaptationManager::YAML_FOLDER = "yamlFolder";


SDPAdaptationManager::SDPAdaptationManager() {
Expand Down Expand Up @@ -91,13 +92,19 @@ void SDPAdaptationManager::loadImmediateReachabilityRelation() {

pImmediateReachabilityRelation.reset(new ReachabilityRelation(pConfigMgr->getConfigurationSpace()));

string outputPath = getAlloyOutputPath(true);
string command = getAlloyCommand(true, outputPath);
string outputPath("");
if (params[YAML_FOLDER].IsDefined()) {
outputPath = params[YAML_FOLDER].as<string>();
outputPath += ".i.yaml";
} else {
outputPath = getAlloyOutputPath(true);
string command = getAlloyCommand(true, outputPath);

cout << "invoking " << command << endl;
cout << "invoking " << command << endl;

if (system(command.c_str()) != 0) {
throw runtime_error(string("Generation of immediate reachability function failed: ") + command.c_str());
if (system(command.c_str()) != 0) {
throw runtime_error(string("Generation of immediate reachability function failed: ") + command.c_str());
}
}

pImmediateReachabilityRelation->load(outputPath, *pConfigMgr);
Expand Down Expand Up @@ -127,13 +134,19 @@ void SDPAdaptationManager::loadReachabilityRelation() {
// the underlying StepReachabilityRelation is the identity
pStepReachabilityRelation->makeIdentity();
} else {
string outputPath = getAlloyOutputPath(false);
string command = getAlloyCommand(false, outputPath);

cout << "invoking " << command << endl;

if (system(command.c_str()) != 0) {
throw runtime_error(string("Generation of step reachability function failed: ") + command.c_str());
string outputPath("");
if (params[YAML_FOLDER].IsDefined()) {
outputPath = params[YAML_FOLDER].as<string>();
outputPath += ".yaml";
} else {
outputPath = getAlloyOutputPath(false);
string command = getAlloyCommand(false, outputPath);

cout << "invoking " << command << endl;

if (system(command.c_str()) != 0) {
throw runtime_error(string("Generation of step reachability function failed: ") + command.c_str());
}
}

pStepReachabilityRelation->load(outputPath, *pConfigMgr);
Expand Down

0 comments on commit d8f266e

Please sign in to comment.