TSPLIB
src/ValidateConstantsFunctionsAndClasses.hpp
Go to the documentation of this file.
00001 
00013 #ifndef _ValidateConstantsFunctionsAndClasses_HPP_
00014 #define _ValidateConstantsFunctionsAndClasses_HPP_
00015 
00016 #include <limits>
00017 #include <fstream>
00018 #include <sstream>
00019 #include <iomanip>
00020 #include <string>
00021 
00022 
00026 const std::string INPUT_FILE_FILENAME_EXTENSION = ".xml";
00027 
00031 const std::string VALIDATION_SCHEMA = "TSPConfiguration.xsd";
00032 
00036 const std::string XML_ENCODING = "UTF-8";
00037 
00041 const std::ios::fmtflags DOUBLE_FLOATFIELD = std::ios::scientific;
00042 
00046 const std::string XML_DOCUMENT_NODE = "travellingSalesmanProblemInstance";
00047 
00051 const std::string XML_NAME = "name";
00052 
00056 const std::string XML_SOURCE = "source";
00057 
00061 const std::string XML_DESCRIPTION = "description";
00062 
00066 const std::string XML_DOUBLE_PRECISION = "doublePrecision";
00067 
00072 const std::string XML_IGNORED_DIGITS = "ignoredDigits";
00073 
00077 const std::string XML_GRAPH = "graph";
00078 
00082 const std::string XML_VERTEX = "vertex";
00083 
00087 const std::string XML_EDGE = "edge";
00088 
00092 const std::string XML_EDGE_ATTRIBUTE_COST = "cost";
00093 
00094 
00100 inline void trimLeft (std::string &s, const std::string &t = " \t\r\n") {
00101         s.erase(0, s.find_first_not_of(t));
00102 }
00103 
00109 inline void trimRight (std::string &s, const std::string &t = " \t\r\n") {
00110         std::string::size_type i = s.find_last_not_of(t);
00111         if (i == std::string::npos) {
00112                 s = "";
00113         }
00114         else {
00115                 s.erase(s.find_last_not_of(t) + 1);
00116         }
00117 }
00118 
00124 inline void trim (std::string &s, const std::string &t = " \t\r\n") {
00125         trimLeft(s, t);
00126         trimRight(s, t);
00127 }
00128 
00129 
00133 class CommandLineArgumentsInvalid : public std::exception {
00134 public:
00138         inline CommandLineArgumentsInvalid() {
00139         }
00140 };
00141 
00145 class ValidationSchemaDoesNotExist : public std::exception {
00146 public:
00150         inline ValidationSchemaDoesNotExist() {
00151         }
00152 };
00153 
00157 class ValidationFailed : public std::exception {
00158 public:
00162         inline ValidationFailed() {
00163         }
00164 };
00165 
00166 
00167 #endif
 All Classes Files Functions Variables Friends Defines