Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::Kernel::PropertyManagerOwner Class Reference

Kernel/PropertyManagerOwner.h. More...

#include <PropertyManagerOwner.h>

Inheritance diagram for Mantid::Kernel::PropertyManagerOwner:
Mantid::Kernel::IPropertyManager

Public Member Functions

void afterPropertySet (const std::string &) override
 Override this method to perform a custom action right after a property was set. More...
 
::Json::Value asJson (bool withDefaultValues=false) const override
 Return the property manager serialized as a json object. More...
 
std::string asString (bool withDefaultValues=false) const override
 Return the property manager serialized as a string. More...
 
void clear () override
 Clears all properties under management. More...
 
virtual void copyPropertiesFrom (const PropertyManagerOwner &po)
 Make m_properties point to the same PropertyManager as po. More...
 
void declareOrReplaceProperty (std::unique_ptr< Property > p, const std::string &doc="") override
 Add or replace property in the list of managed properties. More...
 
void declareProperty (const std::string &name, const char *value, const std::string &doc, IValidator_sptr validator=std::make_shared< NullValidator >(), const unsigned int direction=Direction::Input)
 Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). More...
 
void declareProperty (const std::string &name, const char *value, const unsigned int direction)
 Add a property of string type to the list of managed properties. More...
 
void declareProperty (const std::string &name, const char *value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc=std::string(), const unsigned int direction=Direction::Input)
 Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). More...
 
template<typename T >
void declareProperty (const std::string &name, T value, const std::string &doc, const unsigned int direction=Direction::Input)
 Add a property to the list of managed properties with no validator. More...
 
template<typename T >
void declareProperty (const std::string &name, T value, const unsigned int direction)
 Add a property of the template type to the list of managed properties. More...
 
template<typename T >
void declareProperty (const std::string &name, T value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc="", const unsigned int direction=Direction::Input)
 Add a property of the template type to the list of managed properties. More...
 
void declareProperty (std::unique_ptr< Property > p, const std::string &doc="") override
 Add a property to the list of managed properties. More...
 
virtual void declareProperty (std::unique_ptr< Property > p, const std::string &doc="")=0
 Function to declare properties (i.e. store them) More...
 
bool existsProperty (const std::string &name) const override
 Checks whether the named property is already in the list of managed property. More...
 
void filterByProperty (const TimeSeriesProperty< bool > &, const std::vector< std::string > &) override
 
void filterByTime (const Types::Core::DateAndTime &, const Types::Core::DateAndTime &) override
 
std::vector< std::string > getDeclaredPropertyNames () const noexcept override
 Return the list of declared property names. More...
 
PropertygetPointerToProperty (const std::string &name) const override
 Get a property by name. More...
 
PropertygetPointerToPropertyOrdinal (const int &index) const override
 Get a property by an index. More...
 
const std::vector< Property * > & getProperties () const override
 Get the list of managed properties. More...
 
TypedValue getProperty (const std::string &name) const override
 Get the value of a property. More...
 
std::string getPropertyValue (const std::string &name) const override
 Get the value of a property as a string. More...
 
bool isDefault (const std::string &name) const
 
PropertyManagerOwneroperator= (const PropertyManagerOwner &)
 Assignment operator. More...
 
size_t propertyCount () const override
 Count the number of properties under management. More...
 
 PropertyManagerOwner ()
 Default constructor. More...
 
 PropertyManagerOwner (const PropertyManagerOwner &)
 Copy constructor. More...
 
void removeProperty (const std::string &name, const bool delproperty=true) override
 Removes the property from management. More...
 
void resetProperties () override
 Reset property values back to initial values (blank or default values) More...
 
void setProperties (const ::Json::Value &jsonValue, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false) override
 Sets all the declared properties from a json object. More...
 
void setProperties (const std::string &propertiesJson, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false) override
 Set the ordered list of properties by one string of values, separated by semicolons. More...
 
void setPropertiesWithString (const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >()) override
 Sets all the declared properties from a string. More...
 
void setPropertyOrdinal (const int &index, const std::string &value) override
 Set the value of a property by an index N.B. More...
 
