9#include "MantidGeometry/DllConfig.h"
21template <
class C,
class Base,
typename... Args>
class Instantiator;
43 const std::string &
type()
const {
return m_type; }
45 const std::string &
name()
const {
return m_name; }
49 const bool &
visible()
const {
return m_visible; }
55 virtual std::string
asString()
const {
return m_str_value; }
62 template <
class T>
const T &
value();
64 virtual void setDescription(
const std::string &source) { m_description.assign(source); }
68 virtual std::string getShortDescription()
const;
70 virtual void setVisible(
const bool &visible) { m_visible = visible; }
73 if (this->name() ==
rhs.name() && this->type() ==
rhs.type() && this->asString() ==
rhs.asString())
86 template <
class T>
void set(
const T &t);
90 Parameter() : m_type(
""), m_name(
""), m_str_value(
""), m_visible(true), m_description(
"") {}
111 std::string asString()
const override;
113 void fromString(
const std::string &
value)
override;
126 void setValue(
const Type &
value);
145 throw std::runtime_error(
"Wrong type of parameter.");
146 return p->ParameterType<T>::value();
156 throw std::runtime_error(
"Wrong type of parameter.");
157 p->ParameterType<T>::setValue(t);
170 std::istringstream istr(
value);
const std::string & m_value
const std::vector< double > & rhs
double value
The value of the point.
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
The ParameterFactory class creates parameters for the instrument ParameterMap.
Templated class for parameters of type Type.
void setValue(const Type &value)
Set the value of the parameter.
const Type & operator()() const
Get the value of the parameter.
void fromString(const std::string &value) override
Set the value of the property via a string.
const Type & value() const
Returns the value of the parameter.
ParameterType()
Constructor.
Parameter * clone() const override
type-independent clone method;
ParameterType & operator=(const Type &value)
Set the value of the parameter via the assignment operator.
Base class for parameters of an instrument.
std::string m_name
The name of the property.
const std::string & type() const
Parameter type.
std::string m_description
whether the parameter should be visible in InstrumentViewer
const bool & visible() const
Parameter visibility in InstrumentViewer.
void set(const T &t)
Sets the value of type T to the parameter if it has type ParameterType<T> Throws an exception if the ...
const std::string & name() const
Parameter name.
std::string m_str_value
Parameter value as a string.
bool operator==(const Parameter &rhs) const
Equality operator.
std::string m_type
The type of the property.
virtual Parameter * clone() const =0
type-independent clone method;
virtual const std::string & getDescription() const
get description
virtual void fromString(const std::string &value)
Set the value of the property via a string.
const char * nameAsCString() const
Parameter name.
const T & value()
Returns the parameter value of type T if the parameter has type ParameterType<T>
virtual void setVisible(const bool &visible)
set visibility:
virtual std::string asString() const
Returns the value of the property as a string.
virtual void setDescription(const std::string &source)
set description:
virtual ~Parameter()=default
Virtual destructor.
std::shared_ptr< Parameter > Parameter_sptr
Typedef for the shared pointer.
Helper class which provides the Collimation Length for SANS instruments.