35#include <xercesc/sax/SAXException.hpp>
36#include <xercesc/sax/SAXParseException.hpp>
69 if (!oc.
isSet(
"detector-files")) {
70 throw ProcessError(
TL(
"No detector file given (use --detector-files <FILE>)."));
74 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
95 if (!oc.
isSet(
"measure-files")) {
101 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
103 throw ProcessError(
TLF(
"The measure-file '%' can not be opened.", *fileIt));
117 if (oc.
getBool(
"print-absolute-flows")) {
121 if (oc.
getBool(
"remove-empty-detectors")) {
125 }
else if (oc.
getBool(
"report-empty-detectors")) {
134 std::vector<RODFDetector*>::const_iterator i = detectors.
getDetectors().begin();
147 oc.
getBool(
"keep-unfinished-routes"), oc.
getBool(
"routes-for-all"),
148 !oc.
getBool(
"keep-longer-routes"), oc.
getInt(
"max-search-depth"));
155 throw ProcessError(
TL(
"The detector types are not defined; use in combination with a network"));
159 throw ProcessError(
TL(
"The emitters have no routes; use in combination with a network"));
163 if (oc.
isSet(
"detector-output")) {
167 if (oc.
isSet(
"detectors-poi-output")) {
177 if (oc.
getBool(
"guess-empty-flows")) {
187 if (oc.
isSet(
"emitters-output") || oc.
isSet(
"emitters-poi-output")) {
189 if (oc.
getBool(
"revalidate-flows")) {
194 if (oc.
isSet(
"emitters-output")) {
199 oc.
getBool(
"calibrator-output"),
200 oc.
getBool(
"include-unused-routes"),
206 if (oc.
isSet(
"emitters-poi-output")) {
213 if (oc.
isSet(
"variable-speed-sign-output")) {
220 if (oc.
isSet(
"validation-output")) {
223 oc.
getBool(
"validation-output.add-sources"),
true,
true);
227 if (oc.
isSet(
"end-reroute-output")) {
287 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
293 }
catch (
const std::exception& e) {
294 if (std::string(e.what()) != std::string(
"")) {
309 std::cout <<
"Success." << std::endl;
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_FAILED_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
@ SOURCE_DETECTOR
A source detector.
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
static bool isReadable(std::string path)
Checks whether the given file is readable.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static void initOutputOptions()
init output options
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
A loader for detector flows.
void read(const std::string &file)
Reads the given file assuming it contains detector values.
A container for RODFDetectors.
bool detectorsHaveRoutes() const
void save(const std::string &file) const
void writeEmitterPOIs(const std::string &file, const RODFDetectorFlows &flows)
void writeValidationDetectors(const std::string &file, bool includeSources, bool singleFile, bool friendly)
void guessEmptyFlows(RODFDetectorFlows &flows)
bool detectorsHaveCompleteTypes() const
void saveRoutes(const std::string &file) const
void writeSpeedTrigger(const RODFNet *const net, const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void writeEmitters(const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, const RODFNet &net, bool writeCalibrators, bool includeUnusedRoutes, double scale, bool insertionsOnly)
void saveAsPOIs(const std::string &file) const
const std::vector< RODFDetector * > & getDetectors() const
void writeEndRerouterDetectors(const std::string &file)
void printAbsolute() const
SAX2-Handler for loading DFROUTER-detector definitions.
Interface for building instances of dfrouter-edges.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter.
static void fillOptions()
Inserts options used by dfrouter into the OptionsCont-singleton.
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
void buildDetectorDependencies(RODFDetectorCon &detectors)
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
static void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
static void init()
Initialises the xml-subsystem.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
int main(int argc, char **argv)
void readDetectors(RODFDetectorCon &detectors, OptionsCont &oc, RODFNet *optNet)
void startComputation(RODFNet *optNet, RODFDetectorFlows &flows, RODFDetectorCon &detectors, OptionsCont &oc)
void readDetectorFlows(RODFDetectorFlows &flows, OptionsCont &oc, RODFDetectorCon &dc)