51 virtual void set(
const std::string& key,
const std::string& value ) = 0;
53 virtual std::string
get(
const std::string& key,
const std::string& default_ = {} )
const = 0;
56 virtual std::string
pop(
const std::string& key,
const std::string& default_ = {} ) = 0;
58 virtual bool has(
const std::string& key )
const = 0;
60 virtual bool isSet(
const std::string& key )
const = 0;
66 virtual std::vector<std::tuple<std::string, std::string>>
items()
const = 0;
68 template <
class UnaryPredicate>
69 std::vector<std::tuple<std::string, std::string>>
items( UnaryPredicate predicate )
const {
70 auto v = this->
items();
71 v.erase( std::remove_if( begin( v ), end( v ),
72 [&predicate](
const auto& element ) {
return !predicate( element ); } ),
77 std::vector<std::tuple<std::string, std::string>>
items(
const std::regex& filter )
const {
80 [&filter, &match](
const auto& element ) {
return regex_match( std::get<0>( element ), match, filter ); } );
101 virtual void broadcast(
const std::regex& filter,
const std::string& value,
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition of the basic interface.
This class is used for returning status codes from appropriate routines.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Interface for a component that manages application configuration options.
virtual std::vector< std::tuple< std::string, std::string > > items() const =0
Return all known options with their values.
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.
DeclareInterfaceID(IOptionsSvc, 1, 0)
InterfaceID declaration.
virtual bool isSet(const std::string &key) const =0
Test if an option key was explicitly set or not.
virtual void bind(const std::string &prefix, Gaudi::Details::PropertyBase *property)=0
Register a Gaudi::Property instance to the option service.
virtual void set(const std::string &key, const std::string &value)=0
Set the value of an option, overriding the old value, if any.
virtual bool has(const std::string &key) const =0
Test if an option key is available in the catalog.
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.
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 n...
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
virtual void broadcast(const std::regex &filter, const std::string &value, OnlyDefaults defaults=OnlyDefaults{ true })=0
Broadcast version of IOptionsSvc::set.
virtual ~IOptionsSvc()=default
std::vector< std::tuple< std::string, std::string > > items(UnaryPredicate predicate) const
Return all known options with their values for which predicate evaluates to true.
Gaudi::tagged_bool< class OnlyDefaults_tag > OnlyDefaults