12#include "MantidKernel/DllConfig.h"
44class IPropertySettings;
46class SplittingInterval;
60 static const std::string
asText(
const unsigned int &direction) {
74 static int asEnum(
const std::string &direction) {
75 if (direction ==
"Input")
77 else if (direction ==
"Output")
79 else if (direction ==
"InOut")
102 const std::string &name()
const;
103 const std::string &documentation()
const;
104 const std::type_info *type_info()
const;
105 const std::string type()
const;
109 virtual std::string isValid()
const;
112 void setSettings(std::unique_ptr<IPropertySettings> settings);
116 void clearSettings();
122 bool remember()
const;
123 void setRemember(
bool);
125 void setDocumentation(
const std::string &documentation);
128 throw std::invalid_argument(
"Property::saveProperty - Cannot save '" + this->name() +
129 "', property type not implemented.");
132 virtual std::string
value()
const = 0;
134 virtual std::string valueAsPrettyStr(
const size_t maxLength = 0,
const bool collapseLists =
true)
const;
141 virtual std::string
setValue(
const std::string &) = 0;
152 virtual std::string
setDataItem(
const std::shared_ptr<DataItem> &) = 0;
162 virtual std::vector<std::string> allowedValues()
const;
167 void createTemporaryValue();
169 bool hasTemporaryValue()
const;
176 virtual void filterByTime(
const Types::Core::DateAndTime &start,
const Types::Core::DateAndTime &stop);
177 virtual void splitByTime(std::vector<SplittingInterval> &splitter, std::vector<Property *> outputs,
178 bool isProtonCharge =
true)
const;
180 virtual int size()
const;
182 virtual const std::string &units()
const;
184 virtual void setUnits(
const std::string &unit);
194 void setGroup(
const std::string &group) { m_group = group; }
199 bool autoTrim()
const;
200 void setAutoTrim(
const bool &setting);
204 Property(std::string name,
const std::type_info &type,
const unsigned int &direction = Direction::Input);
const std::vector< double > & rhs
Interface for modifiers to Property's that specify if they should be enabled or visible in a GUI.
This class stores information about the parameters used by an algorithm.
Base class for properties.
virtual std::string setValueFromJson(const Json::Value &)=0
Set the value of the property via a Json object.
const std::type_info * m_typeinfo
The type of the property.
virtual std::string setDataItem(const std::shared_ptr< DataItem > &)=0
Set the value of the property via a DataItem pointer.
virtual size_t getMemorySize() const
Property()
Private default constructor.
void setGroup(const std::string &group)
Set the group this property belongs to.
virtual std::string setValueFromProperty(const Property &right)=0
Set the value of the property via a reference to another property.
unsigned int direction() const
returns the direction of the property
std::string m_name
The name of the property.
virtual std::string setValue(const std::string &)=0
Set the value of the property via a string.
const unsigned int m_direction
Whether the property is used as input, output or both to an algorithm.
virtual Property & merge(Property *)
Just returns the property (*this) unless overridden.
virtual bool isMultipleSelectionAllowed()
Is Multiple Selection Allowed.
virtual Property * clone() const =0
'Virtual copy constructor'
virtual bool isDefault() const =0
Overriden function that returns if property has the same value that it was initialised with,...
bool m_remember
Flag whether to save input values.
std::string m_group
Name of the "group" of this property, for grouping in the GUI. Default "".
std::unique_ptr< IPropertySettings > m_settings
Property settings (enabled/visible)
const std::string & getGroup()
virtual ~Property()
Virtual destructor.
virtual void saveProperty(::NeXus::File *)
virtual Property & operator+=(Property const *rhs)=0
Add to this.
std::string m_documentation
Longer, optional description of property.
virtual std::string getDefault() const =0
Get the default value for the property which is the value the property was initialised with.
bool m_autotrim
Flag to determine if string inputs to the property should be automatically trimmed of whitespace.
std::string m_units
Units of the property (optional)
Property & operator=(const Property &right)
Private, unimplemented copy assignment operator.
virtual Json::Value valueAsJson() const =0
Returns the value of the property as a Json::Value.
virtual std::string value() const =0
Returns the value of the property as a string.
virtual bool isValueSerializable() const
Whether the string returned by value() can be used for serialization.
MANTID_KERNEL_DLL bool operator!=(const Mantid::Kernel::Property &lhs, const Mantid::Kernel::Property &rhs)
Compares this to another property for inequality.
MANTID_KERNEL_DLL bool operator==(const Mantid::Kernel::Property &lhs, const Mantid::Kernel::Property &rhs)
Compares this to another property for equality.
MANTID_KERNEL_DLL std::string getUnmangledTypeName(const std::type_info &type)
Return the name corresponding to the mangled string given by typeid.
Helper class which provides the Collimation Length for SANS instruments.
Describes the direction (within an algorithm) of a Property.
Type
Enum giving the possible directions.
@ InOut
Both an input & output workspace.
@ Input
An input workspace.
@ Output
An output workspace.
static const std::string asText(const unsigned int &direction)
Returns a text representation of the input Direction enum.
static int asEnum(const std::string &direction)
Returns an enum representation of the input Direction string.