SUMO - Simulation of Urban MObility
ROJTRFrame.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Sets and checks options for jtr-routing
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 
00023 
00024 // ===========================================================================
00025 // included modules
00026 // ===========================================================================
00027 #ifdef _MSC_VER
00028 #include <windows_config.h>
00029 #else
00030 #include <config.h>
00031 #endif
00032 
00033 #include <iostream>
00034 #include <fstream>
00035 #include <ctime>
00036 #include <utils/options/OptionsCont.h>
00037 #include <utils/options/Option.h>
00038 #include <utils/common/MsgHandler.h>
00039 #include <utils/common/UtilExceptions.h>
00040 #include <utils/common/ToString.h>
00041 #include "ROJTRFrame.h"
00042 #include <router/ROFrame.h>
00043 #include <utils/common/RandHelper.h>
00044 #include <utils/common/SystemFrame.h>
00045 #include <utils/common/SUMOVehicleParameter.h>
00046 
00047 #ifdef CHECK_MEMORY_LEAKS
00048 #include <foreign/nvwa/debug_new.h>
00049 #endif // CHECK_MEMORY_LEAKS
00050 
00051 
00052 // ===========================================================================
00053 // method definitions
00054 // ===========================================================================
00055 void
00056 ROJTRFrame::fillOptions() {
00057     OptionsCont& oc = OptionsCont::getOptions();
00058     oc.addCallExample("-c <CONFIGURATION>", "run with routing options defined in file");
00059 
00060     // insert options sub-topics
00061     SystemFrame::addConfigurationOptions(oc);
00062     oc.addOptionSubTopic("Input");
00063     oc.addOptionSubTopic("Output");
00064     oc.addOptionSubTopic("Processing");
00065     oc.addOptionSubTopic("Defaults");
00066     oc.addOptionSubTopic("Time");
00067     SystemFrame::addReportOptions(oc); // fill this subtopic, too
00068 
00069     ROFrame::fillOptions(oc, false);
00070 
00071     oc.doRegister("turn-ratio-files", 't', new Option_FileName());
00072     oc.addSynonyme("turn-ratio-files", "turns");
00073     oc.addSynonyme("turn-ratio-files", "turn-definitions", true);
00074     oc.addDescription("turn-ratio-files", "Input", "Read turning ratios from FILE(s)");
00075 
00076     oc.doRegister("exit-times", new Option_Bool(false));
00077     oc.addDescription("exit-times", "Output", "Write exit times (weights) for each edge");
00078 
00079     oc.doRegister("max-edges-factor", new Option_Float(2.0));
00080     oc.addDescription("max-edges-factor", "Processing", "");
00081 
00082     oc.doRegister("turn-defaults", 'T', new Option_String("30,50,20"));
00083     oc.addDescription("turn-defaults", "Processing", "Use STR as default turn definition");
00084 
00085     oc.doRegister("sink-edges", 's', new Option_String());
00086     oc.addSynonyme("sink-edges", "sinks");
00087     oc.addDescription("sink-edges", "Processing", "Use STR as list of sink edges");
00088 
00089     oc.doRegister("accept-all-destinations", 'A', new Option_Bool(false));
00090     oc.addDescription("accept-all-destinations", "Processing", "Whether all edges are allowed as sink edges");
00091 
00092     oc.doRegister("ignore-vclasses", 'i', new Option_Bool(false));
00093     oc.addSynonyme("ignore-vclasses", "ignore-classes", true);
00094     oc.addDescription("ignore-vclasses", "Processing", "Ignore road restrictions based on vehicle class");
00095 
00096     oc.doRegister("allow-loops", new Option_Bool(false));
00097     oc.addDescription("allow-loops", "Processing", "Allow to re-use a road");
00098 
00099     // add rand options
00100     RandHelper::insertRandOptions();
00101 }
00102 
00103 
00104 bool
00105 ROJTRFrame::checkOptions() {
00106     OptionsCont& oc = OptionsCont::getOptions();
00107     bool ok = ROFrame::checkOptions(oc);
00108     ok &= (!oc.isSet("departlane") || SUMOVehicleParameter::departlaneValidate(oc.getString("departlane")));
00109     ok &= (!oc.isSet("departpos") || SUMOVehicleParameter::departposValidate(oc.getString("departpos")));
00110     ok &= (!oc.isSet("departspeed") || SUMOVehicleParameter::departspeedValidate(oc.getString("departspeed")));
00111     ok &= (!oc.isSet("arrivallane") || SUMOVehicleParameter::arrivallaneValidate(oc.getString("arrivallane")));
00112     ok &= (!oc.isSet("arrivalpos") || SUMOVehicleParameter::arrivalposValidate(oc.getString("arrivalpos")));
00113     ok &= (!oc.isSet("arrivalspeed") || SUMOVehicleParameter::arrivalspeedValidate(oc.getString("arrivalspeed")));
00114     return ok;
00115 }
00116 
00117 
00118 
00119 /****************************************************************************/
00120 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines