11#include <framework/core/FrameworkExceptions.h>
12#include <framework/gearbox/Unit.h>
54 bool exists(
const std::string& path =
"")
const {
return getNumberNodes(path) > 0; }
60 operator bool()
const {
return exists(); }
67 std::vector<GearDir> getNodes(
const std::string& path =
"")
const;
70 std::string
getPath()
const {
return m_path; }
78 virtual std::string
getString(
const std::string& path =
"") const noexcept(false) = 0;
91 virtual
std::pair<
std::
string,
std::
string> getStringWithUnit(const
std::
string& path) const noexcept(false) = 0;
101 std::
string getString(const
std::
string& path, const
std::
string& defaultValue) const;
112 virtual const TObject* getTObject(const
std::
string& path) const noexcept(false) = 0;
121 double getDouble(const
std::
string& path = "") const noexcept(false);
132 double getDouble(const
std::
string& path,
double defaultValue) const noexcept(false);
141 int getInt(const
std::
string& path = "") const noexcept(false);
152 int getInt(const
std::
string& path,
int defaultValue) const noexcept(false);
160 bool getBool(const
std::
string& path = "") const noexcept(false);
170 bool getBool(const
std::
string& path,
bool defaultValue) const;
185 double getWithUnit(const
std::
string& path) const noexcept(false);
203 double getWithUnit(const
std::
string& path,
double defaultValue) const noexcept(false);
222 std::vector<
double> getArray(const
std::
string& path) const noexcept(false);
243 std::vector<
double> getArray(const
std::
string& path, const
std::vector<
double>& defaultValue) const noexcept(false);
259 double getLength(const
std::
string& path = "") const noexcept(false)
261 return getWithUnit(path);
281 double getLength(
const std::string& path,
double defaultValue)
const noexcept(
false)
283 return getWithUnit(path, defaultValue);
299 double getAngle(
const std::string& path =
"") const noexcept(false)
301 return getWithUnit(path);
321 double getAngle(
const std::string& path,
double defaultValue)
const noexcept(
false)
323 return getWithUnit(path, defaultValue);
339 double getEnergy(
const std::string& path =
"") const noexcept(false)
341 return getWithUnit(path);
361 double getEnergy(
const std::string& path,
double defaultValue)
const noexcept(
false)
363 return getWithUnit(path, defaultValue);
379 double getDensity(
const std::string& path =
"") const noexcept(false)
381 return getWithUnit(path);
401 double getDensity(
const std::string& path,
double defaultValue)
const noexcept(
false)
403 return getWithUnit(path, defaultValue);
419 double getTime(
const std::string& path =
"") const noexcept(false)
421 return getWithUnit(path);
441 double getTime(
const std::string& path,
double defaultValue)
const noexcept(
false)
443 return getWithUnit(path, defaultValue);
459 double getFrequency(
const std::string& path =
"") const noexcept(false)
461 return getWithUnit(path);
481 double getFrequency(
const std::string& path,
double defaultValue)
const noexcept(
false)
483 return getWithUnit(path, defaultValue);
489 std::string ensureNode(
const std::string& path)
const ;
491 std::string ensurePath(
const std::string& path)
const;
493 std::string addIndex(
const std::string& path,
int index)
const;
495 std::string joinPath(
const std::string& path,
const std::string& subpath)
const;
Exception to be thrown in case of an empty result.
double getDensity(const std::string &path, double defaultValue) const noexcept(false)
Get the parameter path as a double converted to the standard density unit.
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
double getTime(const std::string &path, double defaultValue) const noexcept(false)
Get the parameter path as a double converted to the standard time unit.
Interface()
default constructor initializing to toplevel parameter space
double getDensity(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard density unit.
virtual std::string getString(const std::string &path="") const noexcept(false)=0
Get the parameter path as a string.
double getFrequency(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard frequency unit.
double getTime(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard time unit.
double getLength(const std::string &path, double defaultValue) const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
double getEnergy(const std::string &path, double defaultValue) const noexcept(false)
Get the parameter path as a double converted to the standard energy unit.
std::string getPath() const
Return path of the current interface.
bool exists(const std::string &path="") const
Check if a given parameter path exists.
double getEnergy(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard energy unit.
std::string m_path
path of the current interface
virtual ~Interface()
empty, virtual destructor
virtual int getNumberNodes(const std::string &path="") const =0
Return the number of nodes a given path will expand to.
double getFrequency(const std::string &path, double defaultValue) const noexcept(false)
Get the parameter path as a double converted to the standard frequency unit.
double getAngle(const std::string &path, double defaultValue) const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
Macro that defines an exception with the given message template.
Abstract base class for different kinds of events.