SPH
|
Represents a virtual entry in the settings. More...
#include <VirtualSettings.h>
Classes | |
struct | FileFormat |
Public Types | |
enum class | Type { BOOL , INT , FLOAT , VECTOR , INTERVAL , STRING , PATH , ENUM , EXTRA , FLAGS } |
enum class | PathType { DIRECTORY , INPUT_FILE , OUTPUT_FILE } |
using | Value = Variant< bool, int, Float, Vector, Interval, std::string, Path, EnumWrapper, ExtraEntry > |
Public Member Functions | |
virtual bool | enabled () const =0 |
Returns if this entry is currently enabled. More... | |
virtual bool | set (const Value &value)=0 |
Modifies the current value of the entry. More... | |
virtual Value | get () const =0 |
Returns the currently stored value. More... | |
virtual bool | isValid (const Value &value) const =0 |
Checks if the given value is a valid input for this entry. More... | |
virtual Type | getType () const =0 |
Returns the type of this entry. More... | |
virtual std::string | getName () const =0 |
Returns a descriptive name of the entry. More... | |
virtual std::string | getTooltip () const |
Returns an optional description of the entry. More... | |
virtual bool | hasSideEffect () const |
Returns true if the entry can modify multiple values simultaneously. More... | |
virtual Optional< PathType > | getPathType () const |
Returns the type of the path. More... | |
virtual Array< FileFormat > | getFileFormats () const |
Returns the allowed file format for this file entry. More... | |
![]() | |
virtual | ~Polymorphic () |
Represents a virtual entry in the settings.
This entry may be connected to a single reference, an entry in Settings object or other user-defined value. It provides an abstraction through which state of jobs can be queried and modified.
Definition at line 64 of file VirtualSettings.h.
using IVirtualEntry::Value = Variant<bool, int, Float, Vector, Interval, std::string, Path, EnumWrapper, ExtraEntry> |
Definition at line 68 of file VirtualSettings.h.
|
strong |
Enumerator | |
---|---|
DIRECTORY | |
INPUT_FILE | |
OUTPUT_FILE |
Definition at line 113 of file VirtualSettings.h.
|
strong |
Enumerator | |
---|---|
BOOL | |
INT | |
FLOAT | |
VECTOR | |
INTERVAL | |
STRING | |
PATH | |
ENUM | |
EXTRA | |
FLAGS |
Definition at line 66 of file VirtualSettings.h.
|
pure virtual |
Returns if this entry is currently enabled.
Implementation may return false if the entry does not have any effect for current setup of the job, for example if the entry is associated with a parameter of a solver which is not being used.
Implemented in EntryControl, and IntervalEntry< TEnum >.
|
pure virtual |
Returns the currently stored value.
Implemented in Detail::SettingsEntry< Path, TEnum >, Detail::SettingsEntry< TValue, TEnum, std::enable_if_t< FlagsTraits< TValue >::isFlags > >, Detail::SettingsEntry< TValue, TEnum, TEnabler >, Detail::ValueEntry< TValue, std::enable_if_t< FlagsTraits< TValue >::isFlags > >, Detail::ValueEntry< TValue, typename >, and IntervalEntry< TEnum >.
|
inlinevirtual |
Returns the allowed file format for this file entry.
Used only for file entry (i.e. getPathType returns INPUT_FILE or OUTPUT_FILE). The returned array contains pairs of the file format description and the corresponding extension (i.e. 'txt').
Reimplemented in EntryControl.
Definition at line 135 of file VirtualSettings.h.
|
pure virtual |
Returns a descriptive name of the entry.
This name is intended to be presented to the user (in UI, printed in log, etc.). It may be the same as the key associated with an entry, although the key is only used as an unique identifier and does not have to be human-readable.
Implemented in Detail::SettingsEntry< Path, TEnum >, Detail::SettingsEntry< TValue, TEnum, std::enable_if_t< FlagsTraits< TValue >::isFlags > >, Detail::SettingsEntry< TValue, TEnum, TEnabler >, Detail::ValueEntry< TValue, std::enable_if_t< FlagsTraits< TValue >::isFlags > >, Detail::ValueEntry< TValue, typename >, and IntervalEntry< TEnum >.
Returns the type of the path.
Used only if type of the entry is PATH, otherwise returns NOTHING.
Reimplemented in EntryControl.
Definition at line 122 of file VirtualSettings.h.
|
inlinevirtual |
Returns an optional description of the entry.
Reimplemented in EntryControl.
Definition at line 100 of file VirtualSettings.h.
|
pure virtual |
Returns the type of this entry.
Implemented in Detail::SettingsEntry< Path, TEnum >, Detail::SettingsEntry< TValue, TEnum, std::enable_if_t< FlagsTraits< TValue >::isFlags > >, Detail::SettingsEntry< TValue, TEnum, TEnabler >, Detail::ValueEntry< TValue, std::enable_if_t< FlagsTraits< TValue >::isFlags > >, Detail::ValueEntry< TValue, typename >, and IntervalEntry< TEnum >.
|
inlinevirtual |
Returns true if the entry can modify multiple values simultaneously.
Usually, there is a 1-1 correspondence between entries and values (stored either in Settings or directly in the job). However, an entry can modify other values as well, in which case it should signal this by returning true from this function.
Reimplemented in EntryControl.
Definition at line 109 of file VirtualSettings.h.
|
pure virtual |
Checks if the given value is a valid input for this entry.
Implemented in EntryControl.
|
pure virtual |
Modifies the current value of the entry.
Function shall throw Exception (or derived type) if the type of the value differs from type of the entry.
Implemented in IntervalEntry< TEnum >.