40 #include <xercesc/sax/SAXException.hpp>
41 #include <xercesc/sax/SAXParseException.hpp>
70 #ifdef CHECK_MEMORY_LEAKS
72 #endif // CHECK_MEMORY_LEAKS
83 if (!oc.
isSet(
"detector-files")) {
84 throw ProcessError(
"No detector file given (use --detector-files <FILE>).");
88 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
90 throw ProcessError(
"Could not open detector file '" + *fileIt +
"'");
109 if (!oc.
isSet(
"measure-files")) {
115 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
117 throw ProcessError(
"The measure-file '" + *fileIt +
"' can not be opened.");
131 if (oc.
getBool(
"print-absolute-flows")) {
137 if (oc.
getBool(
"remove-empty-detectors")) {
141 }
else if (oc.
getBool(
"report-empty-detectors")) {
150 std::vector<RODFDetector*>::const_iterator i = detectors.
getDetectors().begin();
163 oc.
getBool(
"keep-unfinished-routes"), oc.
getBool(
"routes-for-all"),
164 !oc.
getBool(
"keep-longer-routes"), oc.
getInt(
"max-search-depth"));
172 throw ProcessError(
"The detector types are not defined; use in combination with a network");
176 throw ProcessError(
"The emitters have no routes; use in combination with a network");
180 if (oc.
isSet(
"detector-output")) {
184 if (oc.
isSet(
"detectors-poi-output")) {
194 if (oc.
getBool(
"guess-empty-flows")) {
204 if (oc.
isSet(
"emitters-output") || oc.
isSet(
"emitters-poi-output")) {
206 if (oc.
getBool(
"revalidate-flows")) {
211 if (oc.
isSet(
"emitters-output")) {
216 oc.
getBool(
"calibrator-output"),
217 oc.
getBool(
"include-unused-routes"),
223 if (oc.
isSet(
"emitters-poi-output")) {
230 if (oc.
isSet(
"variable-speed-sign-output")) {
237 if (oc.
isSet(
"validation-output")) {
240 oc.
getBool(
"validation-output.add-sources"),
true,
true);
244 if (oc.
isSet(
"end-reroute-output")) {
291 loader.loadNet(*net, builder);
292 net->buildApproachList();
303 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
309 }
catch (
const std::exception& e) {
310 if (std::string(e.what()) != std::string(
"")) {
325 std::cout <<
"Success." << std::endl;
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
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.
void readDetectors(RODFDetectorCon &detectors, OptionsCont &oc, RODFNet *optNet)
static void getOptions(bool loadConfig, int argc=0, char **argv=0)
Parses the command line arguments and loads the configuration optionally.
static bool isReadable(std::string path)
Checks whether the given file is readable.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
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)
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
const std::vector< RODFDetector * > & getDetectors() const
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
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)
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.
A container for RODFDetectors.
A loader for detector flows.
static OptionsCont & getOptions()
Retrieves the options.
static void initRandGlobal(MTRand *which=0)
Reads the given random number options and initialises the random number generator in accordance...
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
void printAbsolute() const
void writeEmitters(const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, const RODFNet &net, bool writeCalibrators, bool includeUnusedRoutes, SUMOReal scale, bool insertionsOnly)
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 save(const std::string &file) const
void read(const std::string &file)
Reads the given file assuming it contains detector values.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
SUMOTime string2time(const std::string &r)
Interface for building instances of dfrouter-edges.
void writeValidationDetectors(const std::string &file, bool includeSources, bool singleFile, bool friendly)
#define PROGRESS_BEGIN_MESSAGE(msg)
void readDetectorFlows(RODFDetectorFlows &flows, OptionsCont &oc, RODFDetectorCon &dc)
void saveAsPOIs(const std::string &file) const
void startComputation(RODFNet *optNet, RODFDetectorFlows &flows, RODFDetectorCon &detectors, OptionsCont &oc)
SAX2-Handler for loading DFROUTER-detector definitions.
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void guessEmptyFlows(RODFDetectorFlows &flows)
void buildDetectorDependencies(RODFDetectorCon &detectors)
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter...
void writeEmitterPOIs(const std::string &file, const RODFDetectorFlows &flows)
void writeEndRerouterDetectors(const std::string &file)
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
#define PROGRESS_DONE_MESSAGE()
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool detectorsHaveRoutes() const
static void initOutputOptions()
int main(int argc, char **argv)
bool detectorsHaveCompleteTypes() const
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static void fillOptions()
Inserts options used by dfrouter into the OptionsCont-singleton.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.