|  | The Gaudi Framework
    v36r1 (3e2fb5a8)
    | 
Interface for a component that manages application configuration options. More...
#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/Interfaces/IOptionsSvc.h>


| Public Types | |
| using | OnlyDefaults = Gaudi::tagged_bool< class OnlyDefaults_tag > | 
|  Public Types inherited from IInterface | |
| enum | Status : StatusCode::code_t { Status::FAILURE = 0, Status::SUCCESS = 1, Status::NO_INTERFACE, Status::VERSMISMATCH, Status::LAST_ERROR } | 
| Return status.  More... | |
| using | iid = Gaudi::InterfaceId< IInterface, 0, 0 > | 
| Interface ID.  More... | |
| using | ext_iids = Gaudi::interface_list< iid > | 
| Extra interfaces.  More... | |
| Public Member Functions | |
| DeclareInterfaceID (IOptionsSvc, 1, 0) | |
| InterfaceID declaration.  More... | |
| virtual void | set (const std::string &key, const std::string &value)=0 | 
| Set the value of an option, overriding the old value, if any.  More... | |
| virtual std::string | get (const std::string &key, const std::string &default_={}) const =0 | 
| Get the value of an options, returning the specified default value if not found.  More... | |
| virtual std::string | pop (const std::string &key, const std::string &default_={})=0 | 
| Get the value of an options, removing it from the storage, returning the specified default value if not found.  More... | |
| virtual bool | has (const std::string &key) const =0 | 
| Test if an option key is available in the catalog.  More... | |
| virtual bool | isSet (const std::string &key) const =0 | 
| Test if an option key was explicitly set or not.  More... | |
| virtual void | bind (const std::string &prefix, Gaudi::Details::PropertyBase *property)=0 | 
| Register a Gaudi::Property instance to the option service.  More... | |
| virtual void | broadcast (const std::regex &filter, const std::string &value, OnlyDefaults defaults=OnlyDefaults{true})=0 | 
| Broadcast version of IOptionsSvc::set.  More... | |
| virtual StatusCode | readOptions (std::string_view file, std::string_view path="")=0 | 
| look for file 'file' into search path 'path' and read it to update the options  More... | |
| Methods to query options. | |
| These methods allow to extract the list of know options with their values. | |
| virtual std::vector< std::tuple< std::string, std::string > > | items () const =0 | 
| Return all known options with their values.  More... | |
| template<class UnaryPredicate > | |
| std::vector< std::tuple< std::string, std::string > > | items (UnaryPredicate predicate) const | 
| Return all known options with their values for which predicateevaluates to true.  More... | |
| std::vector< std::tuple< std::string, std::string > > | items (const std::regex &filter) const | 
| Return all known options with their values for which the key matches the given regular expression.  More... | |
|  Public Member Functions inherited from IInterface | |
| virtual void * | i_cast (const InterfaceID &) const =0 | 
| main cast function  More... | |
| virtual std::vector< std::string > | getInterfaceNames () const =0 | 
| Returns a vector of strings containing the names of all the implemented interfaces.  More... | |
| virtual unsigned long | addRef ()=0 | 
| Increment the reference count of Interface instance.  More... | |
| virtual unsigned long | release ()=0 | 
| Release Interface instance.  More... | |
| virtual unsigned long | refCount () const =0 | 
| Current reference count.  More... | |
| virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)=0 | 
| Set the void** to the pointer to the requested interface of the instance.  More... | |
| virtual | ~IInterface ()=default | 
| Virtual destructor.  More... | |
| Protected Member Functions | |
| virtual | ~IOptionsSvc ()=default | 
| Additional Inherited Members | |
|  Static Public Member Functions inherited from IInterface | |
| static const InterfaceID & | interfaceID () | 
| Return an instance of InterfaceID identifying the interface.  More... | |
Interface for a component that manages application configuration options.
Options are to be recorded as pairs of strings: option id and value. The value must be the string representation of the a value, as understood by Gaudi::Property<T>::fromString().
For example, if an Algorithm defines two properties as in
The IOptionsSvc instance should be populated with something like
Definition at line 46 of file IOptionsSvc.h.
| using Gaudi::Interfaces::IOptionsSvc::OnlyDefaults = Gaudi::tagged_bool<class OnlyDefaults_tag> | 
Definition at line 94 of file IOptionsSvc.h.
| 
 | protectedvirtualdefault | 
| 
 | pure virtual | 
Register a Gaudi::Property instance to the option service.
The option will be bound to the property with name <prefix>.<property-name>, and immediately assigned the value set in the options service, if any.
After the binding, setting a property value via IOptionsSvc::set will automatically set the value of the Gaudi::Property instance, and IOptionsSvc::get will return the string representation of the value of the Gaudi::Property instance.
| 
 | pure virtual | 
Broadcast version of IOptionsSvc::set.
With IOptionsSvc::broadcast it is possible to assign one value to all known properties matching a regular expression. By default, only default values are overridden, but explicitly assigned values can also be overridden passing OnlyDefaults{false} as third argument to the method. 
| Gaudi::Interfaces::IOptionsSvc::DeclareInterfaceID | ( | IOptionsSvc | , | 
| 1 | , | ||
| 0 | |||
| ) | 
InterfaceID declaration.
| 
 | pure virtual | 
Get the value of an options, returning the specified default value if not found.
| 
 | pure virtual | 
Test if an option key is available in the catalog.
| 
 | pure virtual | 
Test if an option key was explicitly set or not.
| 
 | pure virtual | 
Return all known options with their values.
| 
 | inline | 
Return all known options with their values for which the key matches the given regular expression.
Definition at line 77 of file IOptionsSvc.h.
| 
 | inline | 
Return all known options with their values for which predicate evaluates to true. 
Definition at line 69 of file IOptionsSvc.h.
| 
 | pure virtual | 
Get the value of an options, removing it from the storage, returning the specified default value if not found.
| 
 | pure virtual | 
look for file 'file' into search path 'path' and read it to update the options
| 
 | pure virtual | 
Set the value of an option, overriding the old value, if any.