LCOV - code coverage report
Current view: top level - src/utils/options - Option.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 1 0.0 %
Date: 2024-05-01 15:34:42 Functions: 0 0 -

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

Generated by: LCOV version 1.14