void setPropertyValue (const std::string &name, const std::string &value) override
 Set the value of a property by string N.B. More...
 
void setPropertyValueFromJson (const std::string &name, const Json::Value &value) override
 Set the value of a property by Json::Value object. More...
 
void splitByTime (std::vector< SplittingInterval > &, std::vector< PropertyManager * >) const override
 
std::unique_ptr< PropertytakeProperty (const size_t index) override
 Removes the property from management returning a pointer to it. More...
 
bool validateProperties () const override
 Validates all the properties in the collection. More...
 
- Public Member Functions inherited from Mantid::Kernel::IPropertyManager
virtual ::Json::Value asJson (bool withDefaultValues=false) const =0
 Return the property manager serialized as a json object. More...
 
virtual std::string asString (bool withDefaultValues=false) const =0
 Return the property manager serialized as a string. More...
 
virtual void declareOrReplaceProperty (std::unique_ptr< Property > p, const std::string &doc="")=0
 Function to declare properties (i.e. store them) More...
 
void declareProperty (const std::string &name, const char *value, const std::string &doc, IValidator_sptr validator=std::make_shared< NullValidator >(), const unsigned int direction=Direction::Input)
 Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). More...
 
void declareProperty (const std::string &name, const char *value, const unsigned int direction)
 Add a property of string type to the list of managed properties. More...
 
void declareProperty (const std::string &name, const char *value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc=std::string(), const unsigned int direction=Direction::Input)
 Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). More...
 
template<typename T >
void declareProperty (const std::string &name, T value, const std::string &doc, const unsigned int direction=Direction::Input)
 Add a property to the list of managed properties with no validator. More...
 
template<typename T >
void declareProperty (const std::string &name, T value, const unsigned int direction)
 Add a property of the template type to the list of managed properties. More...
 
template<typename T >
void declareProperty (const std::string &name, T value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc="", const unsigned int direction=Direction::Input)
 Add a property of the template type to the list of managed properties. More...
 
virtual void declareProperty (std::unique_ptr< Property > p, const std::string &doc="")=0
 Function to declare properties (i.e. store them) More...
 
virtual bool existsProperty (const std::string &name) const =0
 Checks whether the named property is already in the list of managed property. More...
 
virtual void filterByProperty (const TimeSeriesProperty< bool > &, const std::vector< std::string > &)=0
 
virtual void filterByTime (const Types::Core::DateAndTime &, const Types::Core::DateAndTime &)=0
 
virtual std::vector< std::string > getDeclaredPropertyNames () const noexcept=0
 Get the list of managed property names. More...
 
virtual PropertygetPointerToProperty (const std::string &name) const =0
 Get a pointer to property by name. More...
 
virtual const std::vector< Property * > & getProperties () const =0
 Get the list of managed properties. More...
 
std::vector< Property * > getPropertiesInGroup (const std::string &group) const
 Get the list of managed properties in a given group. More...
 
virtual TypedValue getProperty (const std::string &name) const =0
 Get the value of a property. More...
 
virtual std::string getPropertyValue (const std::string &name) const =0
 Get the value of a property as a string. More...
 
virtual size_t propertyCount () const =0
 Returns the number of properties under management. More...
 
virtual void removeProperty (const std::string &name, const bool delproperty=true)=0
 Removes the property from management. More...
 
virtual void resetProperties ()=0
 
virtual void setProperties (const ::Json::Value &jsonValue, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false)=0
 Sets all the properties from a json object. More...
 
virtual void setProperties (const std::string &propertiesJson, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false)=0
 Sets all properties from a string. More...
 
virtual void setPropertiesWithString (const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >())=0
 Sets all the declared properties from a string. More...
 
IPropertyManagersetProperty (const std::string &name, const char *value)
 Specialised version of setProperty template method to handle const char *. More...
 
IPropertyManagersetProperty (const std::string &name, const std::string &value)
 Specialised version of setProperty template method to handle std::string. More...
 
template<typename T >
IPropertyManagersetProperty (const std::string &name, const T &value)
 Templated method to set the value of a PropertyWithValue. More...
 
