 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
36 #include <xercesc/sax/SAXException.hpp>
37 #include <xercesc/sax/SAXParseException.hpp>
70 if (!oc.
isSet(
"detector-files")) {
71 throw ProcessError(
"No detector file given (use --detector-files <FILE>).");
75 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
77 throw ProcessError(
"Could not open detector file '" + *fileIt +
"'");
96 if (!oc.
isSet(
"measure-files")) {
102 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
104 throw ProcessError(
"The measure-file '" + *fileIt +
"' can not be opened.");
118 if (oc.
getBool(
"print-absolute-flows")) {
123 if (optNet !=
nullptr) {
124 if (oc.
getBool(
"remove-empty-detectors")) {
128 }
else if (oc.
getBool(
"report-empty-detectors")) {
137 std::vector<RODFDetector*>::const_iterator i = detectors.
getDetectors().begin();
150 oc.
getBool(
"keep-unfinished-routes"), oc.
getBool(
"routes-for-all"),
151 !oc.
getBool(
"keep-longer-routes"), oc.
getInt(
"max-search-depth"));
159 throw ProcessError(
"The detector types are not defined; use in combination with a network");
163 throw ProcessError(
"The emitters have no routes; use in combination with a network");
167 if (oc.
isSet(
"detector-output")) {
171 if (oc.
isSet(
"detectors-poi-output")) {
181 if (oc.
getBool(
"guess-empty-flows")) {
191 if (oc.
isSet(
"emitters-output") || oc.
isSet(
"emitters-poi-output")) {
193 if (oc.
getBool(
"revalidate-flows")) {
198 if (oc.
isSet(
"emitters-output")) {
203 oc.
getBool(
"calibrator-output"),
204 oc.
getBool(
"include-unused-routes"),
210 if (oc.
isSet(
"emitters-poi-output")) {
217 if (oc.
isSet(
"variable-speed-sign-output")) {
224 if (oc.
isSet(
"validation-output")) {
227 oc.
getBool(
"validation-output.add-sources"),
true,
true);
231 if (oc.
isSet(
"end-reroute-output")) {
291 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
297 }
catch (
const std::exception& e) {
298 if (std::string(e.what()) != std::string(
"")) {
313 std::cout <<
"Success." << std::endl;
void startComputation(RODFNet *optNet, RODFDetectorFlows &flows, RODFDetectorCon &detectors, OptionsCont &oc)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool detectorsHaveRoutes() const
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
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.
SAX2-Handler for loading DFROUTER-detector definitions.
static void close()
Closes all of an applications subsystems.
static void initOutputOptions()
init output options
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter.
#define PROGRESS_FAILED_MESSAGE()
void writeSpeedTrigger(const RODFNet *const net, const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void saveRoutes(const std::string &file) const
A loader for detector flows.
void printAbsolute() const
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
void readDetectorFlows(RODFDetectorFlows &flows, OptionsCont &oc, RODFDetectorCon &dc)
A container for RODFDetectors.
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 buildDetectorDependencies(RODFDetectorCon &detectors)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
int main(int argc, char **argv)
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
void writeEmitterPOIs(const std::string &file, const RODFDetectorFlows &flows)
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Interface for building instances of dfrouter-edges.
bool detectorsHaveCompleteTypes() const
static void init()
Initialises the xml-subsystem.
A storage for options typed value containers)
void readDetectors(RODFDetectorCon &detectors, OptionsCont &oc, RODFNet *optNet)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
SUMOTime string2time(const std::string &r)
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance.
static void fillOptions()
Inserts options used by dfrouter into the OptionsCont-singleton.
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
const std::vector< RODFDetector * > & getDetectors() const
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
#define PROGRESS_BEGIN_MESSAGE(msg)
#define PROGRESS_DONE_MESSAGE()
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
void guessEmptyFlows(RODFDetectorFlows &flows)
@ SOURCE_DETECTOR
A source detector.
static bool isReadable(std::string path)
Checks whether the given file is readable.
void saveAsPOIs(const std::string &file) const
static bool checkOptions()
checks shared options and sets StdDefs
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
void writeEndRerouterDetectors(const std::string &file)
void save(const std::string &file) const
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void read(const std::string &file)
Reads the given file assuming it contains detector values.
void writeValidationDetectors(const std::string &file, bool includeSources, bool singleFile, bool friendly)