Flow123d  jenkins-Flow123d-linux-release-multijob-282
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Input::Type::Default Class Reference

Class Input::Type::Default specifies default value of keys of a Input::Type::Record. More...

#include <type_record.hh>

Collaboration diagram for Input::Type::Default:
Collaboration graph
[legend]

Public Member Functions

 Default (const std::string &value)
 
std::size_t content_hash () const
 
bool has_value_at_read_time () const
 
bool has_value_at_declaration () const
 
bool is_obligatory () const
 
bool is_optional () const
 
const string & value () const
 
bool has_same_type (const Default &other) const
 

Static Public Member Functions

static Default read_time (const std::string &description)
 
static Default obligatory ()
 
static Default optional ()
 

Private Types

enum  DefaultType { default_at_declaration, default_at_read_time, no_default_optional_type, no_default_obligatory_type }
 

Private Member Functions

 Default ()
 
 Default (enum DefaultType type, const std::string &value)
 

Private Attributes

string value_
 Stored value. More...
 
enum DefaultType type_
 Type of the Default. More...
 

Friends

class OutputBase
 
class OutputJSONTemplate
 

Detailed Description

Class Input::Type::Default specifies default value of keys of a Input::Type::Record.


It contains type of default value and possibly the value itself stored as std::string. Currently we distinguish four cases:

Definition at line 39 of file type_record.hh.

Member Enumeration Documentation

Possible types of default values.

Enumerator
default_at_declaration 

Default value given at declaration time.

default_at_read_time 

Some default value will be given when the key is read. The description of this value should be provided.

no_default_optional_type 

No default value, optional key. This is default type of the Default.

no_default_obligatory_type 

No default value, obligatory key.

Definition at line 47 of file type_record.hh.

Constructor & Destructor Documentation

Input::Type::Default::Default ( const std::string &  value)

Constructor with given default value (at declaration time)

Definition at line 41 of file type_record.cc.

Input::Type::Default::Default ( )
private

Forbids default constructor.

Definition at line 37 of file type_record.cc.

Here is the caller graph for this function:

Input::Type::Default::Default ( enum DefaultType  type,
const std::string &  value 
)
private

Constructor for other types then 'declaration'.

Definition at line 49 of file type_record.cc.

Member Function Documentation

std::size_t Input::Type::Default::content_hash ( ) const

Definition at line 53 of file type_record.cc.

Here is the caller graph for this function:

bool Input::Type::Default::has_same_type ( const Default other) const
inline

Compares values type_ of two Default objects.

Definition at line 139 of file type_record.hh.

bool Input::Type::Default::has_value_at_declaration ( ) const
inline

Returns true if the default value is or will be available when someone tries to read the value.

Definition at line 114 of file type_record.hh.

Here is the caller graph for this function:

bool Input::Type::Default::has_value_at_read_time ( ) const
inline

Returns true if the default value is or will be available when someone tries to read the value.

Definition at line 108 of file type_record.hh.

bool Input::Type::Default::is_obligatory ( ) const
inline

Returns true if the key is obligatory and thus must be specified on input. No default value is given.

Definition at line 121 of file type_record.hh.

Here is the caller graph for this function:

bool Input::Type::Default::is_optional ( ) const
inline

Returns true if the key is optional.

Definition at line 127 of file type_record.hh.

Here is the caller graph for this function:

static Default Input::Type::Default::obligatory ( )
inlinestatic

Factory function to make an empty default value which is obligatory. This and following factory functions should be used instead of private constructors.

Example of usage:

* some_record.declare_key("some_key",Integer(),Default::obligatory(),"description");
*

Definition at line 89 of file type_record.hh.

Here is the caller graph for this function:

static Default Input::Type::Default::optional ( )
inlinestatic

Factory function to make an empty default value which is optional. To get the value of such key from the input you have to use non-throwing variant of the method Input::Record::key, which returns the value through reference and allows checking presence of the key on the input.

Example of usage:

* some_record.declare_key("some_key",Integer(),Default::optional(),"description");
*

Definition at line 102 of file type_record.hh.

Here is the caller graph for this function:

static Default Input::Type::Default::read_time ( const std::string &  description)
inlinestatic

Factory function to make an default value that will be specified at the time when a key will be read. You have to provide a string with description of the default value used at the read time., e.g. the key time_governer of an equation can specify default value as

* Default::read_time("By default the global time governor is used.")
*

To get the value of such key from the input you have to use non-throwing variant of the method Input::Record::key, which returns the value through reference and allows checking presence of the key on the input.

Example of usage:

* some_record.declare_key("time_governor",TimeGovernor(),Default::optional(),"description");
*

Definition at line 77 of file type_record.hh.

Here is the caller graph for this function:

const string& Input::Type::Default::value ( ) const
inline

Returns stored value. Possibly empty string.

Definition at line 133 of file type_record.hh.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class OutputBase
friend

Definition at line 40 of file type_record.hh.

friend class OutputJSONTemplate
friend

Definition at line 41 of file type_record.hh.

Member Data Documentation

enum DefaultType Input::Type::Default::type_
private

Type of the Default.

Definition at line 144 of file type_record.hh.

string Input::Type::Default::value_
private

Stored value.

Definition at line 143 of file type_record.hh.


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