diff --git a/vlsisapd/src/dtr/src/Techno.cpp b/vlsisapd/src/dtr/src/Techno.cpp index 3c743199..b47ad9ec 100644 --- a/vlsisapd/src/dtr/src/Techno.cpp +++ b/vlsisapd/src/dtr/src/Techno.cpp @@ -8,10 +8,12 @@ */ #include +#include #include #include #include #include +#include using namespace std; #include @@ -23,10 +25,12 @@ using namespace std; namespace { template T getValue(xmlChar* str) { - std::istringstream iss; - iss.str((const char*) str); - T res; - iss >> res; + if (string((const char*)str).empty()) + return numeric_limits::quiet_NaN(); + std::istringstream iss; + iss.str((const char*) str); + T res; + iss >> res; return res; } } @@ -199,28 +203,39 @@ bool Techno::writeToFile(string filePath) { if (_rules.size() == 0) { throw DTRException("[ERROR] Cannot writeToFile since no rule is defined!"); } - + file << "" << endl << " " << endl; + file.setf(ios::left, ios::adjustfield); for (size_t i = 0 ; i < _rules.size() ; i++) { Rule* rule = _rules[i]; + string name = "\""+rule->getName().getString()+"\""; if (dynamic_cast(rule)) { - file << " getName().getString() << "\" "; + file << " getName().getString() << "\" "; + file << " getType() != Name("")) { - file << "type=\"" << rule->getType().getString() << "\" "; + string type = "\""+rule->getType().getString()+"\""; + file << "type=" << setw(12) << type << " "; + spacing = 0; } if (rule->getLayer1() != Name("")) { + string l1 = "\""+rule->getLayer1().getString()+"\""; if (rule->getLayer2() != Name("")) { - file << "layer1=\"" << rule->getLayer1().getString() << "\" layer2=\"" << rule->getLayer2().getString() << "\" "; + string l2 = "\""+rule->getLayer2().getString()+"\""; + file << "layer1=" << setw(10) << l1 << " layer2=" << setw(10) << l2 << " "; } else { - file << "layer=\"" << rule->getLayer1().getString() << "\" "; + file << "layer=" << setw(11+spacing) << l1 << " "; } + } else { + file << setw(36) << " "; } - file << "value=\"" << rule->getValue() << "\" ref=\"" << rule->getRef().getString() << "\"/>" << endl; + ostringstream oss; + oss << "\"" << rule->getValue() <<"\""; + file << "value=" << setw(7) << oss.str() << " ref=\"" << rule->getRef().getString() << "\"/>" << endl; } file << " " << endl << "" << endl; diff --git a/vlsisapd/src/dtr/src/vlsisapd/dtr/Rules.h b/vlsisapd/src/dtr/src/vlsisapd/dtr/Rules.h index 0ad13c88..f8260e64 100644 --- a/vlsisapd/src/dtr/src/vlsisapd/dtr/Rules.h +++ b/vlsisapd/src/dtr/src/vlsisapd/dtr/Rules.h @@ -39,6 +39,8 @@ class Rule { // modifiers inline void setType(Name); + inline void setValue(double); + inline void setRef(Name); // members private: @@ -65,7 +67,9 @@ inline Name Rule::getLayer1() { return _layer1; }; inline Name Rule::getLayer2() { return _layer2; }; inline const std::string& Rule::getValueAsString() { return _valueStr.getString(); }; -inline void Rule::setType(Name type) { _type = type; }; +inline void Rule::setType(Name type) { _type = type; }; +inline void Rule::setValue(double value) { _value = value; _valueStr = to_string(value); }; +inline void Rule::setRef(Name ref) { _ref = ref; }; } // namespace DTR #endif