Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Mantid::Kernel::PropertyWithValue< TYPE > Class Template Reference

The concrete, templated class for properties. More...

#include <PropertyWithValue.h>

Inheritance diagram for Mantid::Kernel::PropertyWithValue< TYPE >:
Mantid::Kernel::Property Mantid::Kernel::ArrayProperty< int64_t > Mantid::API::WorkspaceProperty< TYPE > Mantid::Kernel::MaskedProperty< TYPE > Mantid::Kernel::MatrixProperty< TYPE > Mantid::API::IndexProperty

Public Member Functions

std::vector< std::string > allowedValues () const override
 Returns the set of valid values for this property, if such a set exists. More...
 
PropertyWithValue< TYPE > * 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 TYPE & () const
 
bool operator!= (const PropertyWithValue< TYPE > &rhs) const
 
virtual const TYPEoperator() () const
 
PropertyWithValueoperator+= (Property const *right) override
 Add to this. More...
 
PropertyWithValueoperator= (const PropertyWithValue &right)
 
virtual PropertyWithValueoperator= (const TYPE &value)
 
bool operator== (const PropertyWithValue< TYPE > &rhs) const
 
 PropertyWithValue (const PropertyWithValue< TYPE > &right)
 
 PropertyWithValue (const std::string &name, TYPE defaultValue, const std::string &defaultValueStr, IValidator_sptr validator, const unsigned int direction)
 
 PropertyWithValue (std::string name, TYPE defaultValue, const unsigned int direction)
 
 PropertyWithValue (std::string name, TYPE 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 Propertyclone () 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
 
IPropertySettingsgetSettings ()
 
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 Propertymerge (Property *)
 Just returns the property (*this) unless overridden. More...
 
const std::string & name () const
 Get the property's name. More...
 
virtual Propertyoperator+= (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...
 

Protected Attributes

TYPE m_initialValue
 the property's default value which is also its initial value More...
 
TYPE 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...
 

Private Member Functions

const TYPE getValueForAlias (const TYPE &alias) const
 
 PropertyWithValue ()=default
 Private default constructor. More...
 
template<typename U >
std::string setTypedValue (const U &value, const std::false_type &)
 
template<typename U >
std::string setTypedValue (const U &value, const std::true_type &)
 
std::string setValueFromProperty (const Property &right) override
 Set the value of the property via a reference to another property. More...
 

Private Attributes

IValidator_sptr m_validator
 Visitor validator class. More...
 

Static Private Attributes

static Logger g_logger
 Static reference to the logger class. 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...
 

Detailed Description

template<typename TYPE>
class Mantid::Kernel::PropertyWithValue< TYPE >

The concrete, templated class for properties.

The supported types at present are int, double, bool & std::string.

With reference to the Gaudi structure, this class can be seen as the equivalent of both the Gaudi class of the same name and its sub-classses.

Author
Russell Taylor, Tessella Support Services plc
Based on the Gaudi class of the same name (see http://proj-gaudi.web.cern.ch/proj-gaudi/)
Date
14/11/2007

Definition at line 37 of file PropertyWithValue.h.

Constructor & Destructor Documentation

◆ PropertyWithValue() [1/5]

template<typename TYPE >
Mantid::Kernel::PropertyWithValue< TYPE >::PropertyWithValue ( std::string  name,
TYPE  defaultValue,
IValidator_sptr  validator = IValidator_sptr(new NullValidator),
const unsigned int  direction = Direction::Input 
)

◆ PropertyWithValue() [2/5]

template<typename TYPE >
Mantid::Kernel::PropertyWithValue< TYPE >::PropertyWithValue ( std::string  name,
TYPE  defaultValue,
const unsigned int  direction 
)

◆ PropertyWithValue() [3/5]

template<typename TYPE >
Mantid::Kernel::PropertyWithValue< TYPE >::PropertyWithValue ( const std::string &  name,
TYPE  defaultValue,
const std::string &  defaultValueStr,
IValidator_sptr  validator,
const unsigned int  direction 
)

◆ PropertyWithValue() [4/5]

template<typename TYPE >
Mantid::Kernel::PropertyWithValue< TYPE >::PropertyWithValue ( const PropertyWithValue< TYPE > &  right)

◆ PropertyWithValue() [5/5]

template<typename TYPE >
Mantid::Kernel::PropertyWithValue< TYPE >::PropertyWithValue ( )
privatedefault

Private default constructor.

Member Function Documentation

◆ allowedValues()

template<typename TYPE >
std::vector< std::string > Mantid::Kernel::PropertyWithValue< TYPE >::allowedValues ( ) const
overridevirtual

Returns the set of valid values for this property, if such a set exists.

If not, it returns an empty set.

Returns
the set of valid values for this property or an empty set

Reimplemented from Mantid::Kernel::Property.

Referenced by MantidQt::API::FileFinderWidget::getFileExtensionsFromAlgorithm().

◆ clone()

template<typename TYPE >
PropertyWithValue< TYPE > * Mantid::Kernel::PropertyWithValue< TYPE >::clone ( ) const
overridevirtual

'Virtual copy constructor'

Implements Mantid::Kernel::Property.

Reimplemented in Mantid::Kernel::ArrayProperty< int64_t >.

◆ getDefault()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::getDefault ( ) const
overridevirtual

Get the default value for the property which is the value the property was initialised with.

Implements Mantid::Kernel::Property.

◆ getValidator()

template<typename TYPE >
IValidator_sptr Mantid::Kernel::PropertyWithValue< TYPE >::getValidator ( ) const

◆ getValueForAlias()

template<typename TYPE >
const TYPE Mantid::Kernel::PropertyWithValue< TYPE >::getValueForAlias ( const TYPE alias) const
private

◆ isDefault()

template<typename TYPE >
bool Mantid::Kernel::PropertyWithValue< TYPE >::isDefault ( ) const
overridevirtual

Overriden function that returns if property has the same value that it was initialised with, if applicable.

Implements Mantid::Kernel::Property.

◆ isMultipleSelectionAllowed()

template<typename TYPE >
bool Mantid::Kernel::PropertyWithValue< TYPE >::isMultipleSelectionAllowed ( )
overridevirtual

Is Multiple Selection Allowed.

Returns
true if multiple selection is allowed

Reimplemented from Mantid::Kernel::Property.

◆ isValid()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::isValid ( ) const
overridevirtual

Overridden function that checks whether the property, if not overriden returns "".

Overridden functions checks whether the property has a valid value.

Returns
empty string ""

Reimplemented from Mantid::Kernel::Property.

Referenced by Mantid::API::FileProperty::isValid(), and Mantid::Algorithms::ExtractMaskToTable::parseStringToVector().

◆ operator const TYPE &()

template<typename TYPE >
virtual Mantid::Kernel::PropertyWithValue< TYPE >::operator const TYPE & ( ) const
virtual

◆ operator!=()

template<typename TYPE >
bool Mantid::Kernel::PropertyWithValue< TYPE >::operator!= ( const PropertyWithValue< TYPE > &  rhs) const

◆ operator()()

template<typename TYPE >
virtual const TYPE & Mantid::Kernel::PropertyWithValue< TYPE >::operator() ( ) const
virtual

◆ operator+=()

template<typename TYPE >
PropertyWithValue & Mantid::Kernel::PropertyWithValue< TYPE >::operator+= ( Property const *  rhs)
overridevirtual

Add to this.

Implements Mantid::Kernel::Property.

◆ operator=() [1/2]

template<typename TYPE >
PropertyWithValue & Mantid::Kernel::PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< TYPE > &  right)

◆ operator=() [2/2]

template<typename TYPE >
virtual PropertyWithValue & Mantid::Kernel::PropertyWithValue< TYPE >::operator= ( const TYPE value)
virtual

Reimplemented in Mantid::API::FunctionProperty.

◆ operator==()

template<typename TYPE >
bool Mantid::Kernel::PropertyWithValue< TYPE >::operator== ( const PropertyWithValue< TYPE > &  rhs) const

◆ replaceValidator()

template<typename TYPE >
virtual void Mantid::Kernel::PropertyWithValue< TYPE >::replaceValidator ( IValidator_sptr  newValidator)
virtual

◆ saveProperty() [1/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< float >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [2/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< double >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [3/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< int32_t >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [4/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< uint32_t >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [5/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< int64_t >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [6/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< uint64_t >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [7/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< std::string >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [8/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< std::vector< double > >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [9/10]

MANTID_KERNEL_DLL void Mantid::Kernel::PropertyWithValue< std::vector< int32_t > >::saveProperty ( ::NeXus::File *  file)
virtual

Reimplemented from Mantid::Kernel::Property.

◆ saveProperty() [10/10]

template<typename TYPE >
void Mantid::Kernel::PropertyWithValue< TYPE >::saveProperty ( ::NeXus::File *  file)
overridevirtual

Reimplemented from Mantid::Kernel::Property.

◆ setDataItem()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::setDataItem ( const std::shared_ptr< DataItem > &  )
overridevirtual

Set the value of the property via a DataItem pointer.

If the value is unacceptable the value is not changed but a string is returned

Implements Mantid::Kernel::Property.

◆ setTypedValue() [1/2]

template<typename TYPE >
template<typename U >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::setTypedValue ( const U &  value,
const std::false_type &   
)
private

◆ setTypedValue() [2/2]

template<typename TYPE >
template<typename U >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::setTypedValue ( const U &  value,
const std::true_type &   
)
private

◆ setValue()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::setValue ( const std::string &  )
overridevirtual

Set the value of the property via a string.

If the value is unacceptable the value is not changed but a string is returned

Implements Mantid::Kernel::Property.

Reimplemented in Mantid::Kernel::ArrayProperty< int64_t >.

Referenced by Mantid::API::FileProperty::setLoadProperty(), Mantid::API::FileProperty::setSaveProperty(), Mantid::API::FileProperty::setValue(), and Mantid::Algorithms::ChangeTimeZero::shiftTimeOfLogForStringProperty().

◆ setValueFromJson()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::setValueFromJson ( const Json::Value &  )
overridevirtual

Set the value of the property via a Json object.

If the value is unacceptable the value is not changed but a string is returned A const char * can be implicitly converted to both Json::Value and std::string so using simple setValue for both functions causes an abiguity error

Implements Mantid::Kernel::Property.

◆ setValueFromProperty()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::setValueFromProperty ( const Property right)
overrideprivatevirtual

Set the value of the property via a reference to another property.

Implements Mantid::Kernel::Property.

◆ size()

template<typename TYPE >
int Mantid::Kernel::PropertyWithValue< TYPE >::size ( ) const
overridevirtual

Return the size of this property.

Single-Value properties return 1. TimeSeriesProperties return the # of entries.

Returns
the size of the property

Reimplemented from Mantid::Kernel::Property.

Referenced by Mantid::Algorithms::MaskBinsFromTable::convertToSpectraList(), and Mantid::Algorithms::ExtractMaskToTable::parseStringToVector().

◆ value()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::value ( ) const
overridevirtual

◆ valueAsJson()

template<typename TYPE >
Json::Value Mantid::Kernel::PropertyWithValue< TYPE >::valueAsJson ( ) const
overridevirtual

Returns the value of the property as a Json::Value.

Implements Mantid::Kernel::Property.

◆ valueAsPrettyStr()

template<typename TYPE >
std::string Mantid::Kernel::PropertyWithValue< TYPE >::valueAsPrettyStr ( const size_t  maxLength = 0,
const bool  collapseLists = true 
) const
overridevirtual

Returns the value of the property as a pretty printed string.

Returns the value as a pretty printed string The default implementation just returns the value with the size limit applied.

Parameters
maxLength:: The Max length of the returned string
collapseLists:: Whether to collapse 1,2,3 into 1-3

Reimplemented from Mantid::Kernel::Property.

Member Data Documentation

◆ g_logger

template<typename TYPE >
Logger Mantid::Kernel::PropertyWithValue< TYPE >::g_logger
staticprivate

Static reference to the logger class.

Definition at line 90 of file PropertyWithValue.h.

◆ m_initialValue

template<typename TYPE >
TYPE Mantid::Kernel::PropertyWithValue< TYPE >::m_initialValue
protected

the property's default value which is also its initial value

Definition at line 75 of file PropertyWithValue.h.

◆ m_validator

template<typename TYPE >
IValidator_sptr Mantid::Kernel::PropertyWithValue< TYPE >::m_validator
private

Visitor validator class.

Definition at line 87 of file PropertyWithValue.h.

◆ m_value

template<typename TYPE >
TYPE Mantid::Kernel::PropertyWithValue< TYPE >::m_value
protected

The documentation for this class was generated from the following file: