38 #include <xercesc/parsers/SAXParser.hpp>
39 #include <xercesc/util/PlatformUtils.hpp>
40 #include <xercesc/util/TransService.hpp>
41 #include <xercesc/sax2/SAX2XMLReader.hpp>
58 #ifdef HAVE_INTERNAL // catchall for internal stuff
59 #include <internal/RouteAggregator.h>
60 #endif // have HAVE_INTERNAL
62 #ifdef CHECK_MEMORY_LEAKS
64 #endif // CHECK_MEMORY_LEAKS
82 WRITE_WARNING(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
84 WRITE_ERROR(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
97 ROEdge* e = myNet.getEdge(
id);
103 WRITE_WARNING(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
105 WRITE_ERROR(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
119 myLoaders(oc.exists(
"unsorted-input") && oc.getBool(
"unsorted-input") ? 0 :
DELTA_T)
131 throw ProcessError(
"Missing definition of network to load!");
134 throw ProcessError(
"The network file '" + file +
"' could not be found.");
148 throw ProcessError(
"The districts file '" + file +
"' could not be found.");
193 bool endReached =
false;
194 bool errorOccured =
false;
197 for (
SUMOTime time = firstStep; time < end && !errorOccured && !endReached; time +=
DELTA_T) {
211 #ifdef HAVE_INTERNAL // catchall for internal stuff
216 RouteAggregator::processAllRoutes(net, router);
237 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
242 std::string msg =
"The loader for " + optionName +
" from file '" + *fileIt +
"' could not be initialised;";
243 std::string reason = e.what();
244 if (reason !=
"Process Error" && reason !=
"") {
245 msg = msg +
"\n Reason: " + reason +
".";
247 msg = msg +
"\n (unknown reason).";
259 const std::string& measure,
bool useLanes) {
265 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
271 if (measure !=
"traveltime") {
272 std::string umeasure = measure;
273 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel") {
274 umeasure = measure +
"_perVeh";
282 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
292 const std::map<std::string, ROEdge*>& edges = net.
getEdgeMap();
293 for (std::map<std::string, ROEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
294 (*i).second->buildTimeLines(measure);
void processRoutes(SUMOTime start, SUMOTime end, RONet &net, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Loads routes from all previously build route loaders.
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 MsgHandler * getErrorInstance()
Returns the instance to add errors to.
void loadNext(SUMOTime step)
loads the next routes
RONet & myNet
The network edges shall be obtained from.
void openRoutes(RONet &net)
Builds and opens all route loaders.
An XML-handler for network weights.
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)
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, bool useLanes)
Loads the net weights.
SUMOTime getFirstLoadTime() const
returns the timestamp of the first loaded vehicle or flow
std::string time2string(SUMOTime t)
void add(SUMORouteLoader *loader)
add another loader
const bool myLogSteps
Information whether the routing steps should be logged.
static bool runParser(GenericSAXHandler &handler, const std::string &file)
Runs the given handler on the given file; returns if everything's ok.
Interface for building instances of router-edges.
void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a travel time value.
#define WRITE_WARNING(msg)
const std::map< std::string, ROEdge * > & getEdgeMap() const
static OptionsCont & getOptions()
Retrieves the options.
OptionsCont & myOptions
Options to use.
void addEdgeWeight(const std::string &id, SUMOReal val, SUMOReal beg, SUMOReal end) const
Adds an effort for a given edge and time period.
virtual ~ROLoader()
Destructor.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
#define PROGRESS_FAILED_MESSAGE()
void setFileName(const std::string &name)
Sets the current file name.
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
Obtains edge weights from a weights handler and stores them within the edges.
SUMORouteLoaderControl myLoaders
List of route loaders.
const bool myEmptyDestinationsAllowed
Information whether empty destinations are allowed.
static bool exists(std::string path)
Checks whether the given file exists.
void addEdgeWeight(const std::string &id, SUMOReal val, SUMOReal beg, SUMOReal end) const
Adds a travel time for a given edge and time period.
bool openTypedRoutes(const std::string &optionName, RONet &net)
Opens route handler of the given type.
virtual bool furtherStored()
Returns the information whether further vehicles are stored.
SUMOTime string2time(const std::string &r)
#define PROGRESS_BEGIN_MESSAGE(msg)
bool wasInformed() const
Returns the information whether any messages were added.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
A basic edge for routing applications.
Complete definition about what shall be retrieved and where to store it.
The router's network representation.
Obtains edge travel times from a weights handler and stores them within the edges.
void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a weight value.
A storage for options typed value containers)
The handler that parses a SUMO-network for its usage in a router.
Parser and container for routes during their loading.
#define PROGRESS_DONE_MESSAGE()
SUMOTime saveAndRemoveRoutesUntil(OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime time)
Computes routes described by their definitions and saves them.
#define WRITE_MESSAGE(msg)
ROLoader(OptionsCont &oc, const bool emptyDestinationsAllowed, const bool logSteps)
Constructor.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void writeStats(SUMOTime time, SUMOTime start, int absNo)