template<typename T >
IPropertyManagersetProperty (const std::string &name, std::unique_ptr< T > value)
 Templated method to set the value of a PropertyWithValue from a std::unique_ptr. More...
 
void setPropertyGroup (const std::string &name, const std::string &group)
 Set the group for a given property. More...
 
virtual void setPropertyOrdinal (const int &index, const std::string &value)=0
 Set the value of a property by an index. More...
 
void setPropertySettings (const std::string &name, std::unique_ptr< IPropertySettings > settings)
 
virtual void setPropertyValue (const std::string &name, const std::string &value)=0
 Sets property value from a string. More...
 
virtual void setPropertyValueFromJson (const std::string &name, const Json::Value &value)=0
 Sets property value from a Json::Value. More...
 
virtual void splitByTime (std::vector< SplittingInterval > &, std::vector< PropertyManager * >) const =0
 
virtual std::unique_ptr< PropertytakeProperty (const size_t index)=0
 Removes the property from management and returns a pointer to it. More...
 
void updatePropertyValues (const IPropertyManager &other)
 Update values of the existing properties. More...
 
virtual bool validateProperties () const =0
 Validates all the properties in the collection. More...
 
virtual ~IPropertyManager ()=default
 

Private Attributes

std::shared_ptr< PropertyManagerm_properties
 Shared pointer to the 'real' property manager. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::Kernel::IPropertyManager
virtual void afterPropertySet (const std::string &)
 Override this method to perform a custom action right after a property was set. More...
 
virtual void clear ()=0
 Clears all properties under management. More...
 
virtual PropertygetPointerToPropertyOrdinal (const int &index) const =0
 Get a property by an index. More...
 
template<typename T >
getValue (const std::string &name) const
 Templated method to get the value of a property. More...
 
template<>
MANTID_KERNEL_DLL PropertyManager_sptr getValue (const std::string &name) const
 
template<>
MANTID_KERNEL_DLL PropertyManager_const_sptr getValue (const std::string &name) const
 

Detailed Description

Kernel/PropertyManagerOwner.h.

Implementation of IPropertyManager which allows sharing the same set of Properties between several instances.

Author
Roman Tolchenov, Tessella plc
Date
03/03/2009

Definition at line 33 of file PropertyManagerOwner.h.

Constructor & Destructor Documentation

◆ PropertyManagerOwner() [1/2]

Mantid::Kernel::PropertyManagerOwner::PropertyManagerOwner ( )

Default constructor.

Definition at line 24 of file PropertyManagerOwner.cpp.

◆ PropertyManagerOwner() [2/2]

Mantid::Kernel::PropertyManagerOwner::PropertyManagerOwner ( const PropertyManagerOwner po)

Copy constructor.

Definition at line 27 of file PropertyManagerOwner.cpp.

Member Function Documentation

◆ afterPropertySet()

void Mantid::Kernel::PropertyManagerOwner::afterPropertySet ( const std::string &  name)
overridevirtual

Override this method to perform a custom action right after a property was set.

The argument is the property name. Default - do nothing.

The argument is the property name. Default - do nothing.

Parameters
name:: A property name.

Reimplemented from Mantid::Kernel::IPropertyManager.

Definition at line 272 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::afterPropertySet(), setPropertyOrdinal(), setPropertyValue(), and setPropertyValueFromJson().

◆ asJson()

Json::Value Mantid::Kernel::PropertyManagerOwner::asJson ( bool  withDefaultValues = false) const
overridevirtual

Return the property manager serialized as a json object.

Parameters
withDefaultValues:: If true then the value of default parameters will be included
Returns
A jsonValue of the manager

Implements Mantid::Kernel::IPropertyManager.

Definition at line 239 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::asJson(), and Mantid::API::Algorithm::toJson().

◆ asString()

std::string Mantid::Kernel::PropertyManagerOwner::asString ( bool  withDefaultValues = false) const
overridevirtual

Return the property manager serialized as a string.

The format is propName=value,propName=value,propName=value

Parameters
withDefaultValues:: If true then the value of default parameters will be included
Returns
A stringized version of the manager

Implements Mantid::Kernel::IPropertyManager.

