37 #include <xercesc/sax/SAXException.hpp>
38 #include <xercesc/sax/SAXParseException.hpp>
66 #ifdef CHECK_MEMORY_LEAKS
68 #endif // CHECK_MEMORY_LEAKS
84 const std::vector<SUMOReal>& turnDefs) {
89 const std::map<std::string, ROEdge*>& edges = net.
getEdgeMap();
90 for (std::map<std::string, ROEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
91 static_cast<ROJTREdge*
>((*i).second)->setTurnDefaults(turnDefs);
97 std::vector<SUMOReal> ret;
99 if (defs.size() < 2) {
100 throw ProcessError(
"The defaults for turnings must be a tuple of at least two numbers divided by ','.");
102 for (std::vector<std::string>::const_iterator i = defs.begin(); i != defs.end(); ++i) {
117 if (oc.
isSet(
"turn-ratio-files")) {
119 std::vector<std::string> ratio_files = oc.
getStringVector(
"turn-ratio-files");
120 for (std::vector<std::string>::const_iterator i = ratio_files.begin(); i != ratio_files.end(); ++i) {
130 if (oc.
isSet(
"sink-edges")) {
132 for (std::vector<std::string>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
135 throw ProcessError(
"The edge '" + *i +
"' declared as a sink is not known.");
172 oc.
setApplicationDescription(
"Router for the microscopic road traffic simulation SUMO based on junction turning ratios.");
202 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
205 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
213 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
219 }
catch (
const std::exception& e) {
220 if (std::string(e.what()) != std::string(
"")) {
233 std::cout <<
"Success." << std::endl;
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Computes routes using junction turning percentages.
static SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal value described by it
void openRoutes(RONet &net)
Builds and opens all route loaders.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
static void adaptIntermodalRouter(ROIntermodalRouter &router)
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::vector< SUMOReal > getTurningDefaults(OptionsCont &oc)
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
void setFunc(EdgeFunc func)
Sets the function of the edge.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
static void close()
Closes all of an applications subsystems.
const std::map< std::string, ROEdge * > & getEdgeMap() const
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
static OptionsCont & getOptions()
Retrieves the options.
void openOutput(const OptionsCont &options, const std::string altFilename="")
Opens the output for computed routes.
static void initRandGlobal(MTRand *which=0)
Reads the given random number options and initialises the random number generator in accordance...
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void initNet(RONet &net, ROLoader &loader, const std::vector< SUMOReal > &turnDefs)
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary ...
An edge where vehicles disappear (no vehicle may leave this edge)
Loader for the of turning percentages and source/sink definitions.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
SUMOTime string2time(const std::string &r)
int getEdgeNo() const
Returns the total number of edges the network contains including internal edges.
An edge the jtr-router may route through.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
int main(int argc, char **argv)
static void setUsingJTRR()
The router's network representation.
static void fillOptions()
Inserts options used by jtrrouter into the OptionsCont-singleton.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within jtrrouter...
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
void clear()
Clears information whether an error occured previously.
static void initOutputOptions()
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)
static std::string _2str(const int var)
convert int to string
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Interface for building instances of jtrrouter-edges.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
void loadJTRDefinitions(RONet &net, OptionsCont &oc)