20 #ifndef MIRTK_Configurable_H 21 #define MIRTK_Configurable_H 23 #include "mirtk/Observable.h" 25 #include "mirtk/Array.h" 43 mirtkPublicAttributeMacro(
string, Name);
46 mirtkPublicAttributeMacro(Array<string>, ParameterPrefix);
116 virtual bool Set(
const char *,
const char *);
128 if (name.empty() || !
HasPrefix())
return false;
137 if (prefix.empty())
return false;
138 if (prefix.back() ==
' ') prefix.back() =
'\0';
139 Insert(params, other, prefix.c_str());
146 #endif // MIRTK_Configurable_H string ParameterNameWithoutPrefix(const char *) const
Get name of parameter without object name prefix.
string DefaultPrefix() const
Get default object name prefix (if any)
Configurable & operator=(const Configurable &)
Assignment operator.
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
virtual ~Configurable()
Destructor.
virtual bool Set(const char *, const char *)
Set parameter value from string.
string ParameterNameWithPrefix(const string &) const
Get name of parameter with default object name prefix.
Configurable(const char *="")
Constructor.
bool InsertWithPrefix(ParameterList &, string, T) const
Insert parameter into name/value list with object name prefix.
bool HasPrefix() const
Whether this object has either an explicit name or default prefix.
string DefaultName() const
virtual bool SetWithPrefix(const char *, const char *)
Set parameter value from string.
ParameterList & Insert(ParameterList ¶ms, string name, T value)
Insert/replace value into/in parameters list.
virtual bool SetWithoutPrefix(const char *, const char *)
Set parameter value from string.
bool HasName() const
Whether this object has an explicit name.