Definition at line 230 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::asString().

◆ clear()

void Mantid::Kernel::PropertyManagerOwner::clear ( )
overridevirtual

Clears all properties under management.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 264 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::clear().

◆ copyPropertiesFrom()

virtual void Mantid::Kernel::PropertyManagerOwner::copyPropertiesFrom ( const PropertyManagerOwner po)
inlinevirtual

Make m_properties point to the same PropertyManager as po.

Definition at line 67 of file PropertyManagerOwner.h.

◆ declareOrReplaceProperty()

void Mantid::Kernel::PropertyManagerOwner::declareOrReplaceProperty ( std::unique_ptr< Property p,
const std::string &  doc = "" 
)
overridevirtual

Add or replace property in the list of managed properties.

Parameters
p:: The property object to add
doc:: A description of the property that may be displayed to users

Implements Mantid::Kernel::IPropertyManager.

Definition at line 49 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::declareOrReplaceProperty().

◆ declareProperty() [1/8]

void Mantid::Kernel::IPropertyManager::declareProperty ( const std::string &  name,
const char *  value,
const std::string &  doc,
IValidator_sptr  validator = std::make_shared<NullValidator>(),
const unsigned int  direction = Direction::Input 
)
inline

Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string).

The validator, if provided, needs to be a string validator.

Parameters
name:: The name to assign to the property
value:: The initial value to assign to the property
doc:: The (optional) documentation string
validator:: Pointer to the (optional) validator. Ownership will be taken over.
direction:: The (optional) direction of the property, in, out or inout
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the name argument is empty
std::invalid_argumentif value is a nullptr

Definition at line 165 of file IPropertyManager.h.

◆ declareProperty() [2/8]

void Mantid::Kernel::IPropertyManager::declareProperty ( const std::string &  name,
const char *  value,
const unsigned int  direction 
)
inline

Add a property of string type to the list of managed properties.

Parameters
name:: The name to assign to the property
value:: The initial value to assign to the property
direction:: The direction of the property, in, out or inout
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the name argument is empty

Definition at line 182 of file IPropertyManager.h.

◆ declareProperty() [3/8]

void Mantid::Kernel::IPropertyManager::declareProperty ( const std::string &  name,
const char *  value,
IValidator_sptr  validator = std::make_shared<NullValidator>(),
const std::string &  doc = std::string(),
const unsigned int  direction = Direction::Input 
)
inline

Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string).

The validator, if provided, needs to be a string validator.

Parameters
name:: The name to assign to the property
value:: The initial value to assign to the property
validator:: Pointer to the (optional) validator. Ownership will be taken over.
doc:: The (optional) documentation string
direction:: The (optional) direction of the property, in, out or inout
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the name argument is empty
std::invalid_argumentif value is a nullptr

Definition at line 136 of file IPropertyManager.h.

◆ declareProperty() [4/8]

template<typename T >
void Mantid::Kernel::IPropertyManager::declareProperty ( const std::string &  name,
value,
const std::string &  doc,
const unsigned int  direction = Direction::Input 
)
inline

Add a property to the list of managed properties with no validator.

Parameters
name:: The name to assign to the property
value:: The initial value to assign to the property
doc:: The documentation string
direction:: The (optional) direction of the property, in (default), out or inout
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the name argument is empty

Definition at line 97 of file IPropertyManager.h.

◆ declareProperty() [5/8]

template<typename T >
void Mantid::Kernel::IPropertyManager::declareProperty ( const std::string &  name,
value,
const unsigned int  direction 
)
inline

Add a property of the template type to the list of managed properties.

Parameters
name:: The name to assign to the property
value:: The initial value to assign to the property
direction:: The direction of the property, in, out or inout
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the name argument is empty

Definition at line 112 of file IPropertyManager.h.

◆ declareProperty() [6/8]

template<typename T >
void Mantid::Kernel::IPropertyManager::declareProperty ( const std::string &  name,
value,
IValidator_sptr  validator = std::make_shared<NullValidator>(),
const std::string &  doc = "",
const unsigned int  direction = Direction::Input 
)
inline

Add a property of the template type to the list of managed properties.

