Mantid
|
A property class for functions. More...
#include <FunctionProperty.h>
Public Member Functions | |
FunctionProperty * | clone () const override |
'Virtual copy constructor' More... | |
const Kernel::PropertyHistory | createHistory () const override |
Create a history record. More... | |
FunctionProperty (const FunctionProperty &right)=default | |
Copy constructor. More... | |
FunctionProperty (const std::string &name, const unsigned int direction=Kernel::Direction::Input, const PropertyMode::Type optional=PropertyMode::Type::Mandatory) | |
Constructor. More... | |
std::string | getDefault () const override |
Get the value the property was initialised with -its default value. More... | |
bool | isDefault () const override |
Is default. More... | |
std::string | isValid () const override |
Checks whether the entered function is valid. More... | |
FunctionProperty & | operator+= (Kernel::Property const *) override |
Add the value of another property. More... | |
FunctionProperty & | operator= (const FunctionProperty &right)=default |
Copy assignment operator. More... | |
FunctionProperty & | operator= (const std::shared_ptr< IFunction > &value) override |
Bring in the PropertyWithValue assignment operator explicitly (avoids VSC++ warning) More... | |
std::string | setValue (const std::string &value) override |
Set the value of the property. More... | |
std::string | setValueFromJson (const Json::Value &value) override |
Set the value of the property as a Json representation. More... | |
std::string | value () const override |
Get the function definition string. More... | |
Json::Value | valueAsJson () const override |
Return a Json::Value object encoding the function string. More... | |
Public Member Functions inherited from Mantid::Kernel::PropertyWithValue< std::shared_ptr< IFunction > > | |
std::vector< std::string > | allowedValues () const override |
Returns the set of valid values for this property, if such a set exists. More... | |
PropertyWithValue< std::shared_ptr< IFunction > > * | clone () const override |
'Virtual copy constructor' More... | |
std::string | getDefault () const override |
Get the default value for the property which is the value the property was initialised with. More... | |
IValidator_sptr | getValidator () const |
bool | isDefault () const override |
Overriden function that returns if property has the same value that it was initialised with, if applicable. More... | |
bool | isMultipleSelectionAllowed () override |
Is Multiple Selection Allowed. More... | |
std::string | isValid () const override |
Overridden function that checks whether the property, if not overriden returns "". More... | |
virtual | operator const std::shared_ptr< IFunction > & () const |
bool | operator!= (const PropertyWithValue< std::shared_ptr< IFunction > > &rhs) const |
virtual const std::shared_ptr< IFunction > & | operator() () const |
PropertyWithValue & | operator+= (Property const *right) override |
Add to this. More... | |
PropertyWithValue & | operator= (const PropertyWithValue &right) |
virtual PropertyWithValue & | operator= (const std::shared_ptr< IFunction > &value) |
bool | operator== (const PropertyWithValue< std::shared_ptr< IFunction > > &rhs) const |
PropertyWithValue (const PropertyWithValue< std::shared_ptr< IFunction > > &right) | |
PropertyWithValue (const std::string &name, std::shared_ptr< IFunction > defaultValue, const std::string &defaultValueStr, IValidator_sptr validator, const unsigned int direction) | |
PropertyWithValue (std::string name, std::shared_ptr< IFunction > defaultValue, const unsigned int direction) | |
PropertyWithValue (std::string name, std::shared_ptr< IFunction > defaultValue, IValidator_sptr validator=IValidator_sptr(new NullValidator), const unsigned int direction=Direction::Input) | |
virtual void | replaceValidator (IValidator_sptr newValidator) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
MANTID_KERNEL_DLL void | saveProperty (::NeXus::File *file) |
void | saveProperty (::NeXus::File *file) override |
std::string | setDataItem (const std::shared_ptr< DataItem > &data) override |
Set the value of the property via a DataItem pointer. More... | |
std::string | setValue (const std::string &value) override |
Set the value of the property via a string. More... | |
std::string | setValueFromJson (const Json::Value &value) override |
Set the value of the property via a Json object. More... | |
int | size () const override |
Return the size of this property. More... | |
std::string | value () const override |
Returns the value of the property as a string. More... | |
Json::Value | valueAsJson () const override |
Returns the value of the property as a Json::Value. More... | |
std::string | valueAsPrettyStr (const size_t maxLength=0, const bool collapseLists=true) const override |
Returns the value of the property as a pretty printed string. More... | |
Public Member Functions inherited from Mantid::Kernel::Property | |
virtual std::vector< std::string > | allowedValues () const |
Returns the set of valid values for this property, if such a set exists. More... | |
bool | autoTrim () const |
Returns if the property is set to automatically trim string unput values of whitespace. More... | |
void | clearSettings () |
Deletes the PropertySettings object contained. More... | |
virtual Property * | clone () const =0 |
'Virtual copy constructor' More... | |
virtual const PropertyHistory | createHistory () const |
Create a PropertyHistory object representing the current state of the Property. More... | |
void | createTemporaryValue () |
Create a temporary value for this property. More... | |
unsigned int | direction () const |
returns the direction of the property More... | |
const std::string & | documentation () const |
Get the property's documentation string. More... | |
virtual void | filterByTime (const Types::Core::DateAndTime &start, const Types::Core::DateAndTime &stop) |
Filter out a property by time. More... | |
virtual std::string | getDefault () const =0 |
Get the default value for the property which is the value the property was initialised with. More... | |
const std::string & | getGroup () |
virtual size_t | getMemorySize () const |
IPropertySettings * | getSettings () |
bool | hasTemporaryValue () const |
Property is using a temporary value for this property. More... | |
virtual bool | isDefault () const =0 |
Overriden function that returns if property has the same value that it was initialised with, if applicable. More... | |
virtual bool | isMultipleSelectionAllowed () |
Is Multiple Selection Allowed. More... | |
virtual std::string | isValid () const |
Overridden function that checks whether the property, if not overriden returns "". More... | |
virtual bool | isValueSerializable () const |
Whether the string returned by value() can be used for serialization. More... | |
virtual Property & | merge (Property *) |
Just returns the property (*this) unless overridden. More... | |
const std::string & | name () const |
Get the property's name. More... | |
virtual Property & | operator+= (Property const *rhs)=0 |
Add to this. More... | |
bool | remember () const |
Whether to save input values. More... | |
virtual void | saveProperty (::NeXus::File *) |
void | setAutoTrim (const bool &setting) |
Sets if the property is set to automatically trim string unput values of whitespace. More... | |
virtual std::string | setDataItem (const std::shared_ptr< DataItem > &)=0 |
Set the value of the property via a DataItem pointer. More... | |
void | setDocumentation (const std::string &documentation) |
Sets the user level description of the property. More... | |
void | setGroup (const std::string &group) |
Set the group this property belongs to. More... | |
void | setRemember (bool) |
Set wheter to remeber this property input. More... | |
void | setSettings (std::unique_ptr< IPropertySettings > settings) |
Set the PropertySettings object. More... | |
virtual void | setUnits (const std::string &unit) |
Sets the units of the property, as a string. More... | |
virtual std::string | setValue (const std::string &)=0 |
Set the value of the property via a string. More... | |
virtual std::string | setValueFromJson (const Json::Value &)=0 |
Set the value of the property via a Json object. More... | |
virtual std::string | setValueFromProperty (const Property &right)=0 |
Set the value of the property via a reference to another property. More... | |
virtual int | size () const |
Return the size of this property. More... | |
virtual void | splitByTime (std::vector< SplittingInterval > &splitter, std::vector< Property * > outputs, bool isProtonCharge=true) const |
Split a property by time. More... | |
const std::string | type () const |
Returns the type of the property as a string. More... | |
const std::type_info * | type_info () const |
Get the property type_info. More... | |
virtual const std::string & | units () const |
Returns the units of the property, if any, as a string. More... | |
virtual std::string | value () const =0 |
Returns the value of the property as a string. More... | |
virtual Json::Value | valueAsJson () const =0 |
Returns the value of the property as a Json::Value. More... | |
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. More... | |
virtual | ~Property () |
Virtual destructor. More... | |
Private Member Functions | |
bool | isOptional () const |
Return true if the property is optional. More... | |
Private Attributes | |
std::string | m_definition |
The function definition string (as used by the FunctionFactory) More... | |
PropertyMode::Type | m_optional |
A flag indicating whether the property should be considered optional. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::Kernel::Property | |
Property (const Property &right) | |
Copy constructor. More... | |
Property (std::string name, const std::type_info &type, const unsigned int &direction=Direction::Input) | |
Constructor. More... | |
Protected Attributes inherited from Mantid::Kernel::PropertyWithValue< std::shared_ptr< IFunction > > | |
std::shared_ptr< IFunction > | m_initialValue |
the property's default value which is also its initial value More... | |
std::shared_ptr< IFunction > | m_value |
The value of the property. More... | |
Protected Attributes inherited from Mantid::Kernel::Property | |
std::string | m_name |
The name of the property. More... | |
A property class for functions.
Holds a shared pointer to a function. The string representation is the creation string accepted by the FunctionFactory.
Definition at line 29 of file FunctionProperty.h.
Mantid::API::FunctionProperty::FunctionProperty | ( | const std::string & | name, |
const unsigned int | direction = Kernel::Direction::Input , |
||
const PropertyMode::Type | optional = PropertyMode::Type::Mandatory |
||
) |
Constructor.
Sets the property names but initialises the function pointer to null.
name | :: The name to assign to the property |
direction | :: The direction of the function (i.e. input or output) |
optional | :: A flag indicating whether the property is optional or mandatory. |
Definition at line 20 of file FunctionProperty.cpp.
|
default |
Copy constructor.
|
inlineoverridevirtual |
'Virtual copy constructor'
Implements Mantid::Kernel::Property.
Definition at line 50 of file FunctionProperty.h.
|
overridevirtual |
Create a history record.
Reimplemented from Mantid::Kernel::Property.
Definition at line 125 of file FunctionProperty.cpp.
|
overridevirtual |
Get the value the property was initialised with -its default value.
Implements Mantid::Kernel::Property.
Definition at line 61 of file FunctionProperty.cpp.
Referenced by value().
|
overridevirtual |
Is default.
Indicates if the function has not been created yet.
Implements Mantid::Kernel::Property.
Definition at line 121 of file FunctionProperty.cpp.
References Mantid::Kernel::PropertyWithValue< std::shared_ptr< IFunction > >::m_value.
Referenced by isValid().
|
private |
Return true if the property is optional.
Returns true if this property is optional.
Definition at line 66 of file FunctionProperty.cpp.
References m_optional, and Mantid::API::PropertyMode::Optional.
Referenced by isValid(), and setValue().
|
overridevirtual |
Checks whether the entered function is valid.
To be valid it has to be other then default which is no function defined.
Reimplemented from Mantid::Kernel::Property.
Definition at line 110 of file FunctionProperty.cpp.
References Mantid::Kernel::Property::direction(), isDefault(), isOptional(), and Mantid::Kernel::Direction::Output.
|
overridevirtual |
Add the value of another property.
Implements Mantid::Kernel::Property.
Definition at line 38 of file FunctionProperty.cpp.
|
default |
Copy assignment operator.
Only copies the value (i.e. the pointer to the function)
References Mantid::API::operator+=().
|
overridevirtual |
Bring in the PropertyWithValue assignment operator explicitly (avoids VSC++ warning)
value | :: The value to set to |
Reimplemented from Mantid::Kernel::PropertyWithValue< std::shared_ptr< IFunction > >.
Definition at line 31 of file FunctionProperty.cpp.
References value().
|
overridevirtual |
Set the value of the property.
Set the function definition.
Also tries to create the function with FunctionFactory.
value | :: The function definition string. |
Implements Mantid::Kernel::Property.
Definition at line 73 of file FunctionProperty.cpp.
References error, Mantid::Kernel::SingletonHolder< T >::Instance(), isOptional(), m_definition, Mantid::Kernel::PropertyWithValue< std::shared_ptr< IFunction > >::m_value, and value().
Referenced by setValueFromJson().
|
overridevirtual |
Set the value of the property as a Json representation.
Assumes the Json object is a string and parses it to create the function.
value | A Json::Value containing a string |
Implements Mantid::Kernel::Property.
Definition at line 98 of file FunctionProperty.cpp.
References setValue(), and value().
|
overridevirtual |
Get the function definition string.
Get the function definition.
Implements Mantid::Kernel::Property.
Definition at line 45 of file FunctionProperty.cpp.
References getDefault(), and Mantid::Kernel::PropertyWithValue< std::shared_ptr< IFunction > >::m_value.
Referenced by operator=(), setValue(), setValueFromJson(), and valueAsJson().
|
overridevirtual |
Return a Json::Value object encoding the function string.
Implements Mantid::Kernel::Property.
Definition at line 56 of file FunctionProperty.cpp.
References value().
|
private |
The function definition string (as used by the FunctionFactory)
Definition at line 83 of file FunctionProperty.h.
Referenced by setValue().
|
private |
A flag indicating whether the property should be considered optional.
Definition at line 81 of file FunctionProperty.h.
Referenced by isOptional().