17#include <unordered_map>
30 : m_name(
std::move(
name)), m_documentation(
""), m_typeinfo(&type), m_direction(direction), m_units(
""), m_group(
""),
31 m_remember(true), m_autotrim(true), m_disableReplaceWSButton(false), m_isDynamicDefault(false) {
33 throw std::invalid_argument(
"An empty property name is not permitted");
39 throw std::out_of_range(
"direction should be a member of the Direction enum");
44 : m_name(
right.m_name), m_documentation(
right.m_documentation), m_typeinfo(
right.m_typeinfo),
45 m_direction(
right.m_direction), m_units(
right.m_units), m_group(
right.m_group), m_remember(
right.m_remember),
46 m_autotrim(
right.m_autotrim), m_disableReplaceWSButton(
right.m_disableReplaceWSButton),
47 m_isDynamicDefault(
right.m_isDynamicDefault) {
49 throw std::invalid_argument(
"An empty property name is not permitted");
68 throw std::invalid_argument(
"An empty property name is not permitted");
162 std::ostringstream os;
163 os <<
"__TMP" <<
this;
172 std::ostringstream os;
173 os <<
"__TMP" <<
this;
174 return (os.str() == this->value());
222namespace DataObjects {
225class LeanElasticPeaksWorkspace;
226class GroupingWorkspace;
227class OffsetsWorkspace;
229class SpecialWorkspace2D;
232class SpecialWorkspace2D;
233class SplittersWorkspace;
237class PropertyManager;
253 return lhs_tsp_float->operator==(
rhs);
257 return lhs_tsp_double->operator==(
rhs);
261 return lhs_tsp_string->operator==(
rhs);
265 return lhs_tsp_bool->operator==(
rhs);
268 return (lhs.
value() ==
rhs.value());
286 using std::make_pair;
292 static std::unordered_map<string, string> typestrings;
293 if (typestrings.empty()) {
294 typestrings.emplace(
typeid(
char).
name(),
string(
"letter"));
295 typestrings.emplace(
typeid(
int).
name(),
string(
"number"));
296 typestrings.emplace(
typeid(
long long).
name(),
string(
"number"));
297 typestrings.emplace(
typeid(int64_t).
name(),
string(
"number"));
298 typestrings.emplace(
typeid(
double).
name(),
string(
"number"));
299 typestrings.emplace(
typeid(
bool).
name(),
string(
"boolean"));
300 typestrings.emplace(
typeid(
string).
name(),
string(
"string"));
301 typestrings.emplace(
typeid(std::vector<string>).
name(),
string(
"str list"));
302 typestrings.emplace(
typeid(std::vector<int>).
name(),
string(
"int list"));
303 typestrings.emplace(
typeid(std::vector<long>).
name(),
string(
"long list"));
304 typestrings.emplace(
typeid(std::vector<int64_t>).
name(),
string(
"int list"));
305 typestrings.emplace(
typeid(std::vector<size_t>).
name(),
string(
"unsigned int list"));
306 typestrings.emplace(
typeid(std::vector<double>).
name(),
string(
"dbl list"));
307 typestrings.emplace(
typeid(std::vector<std::vector<string>>).
name(),
string(
"list of str lists"));
308 typestrings.emplace(
typeid(
OptionalBool).
name(),
string(
"optional boolean"));
311 typestrings.emplace(
typeid(std::shared_ptr<Workspace>).
name(),
string(
"Workspace"));
312 typestrings.emplace(
typeid(std::shared_ptr<MatrixWorkspace>).
name(),
string(
"MatrixWorkspace"));
313 typestrings.emplace(
typeid(std::shared_ptr<ITableWorkspace>).
name(),
string(
"TableWorkspace"));
314 typestrings.emplace(
typeid(std::shared_ptr<IMDWorkspace>).
name(),
string(
"IMDWorkspace"));
315 typestrings.emplace(
typeid(std::shared_ptr<IMDEventWorkspace>).
name(),
string(
"MDEventWorkspace"));
316 typestrings.emplace(
typeid(std::shared_ptr<IEventWorkspace>).
name(),
string(
"IEventWorkspace"));
317 typestrings.emplace(
typeid(std::shared_ptr<Workspace2D>).
name(),
string(
"Workspace2D"));
318 typestrings.emplace(
typeid(std::shared_ptr<EventWorkspace>).
name(),
string(
"EventWorkspace"));
319 typestrings.emplace(
typeid(std::shared_ptr<PeaksWorkspace>).
name(),
string(
"PeaksWorkspace"));
320 typestrings.emplace(
typeid(std::shared_ptr<LeanElasticPeaksWorkspace>).
name(),
string(
"LeanElasticPeaksWorkspace"));
321 typestrings.emplace(
typeid(std::shared_ptr<IPeaksWorkspace>).
name(),
string(
"IPeaksWorkspace"));
322 typestrings.emplace(
typeid(std::shared_ptr<GroupingWorkspace>).
name(),
string(
"GroupingWorkspace"));
323 typestrings.emplace(
typeid(std::shared_ptr<WorkspaceGroup>).
name(),
string(
"WorkspaceGroup"));
324 typestrings.emplace(
typeid(std::shared_ptr<OffsetsWorkspace>).
name(),
string(
"OffsetsWorkspace"));
325 typestrings.emplace(
typeid(std::shared_ptr<MaskWorkspace>).
name(),
string(
"MaskWorkspace"));
326 typestrings.emplace(
typeid(std::shared_ptr<SpecialWorkspace2D>).
name(),
string(
"SpecialWorkspace2D"));
327 typestrings.emplace(
typeid(std::shared_ptr<IMDHistoWorkspace>).
name(),
string(
"IMDHistoWorkspace"));
328 typestrings.emplace(
typeid(std::shared_ptr<SplittersWorkspace>).
name(),
string(
"SplittersWorkspace"));
329 typestrings.emplace(
typeid(std::shared_ptr<SpecialWorkspace2D>).
name(),
string(
"SpecialWorkspace2D"));
330 typestrings.emplace(
typeid(std::shared_ptr<TableWorkspace>).
name(),
string(
"TableWorkspace"));
332 typestrings.emplace(
typeid(std::shared_ptr<IFunction>).
name(),
string(
"Function"));
333 typestrings.emplace(
typeid(std::shared_ptr<IAlgorithm>).
name(),
string(
"IAlgorithm"));
334 typestrings.emplace(
typeid(std::shared_ptr<PropertyManager>).
name(),
string(
"Dictionary"));
336 auto mitr = typestrings.find(type.name());
337 if (mitr != typestrings.end()) {
343 string type_name = type.name();
344 if (type_name.find(
"Mantid") != std::string::npos && type_name.find(
"EnumeratedString") != std::string::npos) {
const std::vector< double > & rhs
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
IAlgorithm is the interface implemented by the Algorithm base class.
This class provides an interface to an EventWorkspace.
This is an interface to a fitting function - a semi-abstarct class.
Abstract base class for multi-dimension event workspaces (MDEventWorkspace).
Abstract interface to MDHistoWorkspace, for use in exposing to Python.
Basic MD Workspace Abstract Class.
Interface to the class Mantid::DataObjects::PeaksWorkspace.
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
Base MatrixWorkspace Abstract Class.
Class to hold a set of workspaces.
Base Workspace Abstract Class.
Interface for modifiers to Property's that specify if they should be enabled or visible in a GUI.
OptionalBool : Tri-state bool.
This class stores information about the parameters used by an algorithm.
Base class for properties.
bool isDynamicDefault() const
Returns a flag indicating that the property's value has been set programmatically,...
virtual const std::string & units() const
Returns the units of the property, if any, as a string.
const IPropertySettings * getSettings() const
void setSettings(std::unique_ptr< IPropertySettings > settings)
Set the PropertySettings object.
void setDocumentation(const std::string &documentation)
Sets the user level description of the property.
void setIsDynamicDefault(const bool &flag)
Set or clear the flag indicating whether or not the property's value has been set programmatically.
virtual std::string valueAsPrettyStr(const size_t maxLength=0, const bool collapseLists=true) const
Returns the value of the property as a pretty printed string.
bool hasTemporaryValue() const
Property is using a temporary value for this property.
const std::type_info * m_typeinfo
The type of the property.
virtual int size() const
Return the size of this property.
Property()
Private default constructor.
void setDisableReplaceWSButton(const bool &disable)
Sets the property to disable the creation of the "Replace Workspace" button.
virtual const PropertyHistory createHistory() const
Create a PropertyHistory object representing the current state of the Property.
bool autoTrim() const
Returns if the property is set to automatically trim string unput values of whitespace.
void setRemember(bool)
Set wheter to remeber this property input.
void createTemporaryValue()
Create a temporary value for this property.
std::string m_name
The name of the property.
const std::string & documentation() const
Get the property's documentation string.
bool remember() const
Whether to save input values.
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 void setUnits(const std::string &unit)
Sets the units of the property, as a string.
void setName(const std::string &name)
Set the property's name.
virtual std::string isValid() const
Overridden function that checks whether the property, if not overriden returns "".
bool m_remember
Flag whether to save input values.
void clearSettings()
Deletes the PropertySettings object contained.
const std::string & name() const
Get the property's name.
void setAutoTrim(const bool &setting)
Sets if the property is set to automatically trim string unput values of whitespace.
std::unique_ptr< IPropertySettings > m_settings
Property settings (enabled/visible)
bool m_disableReplaceWSButton
Flag to disable the generation of the "Replace Workspace" button on the OutputWorkspace property.
virtual std::vector< std::string > allowedValues() const
Returns the set of valid values for this property, if such a set exists.
virtual ~Property()
Virtual destructor.
const std::string type() const
Returns the type of the property as a string.
std::string m_documentation
Longer, optional description of property.
const std::type_info * type_info() const
Get the property type_info.
bool m_autotrim
Flag to determine if string inputs to the property should be automatically trimmed of whitespace.
bool disableReplaceWSButton() const
Returns if the property is set to disable the creation of the "Replace Workspace" button.
std::string m_units
Units of the property (optional)
bool m_isDynamicDefault
Flag to indicate that the property's value has been set programmatically, for example,...
virtual std::string value() const =0
Returns the value of the property as a string.
A specialised Property class for holding a series of time-value pairs.
MANTID_KERNEL_DLL std::string shorten(const std::string &input, const size_t max_length)
Converts long strings into "start ... end".
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.