Parameters
name:: The name to assign to the property
value:: The initial value to assign to the property
validator:: Pointer to the (optional) validator.
doc:: The (optional) documentation string
direction:: The (optional) direction of the property, in, out or inout
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the name argument is empty

Definition at line 80 of file IPropertyManager.h.

◆ declareProperty() [7/8]

void Mantid::Kernel::PropertyManagerOwner::declareProperty ( std::unique_ptr< Property p,
const std::string &  doc = "" 
)
overridevirtual

Add a property to the list of managed properties.

Parameters
p:: The property object to add
doc:: A description of the property that may be displayed to users
Exceptions
Exception::ExistsErrorif a property with the given name already exists

Implements Mantid::Kernel::IPropertyManager.

Definition at line 41 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::declareProperty().

◆ declareProperty() [8/8]

virtual void Mantid::Kernel::IPropertyManager::declareProperty ( std::unique_ptr< Property p,
const std::string &  doc = "" 
)
virtual

Function to declare properties (i.e. store them)

Implements Mantid::Kernel::IPropertyManager.

◆ existsProperty()

bool Mantid::Kernel::PropertyManagerOwner::existsProperty ( const std::string &  name) const
overridevirtual

Checks whether the named property is already in the list of managed property.

Parameters
name:: The name of the property (case insensitive)
Returns
True if the property is already stored

Implements Mantid::Kernel::IPropertyManager.

Definition at line 136 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::existsProperty().

◆ filterByProperty()

void Mantid::Kernel::PropertyManagerOwner::filterByProperty ( const TimeSeriesProperty< bool > &  ,
const std::vector< std::string > &   
)
inlineoverridevirtual

Implements Mantid::Kernel::IPropertyManager.

Definition at line 107 of file PropertyManagerOwner.h.

◆ filterByTime()

void Mantid::Kernel::PropertyManagerOwner::filterByTime ( const Types::Core::DateAndTime &  ,
const Types::Core::DateAndTime &   
)
inlineoverridevirtual

Implements Mantid::Kernel::IPropertyManager.

Definition at line 99 of file PropertyManagerOwner.h.

◆ getDeclaredPropertyNames()

std::vector< std::string > Mantid::Kernel::PropertyManagerOwner::getDeclaredPropertyNames ( ) const
overridevirtualnoexcept

Return the list of declared property names.

Returns
A vector holding strings of property names

Implements Mantid::Kernel::IPropertyManager.

Definition at line 186 of file PropertyManagerOwner.cpp.

References getProperties().

Referenced by Mantid::API::Algorithm::getDeclaredPropertyNames().

◆ getPointerToProperty()

Property * Mantid::Kernel::PropertyManagerOwner::getPointerToProperty ( const std::string &  name) const
overridevirtual

Get a property by name.

Parameters
name:: The name of the property (case insensitive)
Returns
A pointer to the named property
Exceptions
Exception::NotFoundErrorif the named property is unknown

Implements Mantid::Kernel::IPropertyManager.

Definition at line 163 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::getPointerToProperty(), and Mantid::API::Algorithm::isDefault().

◆ getPointerToPropertyOrdinal()

Property * Mantid::Kernel::PropertyManagerOwner::getPointerToPropertyOrdinal ( const int &  index) const
overridevirtual

Get a property by an index.

Parameters
index:: The name of the property (case insensitive)
Returns
A pointer to the named property
Exceptions
std::runtime_errorif the property index is too high

Implements Mantid::Kernel::IPropertyManager.

Definition at line 172 of file PropertyManagerOwner.cpp.

References index, and m_properties.

Referenced by Mantid::API::Algorithm::getPointerToPropertyOrdinal(), and Mantid::API::Algorithm::setPropertyOrdinal().

◆ getProperties()

const std::vector< Property * > & Mantid::Kernel::PropertyManagerOwner::getProperties ( ) const
overridevirtual

Get the list of managed properties.

The properties will be stored in the order that they were declared.

Returns
A vector holding pointers to the list of properties

Implements Mantid::Kernel::IPropertyManager.

