diff --git a/vlsisapd/src/dtr/src/Techno.cpp b/vlsisapd/src/dtr/src/Techno.cpp index b47ad9ec..665b15dd 100644 --- a/vlsisapd/src/dtr/src/Techno.cpp +++ b/vlsisapd/src/dtr/src/Techno.cpp @@ -74,22 +74,33 @@ Rule* Techno::getRule(Name name, Name layer1, Name layer2) { if ((rule->getName() == name) && (rule->getLayer1() == layer1) && (rule->getLayer2() == layer2)) return rule; } - string error ("[ERROR] Could not find rule: "); - error += name.getString(); - error += "."; - error += layer1.getString(); - error += "."; - error += layer2.getString(); - error += "."; - throw DTRException(error); + //string error ("[ERROR] Could not find rule: "); + //error += name.getString(); + //error += "."; + //error += layer1.getString(); + //error += "."; + //error += layer2.getString(); + //error += "."; + //throw DTRException(error); + return NULL; } double Techno::getValue(Name name, Name layer1, Name layer2) { - return getRule(name, layer1, layer2)->getValue(); + Rule* r = getRule(name, layer1, layer2); + if(!r) { + string error = "[ERROR] Could not find rule: " + name.getString() + "." + layer1.getString() + "." + layer2.getString() + "."; + throw DTRException(error); + } + return r->getValue(); } const string& Techno::getValueAsString(Name name, Name layer1, Name layer2) { - return getRule(name, layer1, layer2)->getValueAsString(); + Rule* r = getRule(name, layer1, layer2); + if(!r) { + string error = "[ERROR] Could not find rule: " + name.getString() + "." + layer1.getString() + "." + layer2.getString() + "."; + throw DTRException(error); + } + return r->getValueAsString(); } Techno* Techno::readFromFile(const string filePath) { diff --git a/vlsisapd/src/dtr/src/vlsisapd/dtr/Techno.h b/vlsisapd/src/dtr/src/vlsisapd/dtr/Techno.h index a194d701..585b6bd2 100644 --- a/vlsisapd/src/dtr/src/vlsisapd/dtr/Techno.h +++ b/vlsisapd/src/dtr/src/vlsisapd/dtr/Techno.h @@ -28,6 +28,9 @@ class Techno { inline Name getUnit(); inline std::vector& getRules(); + inline void setName(Name); + inline void setUnit(Name); + Rule* addRule (Name name, double value, Name ref, Name layer1=Name(""), Name layer2=Name("")); ARule* addARule(Name name, double value, Name ref, Name layer1 , Name layer2); @@ -46,6 +49,9 @@ class Techno { inline Name Techno::getName() { return _name; }; inline Name Techno::getUnit() { return _unit; }; inline std::vector& Techno::getRules() { return _rules; }; + +inline void Techno::setName(Name name) { _name = name; }; +inline void Techno::setUnit(Name unit) { _unit = unit; }; } // namespace DTR #endif