LCOV - code coverage report
Current view: top level - src/utils/options - Option.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 42.9 % 28 12
Test Date: 2024-12-21 15:45:41 Functions: 46.7 % 15 7

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    Option.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @author  Jakob Erdmann
      18              : /// @date    Mon, 17 Dec 2001
      19              : ///
      20              : // Classes representing a single program option (with different types)
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <string>
      26              : #include <vector>
      27              : #include <exception>
      28              : #include <utils/common/UtilExceptions.h>
      29              : 
      30              : // ===========================================================================
      31              : // class definitions
      32              : // ===========================================================================
      33              : 
      34              : /**@typedef IntVector
      35              :  * @brief Definition of a vector of ints
      36              :  */
      37              : typedef std::vector<int> IntVector;
      38              : 
      39              : /**@typedef StringVector
      40              :  * @brief Definition of a vector of strings
      41              :  */
      42              : typedef std::vector<std::string> StringVector;
      43              : 
      44              : #define CLONEABLE(Type) virtual Type* clone() const { return new Type(*this); }
      45              : 
      46              : /* -------------------------------------------------------------------------
      47              :  * Option
      48              :  * ----------------------------------------------------------------------- */
      49              : /**
      50              :  * @class Option
      51              :  * @brief A class representing a single program option
      52              :  *
      53              :  * The base class for a single program option. All options which hold values
      54              :  *  are derived from this class as the type of stored values may differ.
      55              :  *
      56              :  * Most of the getter-methods throw exceptions because this base class is not meant
      57              :  *  to hold any values by itself. Instead, the derived classes implement the
      58              :  *  appropriate method (Option_Integer implements getInt, f.e.). So, when one
      59              :  *  tries to retrieve a value which is not of the type of the option, an
      60              :  *  exception will be thrown. This behaviour is meant to be valid, because
      61              :  *  errors like this one only occur when building and testing the application.
      62              :  *
      63              :  * Due to described behaviour, this class has no public constructors. Only
      64              :  *  construction of derived, value and type holding, classes is allowed.
      65              :  *
      66              :  *  At the begin (after being constructed) an Option either has a default value or not.
      67              :  *   In dependence to this, myHaveTheDefaultValue is set. Also, myAmSet is set to
      68              :  *   true if a default value was supported. myAmWritable is set to true,
      69              :  *   indicating that a new value may be set.
      70              :  *
      71              :  * Each option may have a description about its purpose stored. Furthermore, it
      72              :  *  stores a man-readable type name for this option.
      73              :  */
      74              : class Option {
      75              : 
      76              : public:
      77              :     /// @brief destructor
      78              :     virtual ~Option();
      79              : 
      80              :     /** @brief returns the information whether this options holds a valid value
      81              :      * @return Whether a value has been set
      82              :      */
      83              :     bool isSet() const;
      84              : 
      85              :     /** @brief Returns the stored double value
      86              :      *
      87              :      * Option_Float returns the stored real number in this method's reimplementation.
      88              :      *  All other option classes do not override this method which throws an InvalidArgument-exception.
      89              :      *
      90              :      * @return Returns the stored real number if being an instance of Option_Float
      91              :      * @exception InvalidArgument If the class is not an instance of Option_Float
      92              :      */
      93              :     virtual double getFloat() const;
      94              : 
      95              :     /** @brief Returns the stored integer value
      96              :      *
      97              :      * Option_Integer returns the stored integer number in this method's reimplementation.
      98              :      *  All other option classesdo not override this method which throws an InvalidArgument-exception.
      99              :      *
     100              :      * @return Returns the stored integer number if being an instance of Option_Integer
     101              :      * @exception InvalidArgument If the class is not an instance of Option_Integer
     102              :      */
     103              :     virtual int getInt() const;
     104              : 
     105              :     /** @brief Returns the stored string value
     106              :      *
     107              :      * Option_String returns the stored string in this method's reimplementation.
     108              :      *  Option_FileName's reimplementation is only to be used for single filename string-vector options.
     109              :      *  All other option classes do not override this method which throws an InvalidArgument-exception.
     110              :      *
     111              :      * @return Returns the stored string if being an instance of Option_String or Option_FileName
     112              :      * @exception InvalidArgument If the class is not an instance of Option_String or Option_FileName
     113              :      */
     114              :     virtual std::string getString() const;
     115              : 
     116              :     /** @brief Returns the stored boolean value
     117              :      *
     118              :      * Option_Bool returns the stored boolean in this method's reimplementation.
     119              :      *  All other option classes do not override this method which throws an InvalidArgument-exception.
     120              :      *
     121              :      * @return Returns the stored boolean if being an instance of Option_Bool
     122              :      * @exception InvalidArgument If the class is not an instance of Option_Bool
     123              :      */
     124              :     virtual bool getBool() const;
     125              : 
     126              :     /** @brief Returns the stored integer vector
     127              :      *
     128              :      * Option_IntVector returns the stored integer vector in this method's reimplementation.
     129              :      *  All other option classes do not override this method which throws an InvalidArgument-exception.
     130              :      *
     131              :      * @return Returns the stored integer vector if being an instance of Option_IntVector
     132              :      * @exception InvalidArgument If the class is not an instance of Option_IntVector
     133              :      */
     134              :     virtual const IntVector& getIntVector() const;
     135              : 
     136              :     /** @brief Returns the stored string vector
     137              :      *
     138              :      * Option_StringVector returns the stored string vector in this method's reimplementation.
     139              :      *  All other option classes do not override this method which throws an InvalidArgument-exception.
     140              :      *
     141              :      * @return Returns the stored string vector if being an instance of Option_StringVector
     142              :      * @exception InvalidArgument If the class is not an instance of Option_StringVector
     143              :      */
     144              :     virtual const StringVector& getStringVector() const;
     145              : 
     146              :     /** @brief Stores the given value
     147              :      *
     148              :      * This method is overriden by all option classes.
     149              :      *  The value is converted into the proper type and stored in "myValue".
     150              :      *  Then, "markSet" is called in order to know that a value has been set.
     151              :      *
     152              :      * The method returns whether the value could be set (the return value from
     153              :      *  "markSet").
     154              :      *
     155              :      * If the string could not be converted into the type, an InvalidArgument
     156              :      *  is thrown.
     157              :      *
     158              :      * @return Whether the new value could be set
     159              :      * @exception InvalidArgument If the value could not be converted
     160              :      */
     161              :     virtual bool set(const std::string& v, const std::string& orig, const bool append) = 0;
     162              : 
     163              :     /** @brief Returns the string-representation of the value
     164              :      *
     165              :      * The stored value is encoded into a string and returned.
     166              :      *
     167              :      * @return The stored value encoded into a string-
     168              :      */
     169              :     const std::string& getValueString() const;
     170              : 
     171              :     /** @brief Returns the information whether the option holds the default value
     172              :     *
     173              :     * @return true if the option was not set from command line / configuration, false otherwise
     174              :     */
     175              :     virtual bool isDefault() const;
     176              : 
     177              :     /** @brief Returns the information whether the option is a int option
     178              :     *
     179              :     * Returns false. Only Option_Integer overrides this method returning true.
     180              :     *
     181              :     * @return true if the Option is an Option_Integer, false otherwise
     182              :     */
     183              :     virtual bool isInteger() const;
     184              : 
     185              :     /** @brief Returns the information whether the option is a float option
     186              :     *
     187              :     * Returns false. Only Option_Float overrides this method returning true.
     188              :     *
     189              :     * @return true if the Option is an Option_Float, false otherwise
     190              :     */
     191              :     virtual bool isFloat() const;
     192              : 
     193              :     /** @brief Returns the information whether the option is a bool option
     194              :      *
     195              :      * Returns false. Only Option_Bool overrides this method returning true.
     196              :      *
     197              :      * @return true if the Option is an Option_Bool, false otherwise
     198              :      */
     199              :     virtual bool isBool() const;
     200              : 
     201              :     /** @brief Returns the information whether this option is a file name
     202              :      *
     203              :      * Returns false. Only Option_FileName overrides this method returning true.
     204              :      *
     205              :      * @return true if the Option is an Option_FileName, false otherwise
     206              :      */
     207              :     virtual bool isFileName() const;
     208              : 
     209              :     /** @brief Returns the information whether this option is a network file
     210              :      *
     211              :      * Returns false. Only Option_Network overrides this method returning true.
     212              :      *
     213              :      * @return true if the Option is an Option_Network, false otherwise
     214              :      */
     215              :     virtual bool isNetwork() const;
     216              : 
     217              :     /** @brief Returns the information whether this option is an additional file
     218              :      *
     219              :      * Returns false. Only Option_Additional overrides this method returning true.
     220              :      *
     221              :      * @return true if the Option is an Option_Additional, false otherwise
     222              :      */
     223              :     virtual bool isAdditional() const;
     224              : 
     225              :     /** @brief Returns the information whether this option is a route file
     226              :      *
     227              :      * Returns false. Only Option_Route overrides this method returning true.
     228              :      *
     229              :      * @return true if the Option is an Option_Route, false otherwise
     230              :      */
     231              :     virtual bool isRoute() const;
     232              : 
     233              :     /** @brief Returns the information whether this option is a data file
     234              :      *
     235              :      * Returns false. Only Option_Data overrides this method returning true.
     236              :      *
     237              :      * @return true if the Option is an Option_Data, false otherwise
     238              :      */
     239              :     virtual bool isData() const;
     240              : 
     241              :     /** @brief Returns the information whether this option is a sumo config file
     242              :      *
     243              :      * Returns false. Only Option_SumoConfig overrides this method returning true.
     244              :      *
     245              :      * @return true if the Option is an Option_SumoConfig, false otherwise
     246              :      */
     247              :     virtual bool isSumoConfig() const;
     248              : 
     249              :     /** @brief Returns the information whether this option is an edge
     250              :      *
     251              :      * Returns false. Only Option_Edge overrides this method returning true.
     252              :      *
     253              :      * @return true if the Option is an Option_Edge, false otherwise
     254              :      */
     255              :     virtual bool isEdge() const;
     256              : 
     257              :     /** @brief Returns the information whether this option is a vector of edges
     258              :      *
     259              :      * Returns false. Only Option_EdgeVector overrides this method returning true.
     260              :      *
     261              :      * @return true if the Option is an Option_EdgeVector, false otherwise
     262              :      */
     263              :     virtual bool isEdgeVector() const;
     264              : 
     265              :     /** @brief Returns the information whether the option may be set a further time
     266              :      *
     267              :      * This method returns whether the option was not already set using command line
     268              :      *  options / configuration. This is done by returning the value of myAmWritable.
     269              :      *
     270              :      * @return Whether the option may be set from the command line / configuration
     271              :      */
     272              :     bool isWriteable() const;
     273              : 
     274              :     /** @brief Resets the option to be writeable
     275              :      *
     276              :      * An option is writable after initialisation, but as soon as it gets set,
     277              :      *  it is no longer writeable. This method resets the writable-flag.
     278              :      */
     279              :     void resetWritable();
     280              : 
     281              :     /** @brief Resets the option to be on its default value
     282              :      *
     283              :      * An option is on its default after initialisation with a value, but as soon as it gets set,
     284              :      *  it is no longer. This method resets the default-flag.
     285              :      */
     286              :     void resetDefault();
     287              : 
     288              :     /** @brief Returns the description of what this option does
     289              :      *
     290              :      * The description stored in myDescription is returned.
     291              :      *
     292              :      * @return The description of this option's purpose
     293              :      */
     294              :     const std::string& getDescription() const;
     295              : 
     296              :     /** @brief Sets the description of what this option does
     297              :      *
     298              :      * The description stored in myDescription is returned.
     299              :      *
     300              :      * @return The description of this option's purpose
     301              :      */
     302              :     void setDescription(const std::string& desc);
     303              : 
     304              :     /// @brief check if option is required
     305              :     bool isRequired() const;
     306              : 
     307              :     /// @brief mark option as required
     308              :     void setRequired();
     309              : 
     310              :     /// @brief check if option is positional
     311              :     bool isPositional() const;
     312              : 
     313              :     /// @brief mark option as positional
     314              :     void setPositional();
     315              : 
     316              :     /// @brief retrieve list separator
     317              :     const std::string& getListSeparator() const;
     318              : 
     319              :     /// @brief set list separator
     320              :     void setListSeparator(const std::string& listSep);
     321              : 
     322              :     /// @brief Returns the subtopic to which this option belongs
     323              :     const std::string& getSubTopic() const;
     324              : 
     325              :     /// @brief Sets the subtopic to which this option belongs
     326              :     void setSubtopic(const std::string& subtopic);
     327              : 
     328              :     /** @brief Returns the mml-type name of this option
     329              :      *
     330              :      * The type name stored in myTypeName is returned.
     331              :      *
     332              :      * @return The man-readable type name
     333              :      */
     334              :     virtual const std::string& getTypeName() const;
     335              : 
     336              :     /** @brief Returns a copy of this option
     337              :      *
     338              :      * @return The option copy
     339              :      */
     340              :     virtual Option* clone() const = 0;
     341              : 
     342              : protected:
     343              :     /** @brief Marks the information as set
     344              :      *
     345              :      * Sets the "myAmSet" - information. Returns whether the option was writeable before.
     346              :      *
     347              :      * @return Whether the option was not set before.
     348              :      */
     349              :     bool markSet(const std::string& orig);
     350              : 
     351              :     /** @brief Constructor
     352              :      *
     353              :      * This constructor should be used by derived classes.
     354              :      * The boolean value indicates whether a default value was supplied or not.
     355              :      *
     356              :      * @param[in] set A default value was supplied
     357              :      */
     358              :     Option(bool set = false);
     359              : 
     360              :     /// @brief A type name for this option (has presets, but may be overwritten)
     361              :     std::string myTypeName;
     362              : 
     363              :     /// @brief The original set string
     364              :     std::string myValueString;
     365              : 
     366              : private:
     367              :     /// @brief information whether the value is set
     368              :     bool myAmSet;
     369              : 
     370              :     /// @brief information whether the value is the default value (is then set)
     371              :     bool myHaveTheDefaultValue = true;
     372              : 
     373              :     /// @brief information whether the value may be changed
     374              :     bool myAmWritable = true;
     375              : 
     376              :     /// @brief The description what this option does
     377              :     std::string myDescription;
     378              : 
     379              :     /// @brief this option is required (needed for python tools)
     380              :     bool myRequired = false;
     381              : 
     382              :     /// @brief this option is positional (needed for python tools)
     383              :     bool myPositional = false;
     384              : 
     385              :     /// @brief the list separator for this option (needed for python tools)
     386              :     std::string myListSeparator = "";
     387              : 
     388              :     /// @brief The subtopic to which this option belongs
     389              :     std::string mySubTopic;
     390              : };
     391              : 
     392              : // -------------------------------------------------------------------------
     393              : // Option_Integer
     394              : // -------------------------------------------------------------------------
     395              : 
     396         4920 : class Option_Integer : public Option {
     397              : 
     398              : public:
     399              :     /** @brief Constructor for an option with a default value
     400              :      *
     401              :      * Calls Option(true)
     402              :      *
     403              :      * @param[in] value This option's default value
     404              :      */
     405              :     Option_Integer(int value);
     406              : 
     407              :     /** @brief Returns the stored integer value
     408              :      * @see Option::getInt()
     409              :      * @return Returns the stored integer number
     410              :      */
     411              :     int getInt() const;
     412              : 
     413              :     /** @brief Stores the given value after parsing it into an integer
     414              :      *
     415              :      *  The value is converted into an integer and stored in "myValue".
     416              :      *  Then, "markSet" is called in order to know that a value has been set.
     417              :      *
     418              :      * The method returns whether the value could be set (the return value from
     419              :      *  "markSet").
     420              :      *
     421              :      * If the string could not be converted into an integer, an InvalidArgument
     422              :      *  is thrown.
     423              :      *
     424              :      * @see bool Option::set(std::string v)
     425              :      * @return Whether the new value could be set
     426              :      * @exception InvalidArgument If the value could not be converted into an integer
     427              :      */
     428              :     bool set(const std::string& v, const std::string& orig, const bool append);
     429              : 
     430              :     /** @brief Returns the information whether the option is a int option
     431              :     *
     432              :     * Returns false. Only Option_Integer overrides this method returning true.
     433              :     *
     434              :     * @return true if the Option is an Option_Integer, false otherwise
     435              :     */
     436              :     bool isInteger() const;
     437              : 
     438         9840 :     CLONEABLE(Option_Integer)
     439              : 
     440              : private:
     441              :     /// @brief the value, valid only when the base-classes "myAmSet"-member is true
     442              :     int myValue;
     443              : };
     444              : 
     445              : // -------------------------------------------------------------------------
     446              : // Option_String
     447              : // -------------------------------------------------------------------------
     448              : 
     449              : class Option_String : public Option {
     450              : 
     451              : public:
     452              :     /** @brief Constructor for an option with no default value
     453              :      *
     454              :      * Calls Option(false)
     455              :      */
     456              :     Option_String();
     457              : 
     458              :     /** @brief Constructor for an option with a default value
     459              :      *
     460              :      * Calls Option(true)
     461              :      *
     462              :      * @param[in] value This option's default value
     463              :      */
     464              :     Option_String(const std::string& value, std::string typeName = "STR");
     465              : 
     466              :     /** @brief Returns the stored string value
     467              :      * @see std::string Option::getString()
     468              :      * @return Returns the stored string
     469              :      */
     470              :     std::string getString() const;
     471              : 
     472              :     /** @brief Stores the given value
     473              :      *
     474              :      *  The value is stored in "myValue".
     475              :      *  Then, "markSet" is called in order to know that a value has been set.
     476              :      *
     477              :      * The method returns whether the value could be set (the return value from
     478              :      *  "markSet").
     479              :      *
     480              :      * @see bool Option::set(std::string v)
     481              :      * @return Whether the new value could be set
     482              :      */
     483              :     bool set(const std::string& v, const std::string& orig, const bool append);
     484              : 
     485         3936 :     CLONEABLE(Option_String)
     486              : 
     487              : protected:
     488              :     /// @brief the value, valid only when the base-classes "myAmSet"-member is true
     489              :     std::string myValue;
     490              : };
     491              : 
     492              : // -------------------------------------------------------------------------
     493              : // Option_Float
     494              : // -------------------------------------------------------------------------
     495              : 
     496        13612 : class Option_Float : public Option {
     497              : 
     498              : public:
     499              :     /** @brief Constructor for an option with a default value
     500              :      *
     501              :      * Calls Option(true)
     502              :      *
     503              :      * @param[in] value This option's default value
     504              :      */
     505              :     Option_Float(double value);
     506              : 
     507              :     /** @brief Returns the stored double value
     508              :      * @see double Option::getFloat()
     509              :      * @return Returns the stored real number
     510              :      */
     511              :     double getFloat() const;
     512              : 
     513              :     /** @brief Stores the given value after parsing it into a double
     514              :      *
     515              :      *  The value is converted into a double and stored in "myValue".
     516              :      *  Then, "markSet" is called in order to know that a value has been set.
     517              :      *
     518              :      * The method returns whether the value could be set (the return value from
     519              :      *  "markSet").
     520              :      *
     521              :      * If the string could not be converted into a double, an InvalidArgument
     522              :      *  is thrown.
     523              :      *
     524              :      * @see bool Option::set(std::string v)
     525              :      * @return Whether the new value could be set
     526              :      * @exception InvalidArgument If the value could not be converted into a double
     527              :      */
     528              :     bool set(const std::string& v, const std::string& orig, const bool append);
     529              : 
     530              :     /** @brief Returns the information whether the option is a float option
     531              :     *
     532              :     * Returns false. Only Option_Float overrides this method returning true.
     533              :     *
     534              :     * @return true if the Option is an Option_Float, false otherwise
     535              :     */
     536              :     bool isFloat() const;
     537              : 
     538        27224 :     CLONEABLE(Option_Float)
     539              : 
     540              : private:
     541              :     /// @brief the value, valid only when the base-classes "myAmSet"-member is true
     542              :     double myValue;
     543              : };
     544              : 
     545              : // -------------------------------------------------------------------------
     546              : // Option_Bool
     547              : // -------------------------------------------------------------------------
     548              : 
     549        22632 : class Option_Bool : public Option {
     550              : 
     551              : public:
     552              :     /** @brief Constructor for an option with a default value
     553              :      *
     554              :      * Calls Option(true)
     555              :      *
     556              :      * @param[in] value This option's default value
     557              :      */
     558              :     Option_Bool(bool value);
     559              : 
     560              :     /** @brief Returns the stored boolean value
     561              :      * @see bool Option::getBool()
     562              :      * @return Returns the stored boolean
     563              :      */
     564              :     bool getBool() const;
     565              : 
     566              :     /// @brief sets the given value (converts it to bool)
     567              :     bool set(const std::string& v, const std::string& orig, const bool append);
     568              : 
     569              :     /** @brief Returns true, the information whether the option is a bool option
     570              :      *
     571              :      * Returns true.
     572              :      *
     573              :      * @see bool Option::isBool()
     574              :      * @return true
     575              :      */
     576              :     bool isBool() const;
     577              : 
     578        44936 :     CLONEABLE(Option_Bool)
     579              : 
     580              : protected:
     581              :     /// @brief the value, valid only when the base-classes "myAmSet"-member is true
     582              :     bool myValue;
     583              : };
     584              : 
     585              : // -------------------------------------------------------------------------
     586              : // Option_BoolExtended
     587              : // -------------------------------------------------------------------------
     588              : 
     589          164 : class Option_BoolExtended : public Option_Bool {
     590              : 
     591              : public:
     592              :     /** @brief Constructor for an option that can be used without an argument
     593              :      * like Option_BoolExtended but which also handles value strings
     594              :      *
     595              :      * Calls Option(true)
     596              :      *
     597              :      * @param[in] value This option's default value
     598              :      */
     599              :     Option_BoolExtended(bool value);
     600              : 
     601              :     /// @brief sets the given value (converts it to bool)
     602              :     bool set(const std::string& v, const std::string& orig, const bool append);
     603              : 
     604          328 :     CLONEABLE(Option_BoolExtended)
     605              : };
     606              : 
     607              : // -------------------------------------------------------------------------
     608              : // Option_IntVector
     609              : // -------------------------------------------------------------------------
     610              : 
     611              : class Option_IntVector : public Option {
     612              : 
     613              : public:
     614              :     /// @brief Constructor for an option with no default value
     615              :     Option_IntVector();
     616              : 
     617              :     /** @brief Constructor for an option with a default value
     618              :      *
     619              :      * @param[in] value This option's default value
     620              :      */
     621              :     Option_IntVector(const IntVector& value);
     622              : 
     623              :     /** @brief Returns the stored integer vector
     624              :      * @see const IntVector &Option::getIntVector()
     625              :      * @return Returns the stored integer vector
     626              :      */
     627              :     const IntVector& getIntVector() const;
     628              : 
     629              :     /** @brief Stores the given value after parsing it into a vector of integers
     630              :      *
     631              :      *  The value is converted into a vector of integers and stored in "myValue".
     632              :      *  Then, "markSet" is called in order to know that a value has been set.
     633              :      *
     634              :      * The method returns whether the value could be set (the return value from
     635              :      *  "markSet").
     636              :      *
     637              :      * If the string could not be converted into a vector of integers, an InvalidArgument
     638              :      *  is thrown.
     639              :      *
     640              :      * @see bool Option::set(std::string v)
     641              :      * @return Whether the new value could be set
     642              :      * @exception InvalidArgument If the value could not be converted into a vector of integers
     643              :      */
     644              :     bool set(const std::string& v, const std::string& orig, const bool append);
     645              : 
     646            0 :     CLONEABLE(Option_IntVector)
     647              : 
     648              : private:
     649              :     /// @brief the value, valid only when the base-classes "myAmSet"-member is true
     650              :     IntVector myValue;
     651              : };
     652              : 
     653              : // -------------------------------------------------------------------------
     654              : // Option_StringVector
     655              : // -------------------------------------------------------------------------
     656              : 
     657            0 : class Option_StringVector : public Option {
     658              : 
     659              : public:
     660              :     /// @brief Constructor for an option with no default value
     661              :     Option_StringVector();
     662              : 
     663              :     /** @brief Constructor for an option with a default value
     664              :      *
     665              :      * @param[in] value This option's default value
     666              :      */
     667              :     Option_StringVector(const StringVector& value);
     668              : 
     669              :     /** @brief Returns the stored string vector
     670              :      * @see const StringVector &Option::getStringVector()
     671              :      * @return Returns the stored string vector
     672              :      */
     673              :     const StringVector& getStringVector() const;
     674              : 
     675              :     /** @brief Stores the given value after parsing it into a vector of strings
     676              :      *
     677              :      *  The value is converted into a vector of strings and stored in "myValue".
     678              :      *  Then, "markSet" is called in order to know that a value has been set.
     679              :      *
     680              :      * The method returns whether the value could be set (the return value from
     681              :      *  "markSet").
     682              :      *
     683              :      * If the string could not be converted into a vector of strings, an
     684              :      * InvalidArgument is thrown.
     685              :      *
     686              :      * @see bool Option::set(std::string v)
     687              :      * @return Whether the new value could be set
     688              :      * @exception InvalidArgument If the value could not be converted into a
     689              :      * vector of strings
     690              :      */
     691              :     bool set(const std::string& v, const std::string& orig, const bool append);
     692              : 
     693         4100 :     CLONEABLE(Option_StringVector)
     694              : 
     695              : private:
     696              :     /// @brief the value, valid only when the base-classes "myAmSet"-member is true
     697              :     StringVector myValue;
     698              : };
     699              : 
     700              : // -------------------------------------------------------------------------
     701              : // Option_FileName
     702              : // -------------------------------------------------------------------------
     703              : 
     704         7544 : class Option_FileName : public Option_StringVector {
     705              : 
     706              : public:
     707              :     /// @brief Constructor for an option with no default value
     708              :     Option_FileName();
     709              : 
     710              :     /** @brief Constructor for an option with a default value
     711              :      *
     712              :      * @param[in] value This option's default value
     713              :      */
     714              :     Option_FileName(const StringVector& value);
     715              : 
     716              :     /** @brief Returns true, the information whether this option is a file name
     717              :      *
     718              :      * Returns true.
     719              :      *
     720              :      * @return true
     721              :      */
     722              :     bool isFileName() const;
     723              : 
     724              :     /** @brief Legacy method that returns the stored filenames as a comma-separated string.
     725              :      *
     726              :      * @see std::string Option::getString()
     727              :      * @see std::string StringVector::getValueString()
     728              :      * @return Returns comma-separated string of the stored filenames
     729              :      * @deprecated Legacy method used when Option_FileName was still derived from Option_String;
     730              :      * not in line with code style of the Options sub-system.
     731              :      */
     732              :     std::string getString() const;
     733              : 
     734        15088 :     CLONEABLE(Option_FileName)
     735              : };
     736              : 
     737              : // -------------------------------------------------------------------------
     738              : // Option_Network
     739              : // -------------------------------------------------------------------------
     740              : 
     741            0 : class Option_Network : public Option_String {
     742              : 
     743              : public:
     744              :     /** @brief Constructor for an option with a default value
     745              :      *
     746              :      * @param[in] value This option's default value
     747              :      */
     748              :     Option_Network(const std::string& value);
     749              : 
     750              :     /** @brief Returns true, the information whether this option is a file name
     751              :      *
     752              :      * Returns true.
     753              :      *
     754              :      * @return true
     755              :      */
     756              :     bool isNetwork() const;
     757              : 
     758            0 :     CLONEABLE(Option_Network)
     759              : };
     760              : 
     761              : // -------------------------------------------------------------------------
     762              : // Option_Additional
     763              : // -------------------------------------------------------------------------
     764              : 
     765            0 : class Option_Additional : public Option_String {
     766              : 
     767              : public:
     768              :     /** @brief Constructor for an option with a default value
     769              :      *
     770              :      * @param[in] value This option's default value
     771              :      */
     772              :     Option_Additional(const std::string& value);
     773              : 
     774              :     /** @brief Returns true, the information whether this option is a file name
     775              :      *
     776              :      * Returns true.
     777              :      *
     778              :      * @return true
     779              :      */
     780              :     bool isAdditional() const;
     781              : 
     782            0 :     CLONEABLE(Option_Additional)
     783              : };
     784              : 
     785              : // -------------------------------------------------------------------------
     786              : // Option_Route
     787              : // -------------------------------------------------------------------------
     788              : 
     789            0 : class Option_Route : public Option_String {
     790              : 
     791              : public:
     792              :     /** @brief Constructor for an option with a default value
     793              :      *
     794              :      * @param[in] value This option's default value
     795              :      */
     796              :     Option_Route(const std::string& value);
     797              : 
     798              :     /** @brief Returns true, the information whether this option is a file name
     799              :      *
     800              :      * Returns true.
     801              :      *
     802              :      * @return true
     803              :      */
     804              :     bool isRoute() const;
     805              : 
     806            0 :     CLONEABLE(Option_Route)
     807              : };
     808              : 
     809              : // -------------------------------------------------------------------------
     810              : // Option_Data
     811              : // -------------------------------------------------------------------------
     812              : 
     813            0 : class Option_Data : public Option_String {
     814              : 
     815              : public:
     816              :     /** @brief Constructor for an option with a default value
     817              :      *
     818              :      * @param[in] value This option's default value
     819              :      */
     820              :     Option_Data(const std::string& value);
     821              : 
     822              :     /** @brief Returns true, the information whether this option is a data file
     823              :      *
     824              :      * Returns true.
     825              :      *
     826              :      * @return true
     827              :      */
     828              :     bool isData() const;
     829              : 
     830            0 :     CLONEABLE(Option_Data)
     831              : };
     832              : 
     833              : // -------------------------------------------------------------------------
     834              : // Option_SumoConfig
     835              : // -------------------------------------------------------------------------
     836              : 
     837            0 : class Option_SumoConfig : public Option_String {
     838              : 
     839              : public:
     840              :     /** @brief Constructor for an option with a default value
     841              :      *
     842              :      * @param[in] value This option's default value
     843              :      */
     844              :     Option_SumoConfig(const std::string& value);
     845              : 
     846              :     /** @brief Returns true, the information whether this option is a sumo config name
     847              :      *
     848              :      * Returns true.
     849              :      *
     850              :      * @return true
     851              :      */
     852              :     bool isSumoConfig() const;
     853              : 
     854            0 :     CLONEABLE(Option_SumoConfig)
     855              : };
     856              : 
     857              : // -------------------------------------------------------------------------
     858              : // Option_Edge
     859              : // -------------------------------------------------------------------------
     860              : 
     861            0 : class Option_Edge : public Option_String {
     862              : 
     863              : public:
     864              :     /** @brief Constructor for an option with a default value
     865              :      *
     866              :      * @param[in] value This option's default value
     867              :      */
     868              :     Option_Edge(const std::string& value);
     869              : 
     870              :     /** @brief Returns true, the information whether this option is a list of edges
     871              :      *
     872              :      * Returns true.
     873              :      *
     874              :      * @return true
     875              :      */
     876              :     bool isEdge() const;
     877              : 
     878            0 :     CLONEABLE(Option_Edge)
     879              : };
     880              : 
     881              : // -------------------------------------------------------------------------
     882              : // Option_EdgeVector
     883              : // -------------------------------------------------------------------------
     884              : 
     885            0 : class Option_EdgeVector : public Option_String {
     886              : 
     887              : public:
     888              :     /** @brief Constructor for an option with a default value
     889              :      *
     890              :      * @param[in] value This option's default value
     891              :      */
     892              :     Option_EdgeVector(const std::string& value);
     893              : 
     894              :     /** @brief Returns true, the information whether this option is a list of edges
     895              :      *
     896              :      * Returns true.
     897              :      *
     898              :      * @return true
     899              :      */
     900              :     bool isEdgeVector() const;
     901              : 
     902            0 :     CLONEABLE(Option_EdgeVector)
     903              : };
        

Generated by: LCOV version 2.0-1