Definition at line 180 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by getDeclaredPropertyNames(), and Mantid::API::Algorithm::getProperties().

◆ getProperty()

IPropertyManager::TypedValue Mantid::Kernel::PropertyManagerOwner::getProperty ( const std::string &  name) const
overridevirtual

Get the value of a property.

Allows you to assign directly to a variable of the property's type (if a supported type).

*** This method does NOT work for assigning to an existing std::string. In this case you have to use getPropertyValue() instead. Note that you can, though, construct a local string variable by writing, e.g. std::string s = getProperty("myProperty"). ***

Parameters
name:: The name of the property
Returns
The value of the property. Will be cast to the desired type (if a supported type).
Exceptions
std::runtime_errorIf an attempt is made to assign a property to a different type
Exception::NotFoundErrorIf the property requested does not exist

Implements Mantid::Kernel::IPropertyManager.

Definition at line 211 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::getProperty().

◆ getPropertyValue()

std::string Mantid::Kernel::PropertyManagerOwner::getPropertyValue ( const std::string &  name) const
overridevirtual

Get the value of a property as a string.

Parameters
name:: The name of the property (case insensitive)
Returns
The value of the named property
Exceptions
Exception::NotFoundErrorif the named property is unknown

Implements Mantid::Kernel::IPropertyManager.

Definition at line 154 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::getPropertyValue().

◆ isDefault()

bool Mantid::Kernel::PropertyManagerOwner::isDefault ( const std::string &  name) const
Parameters
name
Returns
True if the property is its default value.

Definition at line 219 of file PropertyManagerOwner.cpp.

References m_properties.

◆ operator=()

PropertyManagerOwner & Mantid::Kernel::PropertyManagerOwner::operator= ( const PropertyManagerOwner po)

Assignment operator.

Definition at line 30 of file PropertyManagerOwner.cpp.

References m_properties.

◆ propertyCount()

size_t Mantid::Kernel::PropertyManagerOwner::propertyCount ( ) const
overridevirtual

Count the number of properties under management.

Returns
The number of properties being managed

Implements Mantid::Kernel::IPropertyManager.

Definition at line 147 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::propertyCount().

◆ removeProperty()

void Mantid::Kernel::PropertyManagerOwner::removeProperty ( const std::string &  name,
const bool  delproperty = true 
)
overridevirtual

Removes the property from management.

Removes the property from properties map.

Parameters
name:: Name of the property to be removed.
delproperty:: if true, delete the named property

Implements Mantid::Kernel::IPropertyManager.

Definition at line 248 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::removeProperty().

◆ resetProperties()

void Mantid::Kernel::PropertyManagerOwner::resetProperties ( )
overridevirtual

Reset property values back to initial values (blank or default values)

Implements Mantid::Kernel::IPropertyManager.

Definition at line 55 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::resetProperties().

◆ setProperties() [1/2]

void Mantid::Kernel::PropertyManagerOwner::setProperties ( const ::Json::Value &  jsonValue,
const std::unordered_set< std::string > &  ignoreProperties = std::unordered_set<std::string>(),
bool  createMissing = false 
)
overridevirtual

Sets all the declared properties from a json object.

Parameters
jsonValue:: A json name value pair collection
ignoreProperties:: A set of names of any properties NOT to set from the propertiesArray
createMissing:: If the property does not exist then create it

Implements Mantid::Kernel::IPropertyManager.

Definition at line 79 of file PropertyManagerOwner.cpp.

References m_properties.

◆ setProperties() [2/2]

void Mantid::Kernel::PropertyManagerOwner::setProperties ( const std::string &  propertiesJson,
const std::unordered_set< std::string > &  ignoreProperties = std::unordered_set<std::string>(),
bool  createMissing = false 
)
overridevirtual

Set the ordered list of properties by one string of values, separated by semicolons.

The string should be a json formatted collection of name value pairs

Parameters
propertiesJson:: The string of property values
ignoreProperties:: A set of names of any properties NOT to set from the propertiesArray
createMissing:: If the property does not exist then create it
Exceptions
invalid_argumentif error in parameters

Implements Mantid::Kernel::IPropertyManager.

Definition at line 68 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::setProperties().

