dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
dlinear::OptionValue< T > Class Template Reference

Represents an optional value in dLinear. More...

#include <OptionValue.hpp>

Public Types

enum class  Type { DEFAULT , FROM_FILE , FROM_COMMAND_LINE , FROM_CODE }
 Type of the value. More...
 

Public Member Functions

 OptionValue (T value)
 Constructs an option value with value.
 
 OptionValue (const OptionValue &)=default
 Default copy constructor.
 
 OptionValue (OptionValue &&) noexcept=default
 Default move constructor.
 
OptionValueoperator= (const OptionValue &)=default
 Default copy assign operator.
 
OptionValueoperator= (OptionValue &&) noexcept=default
 Default move assign operator.
 
 ~OptionValue ()=default
 Default destructor.
 
OptionValueoperator= (const T &value)
 Copy-assign operator for T.
 
OptionValueoperator= (T &&value)
 Move-assign operator for T.
 
const T & get () const
 Get read-only access to the internal stored value of the optional value.
 
void SetFromCommandLine (const T &value)
 Sets the value to value which is given by a command-line argument.
 
void SetFromFile (const T &value)
 Sets the value to value which is provided from a file.
 

Private Attributes

value_
 Value the class holds.
 
Type type_
 Type of the value.
 

Detailed Description

template<typename T>
class dlinear::OptionValue< T >

Represents an optional value in dLinear.

There are four ways that an option can have its value – by default, by a command-line argument, by a set-info/set-option command from a .smt2 file, and a manual update in a code. We define an order in these types and make sure that an update is executed only if it is requested by the same type or a higher type. For example, a value set by command-line cannot be changed by an updated requested from a file.

Template Parameters
TType of the value the class will hold.

Definition at line 35 of file OptionValue.hpp.

Member Enumeration Documentation

◆ Type

template<typename T >
enum class dlinear::OptionValue::Type
strong

Type of the value.

Each type encodes a priority, and an update is executed only if it is requested by the same type or a higher type.

Enumerator
DEFAULT 

Default value.

FROM_FILE 

Updated by a set-option/set-info in a file.

FROM_COMMAND_LINE 

Updated by a command-line argument.

FROM_CODE 

Explicitly updated from code.

Definition at line 42 of file OptionValue.hpp.

Constructor & Destructor Documentation

◆ OptionValue()

template<typename T >
dlinear::OptionValue< T >::OptionValue ( T value)
inlineexplicit

Constructs an option value with value.

Parameters
valuevalue to be held.

Definition at line 53 of file OptionValue.hpp.

Member Function Documentation

◆ get()

template<typename T >
const T & dlinear::OptionValue< T >::get ( ) const
inline

Get read-only access to the internal stored value of the optional value.

Returns
internal stored value of the optional value

Definition at line 91 of file OptionValue.hpp.

◆ operator=() [1/2]

template<typename T >
OptionValue & dlinear::OptionValue< T >::operator= ( const T & value)
inline

Copy-assign operator for T.

Note
It sets value with Type::FROM_CODE type.

Definition at line 74 of file OptionValue.hpp.

◆ operator=() [2/2]

template<typename T >
OptionValue & dlinear::OptionValue< T >::operator= ( T && value)
inline

Move-assign operator for T.

Note
It sets value with Type::FROM_CODE type.

Definition at line 84 of file OptionValue.hpp.

◆ SetFromCommandLine()

template<typename T >
void dlinear::OptionValue< T >::SetFromCommandLine ( const T & value)
inline

Sets the value to value which is given by a command-line argument.

It sets the type to Type::FROM_COMMAND_LINE. It does nothing if the current type is Type::FROM_CODE.

Parameters
valuenew value, given by a command-line argument.

Definition at line 101 of file OptionValue.hpp.

◆ SetFromFile()

template<typename T >
void dlinear::OptionValue< T >::SetFromFile ( const T & value)
inline

Sets the value to value which is provided from a file.

It sets the type to Type::FROM_FILE. It does nothing if the current type is Type::FROM_COMMAND_LINE or Type::FROM_CODE.

Parameters
valuenew value, provided from a file.

Definition at line 114 of file OptionValue.hpp.


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