69 bool EntryControl::set(
const Value& value) {
80 for (
auto& category : categories) {
81 auto entry = category.value.entries.tryGet(key);
83 entry.value()->set(value);
91 for (
auto& category : categories) {
92 auto entry = category.value.entries.
tryGet(key);
94 return entry.value()->get();
101 return categories.insert(name,
Category{});
105 for (
auto& category : categories) {
107 for (
auto& entry : category.value.entries) {
108 proc.
onEntry(entry.key, *entry.value);
115 for (
IoEnum id : EnumMap::getAll<IoEnum>()) {
120 formats.
push(format);
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
#define NAMESPACE_SPH_END
Array< IVirtualEntry::FileFormat > getInputFormats()
Convenience function, returning the list of input file formats defined by IoEnum.
Array< IVirtualEntry::FileFormat > getOutputFormats()
Convenience function, returning the list of output file formats defined by IoEnum.
Object providing connection between component parameters and values exposed to the user.
Generic dynamically allocated resizable storage.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
Helper object, allowing to add units, tooltips and additional properties into the entry created with ...
EntryControl & setEnabler(const Enabler &newEnabler)
Adds or replaces the enabler functor of the entry.
EntryControl & setPathType(const PathType &newType)
Sets the type of the path.
Array< FileFormat > fileFormats
virtual bool hasSideEffect() const override final
Returns true if the entry can modify multiple values simultaneously.
virtual Optional< PathType > getPathType() const override final
Returns the type of the path.
CallbackSet< Accessor > accessors
EntryControl & setValidator(const Validator &newValidator)
Adds or replaces the functor called to validate the new value.
Optional< PathType > pathType
EntryControl & setUnits(const Float newMult)
Sets units in which the entry is stored.
virtual Array< FileFormat > getFileFormats() const override final
Returns the allowed file format for this file entry.
EntryControl & setFileFormats(Array< FileFormat > &&formats)
Sets the allowed file formats.
EntryControl & setTooltip(const std::string &newTooltip)
Adds or replaces the previous tooltip associanted with the entry.
virtual bool enabled() const override final
Returns if this entry is currently enabled.
virtual bool isValid(const Value &value) const override final
Checks if the given value is a valid input for this entry.
virtual void setImpl(const Value &value)=0
EntryControl & addAccessor(const SharedToken &owner, const Accessor &accessor)
Adds a functor called when the entry changes, i.e. when set function is called.
virtual std::string getTooltip() const override final
Returns an optional description of the entry.
EntryControl & setSideEffect()
Specifies that the entry has a side effect, i.e. in changes values of other entries.
Thrown when components of the run are mutually incompatible.
Wrapper of type value of which may or may not be present.
INLINE Type & value()
Returns the reference to the stored value.
Variant, an implementation of type-safe union, similar to std::variant or boost::variant.
Optional< T > tryGet() const
Returns the stored value in the variant.
Interface allowing to enumerate all entries in the settings.
virtual void onEntry(const std::string &key, IVirtualEntry &entry) const =0
Called for every entry in the current category.
virtual void onCategory(const std::string &name) const =0
Called for every category in the settings.
void enumerate(const IEntryProc &proc)
Enumerates all entries stored in the settings.
IVirtualEntry::Value get(const std::string &key) const
Returns a value of an entry.
void set(const std::string &key, const IVirtualEntry::Value &value)
Modifies an existing entry in the settings.
Category & addCategory(const std::string &name)
Creates a new category of entries.
Optional< std::string > getIoExtension(const IoEnum type)
Returns the file extension associated with given IO type.
std::string getIoDescription(const IoEnum type)
Returns a short description of the file format.
Flags< IoCapability > getIoCapabilities(const IoEnum type)
Returns the capabilities of given file format.
@ OUTPUT
The format can be used as file output.
@ INPUT
The format can be used as file input.