◆ setPropertiesWithString()

void Mantid::Kernel::PropertyManagerOwner::setPropertiesWithString ( const std::string &  propertiesString,
const std::unordered_set< std::string > &  ignoreProperties = std::unordered_set<std::string>() 
)
overridevirtual

Sets all the declared properties from a string.

Parameters
propertiesString:: A list of name = value pairs separated by a semicolon
ignoreProperties:: A set of names of any properties NOT to set from the propertiesArray

Implements Mantid::Kernel::IPropertyManager.

Definition at line 90 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::setPropertiesWithString().

◆ setPropertyOrdinal()

void Mantid::Kernel::PropertyManagerOwner::setPropertyOrdinal ( const int &  index,
const std::string &  value 
)
overridevirtual

Set the value of a property by an index N.B.

bool properties must be set using 1/0 rather than true/false

Parameters
index:: The index of the property to assign
value:: The value to assign to the property
Exceptions
std::runtime_errorif the property index is too high

Implements Mantid::Kernel::IPropertyManager.

Definition at line 126 of file PropertyManagerOwner.cpp.

References afterPropertySet(), index, m_properties, and value.

Referenced by Mantid::API::Algorithm::setPropertyOrdinal().

◆ setPropertyValue()

void Mantid::Kernel::PropertyManagerOwner::setPropertyValue ( const std::string &  name,
const std::string &  value 
)
overridevirtual

Set the value of a property by string N.B.

bool properties must be set using 1/0 rather than true/false

Parameters
name:: The name of the property (case insensitive)
value:: The value to assign to the property
Exceptions
Exception::NotFoundErrorif the named property is unknown
std::invalid_argumentIf the value is not valid for the property given

Implements Mantid::Kernel::IPropertyManager.

Definition at line 103 of file PropertyManagerOwner.cpp.

References afterPropertySet(), m_properties, and value.

Referenced by Mantid::API::Algorithm::setPropertyValue().

◆ setPropertyValueFromJson()

void Mantid::Kernel::PropertyManagerOwner::setPropertyValueFromJson ( const std::string &  name,
const Json::Value &  value 
)
overridevirtual

Set the value of a property by Json::Value object.

Parameters
name:: The name of the property (case insensitive)
value:: The value to assign to the property
Exceptions
Exception::NotFoundErrorif the named property is unknown
std::invalid_argumentIf the value is not valid for the property given

Implements Mantid::Kernel::IPropertyManager.

Definition at line 115 of file PropertyManagerOwner.cpp.

References afterPropertySet(), m_properties, and value.

Referenced by Mantid::API::Algorithm::setPropertyValueFromJson().

◆ splitByTime()

void Mantid::Kernel::PropertyManagerOwner::splitByTime ( std::vector< SplittingInterval > &  ,
std::vector< PropertyManager * >   
) const
inlineoverridevirtual

Implements Mantid::Kernel::IPropertyManager.

Definition at line 102 of file PropertyManagerOwner.h.

◆ takeProperty()

std::unique_ptr< Property > Mantid::Kernel::PropertyManagerOwner::takeProperty ( const size_t  index)
overridevirtual

Removes the property from management returning a pointer to it.

Removes a property from the properties map by index and return a pointer to it.

Parameters
index:: index of the property to be removed
Returns
:: pointer to the removed property if found, NULL otherwise

Implements Mantid::Kernel::IPropertyManager.

Definition at line 257 of file PropertyManagerOwner.cpp.

References index, and m_properties.

Referenced by Mantid::API::Algorithm::takeProperty().

◆ validateProperties()

bool Mantid::Kernel::PropertyManagerOwner::validateProperties ( ) const
overridevirtual

Validates all the properties in the collection.

Returns
True if all properties have a valid value

Implements Mantid::Kernel::IPropertyManager.

Definition at line 141 of file PropertyManagerOwner.cpp.

References m_properties.

Referenced by Mantid::API::Algorithm::validateProperties().

Member Data Documentation

◆ m_properties

std::shared_ptr<PropertyManager> Mantid::Kernel::PropertyManagerOwner::m_properties
private

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