UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Parameter Class Referenceabstract

#include <textfile_parser.hpp>

Inheritance diagram for Parameter:
CharString_Parameter Double_Parameter Int_Parameter CharUndelimString_Parameter UnsignedDouble_Parameter UnsignedInt_Parameter

Public Member Functions

virtual void set_value (const char *)=0 throw (param_exception)
 
const std::string & get_name () const
 
bool is_inited () const
 
bool is_unique () const
 

Protected Member Functions

 Parameter (const char *name, bool unique=true)
 

Protected Attributes

bool is_init
 
bool is_uniq
 
const TextFileParserparser
 

Friends

class TextFileParser
 

Detailed Description

Abstract class for TextFileParser. This class represents parameter with it's value in text file. Parameter with it's value represented as pair of first word (token) and all remaining string before character '#' on current line. This first word is a parameter's name and other string is a parameters' value. For example:

velocity    34    # This is velocity of the vehicle.

In this example velocity is a parameter's name and 34 is a parameter's value. Part of string after '#' character is ignored. Functions of Parameter class is in keeping parameter's name and parsing parameter's value from given charstring (see set_value() method). You can't create instances of this class directly. You should create your own subclasses for specific parameters or use ready subclasses for primitive types (See Int_Parameter class for example).

Constructor & Destructor Documentation

Parameter::Parameter ( const char *  name,
bool  unique = true 
)
protected

Constructor of this class is protected.

Parameters
nameParameter's name
uniqueGive false here, if multiple parameters with this name are accepted.

Member Function Documentation

const std::string& Parameter::get_name ( ) const
inline

Returns parameter's name.

bool Parameter::is_inited ( ) const
inline

Returns true, if parameter was already read during current parse operation. Inner flag sets to true automatically by TextFileParser.

bool Parameter::is_unique ( ) const
inline

Returns true if parameter with such name must be unique in text file. (This feature of parameter specifies in constructor)

virtual void Parameter::set_value ( const char *  )
throw (param_exception
)
pure virtual

Method for parsing value from given char string. (See example in Int_Parameter class)

Implemented in CharUndelimString_Parameter, CharString_Parameter, UnsignedDouble_Parameter, Double_Parameter, UnsignedInt_Parameter, and Int_Parameter.


The documentation for this class was generated from the following file: