Skip to content
Snippets Groups Projects
Commit a3d944f5 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Add Doxygen comments.

parent ac7f0b6d
No related branches found
No related tags found
No related merge requests found
......@@ -33,9 +33,12 @@ private:
mutable std::map<std::string, std::unique_ptr<Gaudi::Details::PropertyBase>> m_old_iface_compat;
mutable std::map<std::string, PropertiesT> m_old_iface_compat_2;
/// Find an option key in the options storage using case insensitive comparison.
/// If the found key does not match the case of the requested one, a warning is printed.
StorageType::const_iterator find( const std::string& key, bool warn ) const;
protected:
/// @{
void set( const std::string& key, const std::string& value ) override { m_options[key] = value; }
std::string get( const std::string& key, const std::string& default_ = {} ) const override
{
......@@ -61,7 +64,7 @@ protected:
std::for_each( begin( m_options ), end( m_options ), [&v]( const auto& item ) { v.emplace_back( item ); } );
return v;
}
/// @}
public:
// Constructor
JobOptionsSvc( const std::string& name, ISvcLocator* svc );
......
......@@ -8,12 +8,39 @@ namespace Gaudi
{
namespace Interfaces
{
/** 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
\code
class MyAlg: public Algorithm {
Gaudi::Property<std::string> m_hname{this, "HistoName", "none"};
Gaudi::Property<float> m_threshold{this, "Threshold", 1.0};
};
\endcode
The OptionsSvc instance should be populated with something like
\code
auto& optsSvc = sericeLocator()->getOptsSvc();
optsSvc.set("AlgInstanceName.HistoName", "'my_histogram'");
optsSvc.set("AlgInstanceName.Threshold", "2.345");
\endcode
*/
struct OptionsSvc {
/// Set the value of an option, overriding the old value, if any.
virtual void set( const std::string& key, const std::string& value ) = 0;
/// Get the value of an options, returning the specified _default_ value if not found.
virtual std::string get( const std::string& key, const std::string& default_ = {} ) const = 0;
/// Get the value of an options, removing it from the storage, returning the specified _default_ value if not
/// found.
virtual std::string pop( const std::string& key, const std::string& default_ = {} ) = 0;
/// Test if an option key is availble in the catalog.
virtual bool has( const std::string& key ) const = 0;
/// Return all known options with their values.
virtual std::vector<std::tuple<std::string, std::string>> items() const = 0;
protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment