Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Mantid::Kernel::PropertyManager Class Reference

Property manager helper class. More...

#include <PropertyManager.h>

Inheritance diagram for Mantid::Kernel::PropertyManager:
Mantid::Kernel::IPropertyManager Mantid::API::IFuncMinimizer Mantid::API::ILiveListener Mantid::Geometry::BraggScatterer MantidQt::API::AlgorithmRuntimeProps Mantid::CurveFitting::FuncMinimisers::DampedGaussNewtonMinimizer Mantid::CurveFitting::FuncMinimisers::DerivMinimizer Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMDMinimizer Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMinimizer Mantid::CurveFitting::FuncMinimisers::SimplexMinimizer Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer Mantid::API::LiveListener Mantid::Geometry::BraggScattererInCrystalStructure Mantid::Geometry::CompositeBraggScatterer

Public Member Functions

::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 the whole property map. More...
 
void declareOrReplaceProperty (std::unique_ptr< Property > p, const std::string &doc="") override
 Add or replace a 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 > &filter, const std::vector< std::string > &excludedFromFiltering=std::vector< std::string >()) override
 Filter the managed properties by the given boolean property mask. More...
 
void filterByTime (const Types::Core::DateAndTime &start, const Types::Core::DateAndTime &stop) override
 Filter out a run by time. More...
 
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...
 
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 operator!= (const PropertyManager &other) const
 
PropertyManageroperator+= (const PropertyManager &rhs)
 Addition operator. More...
 
PropertyManageroperator= (const PropertyManager &)
 Assignment operator - performs a deep copy. More...
 
bool operator== (const PropertyManager &other) const
 
size_t propertyCount () const override
 Count the number of properties under management. More...
 
 PropertyManager ()
 Default constructor. More...
 
 PropertyManager (const PropertyManager &)
 copy constructor More...
 
void removeProperty (const std::string &name, const bool delproperty=true) override
 removes the property from properties map 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
 Set the ordered list of properties by a json value collection. More...
 
void setProperties (const ::Json::Value &jsonValue, IPropertyManager *targetPropertyManager, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false)
 Set the ordered list of properties by a json value collection. 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 setProperties (const std::string &propertiesJson, IPropertyManager *targetPropertyManager, const std::unordered_set< std::string > &ignoreProperties, bool createMissing=false)
 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. More...
 
void splitByTime (std::vector< SplittingInterval > &splitter, std::vector< PropertyManager * > outputs) const override
 Split a run by time (splits the TimeSeriesProperties contained). More...
 
std::unique_ptr< PropertytakeProperty (const size_t index) override
 removes the property from the properties map and returns a pointer to it More...
 
bool validateProperties () const override
 Validates all the properties in the collection. More...
 
virtual ~PropertyManager () override
 Virtual destructor. 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
 

Static Public Member Functions

static std::string getInvalidValuesFilterLogName (const std::string &logName)
 Gets the correct log name for the matching invalid values log for a given log name. More...
 
static std::string getLogNameFromInvalidValuesFilter (const std::string &logName)
 
static bool isAnInvalidValuesFilterLog (const std::string &logName)
 

Static Public Attributes

static const std::string INVALID_VALUES_SUFFIX = "_invalid_values"
 

Protected Member Functions

PropertygetPointerToPropertyOrdinal (const int &index) const override
 Get a property by an index. More...
 
PropertygetPointerToPropertyOrNull (const std::string &name) const
 Get a property by name. More...
 
- 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
 

Private Types

using PropertyMap = std::map< std::string, std::unique_ptr< Property > >
 typedef for the map holding the properties More...
 

Private Member Functions

void setPropertiesWithJSONString (const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties)
 Sets all the declared properties from a string. More...
 
void setPropertiesWithSimpleString (const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties)
 Sets all the declared properties from a string. More...
 

Private Attributes

std::vector< Property * > m_orderedProperties
 Stores the order in which the properties were declared. More...
 
PropertyMap m_properties
 The properties under management. More...
 

Friends

class PropertyManagerOwner
 

Detailed Description

Property manager helper class.

This class is used by algorithms and services for helping to manage their own set of properties.

N.B. ONCE YOU HAVE DECLARED A PROPERTY TO THE MANAGER IT IS OWNED BY THIS CLASS (declareProperty sinks the unique_ptr passed in.)

Property values of any type except std::string can be extracted using getProperty(). For assignment of string properties it is necessary to use getPropertyValue().

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

Definition at line 42 of file PropertyManager.h.

Member Typedef Documentation

◆ PropertyMap

using Mantid::Kernel::PropertyManager::PropertyMap = std::map<std::string, std::unique_ptr<Property> >
private

typedef for the map holding the properties

Definition at line 126 of file PropertyManager.h.

Constructor & Destructor Documentation

◆ PropertyManager() [1/2]

Mantid::Kernel::PropertyManager::PropertyManager ( )

Default constructor.

Definition at line 63 of file PropertyManager.cpp.

◆ PropertyManager() [2/2]

Mantid::Kernel::PropertyManager::PropertyManager ( const PropertyManager other)

copy constructor

Parameters
other:: the PropertyManager to copy

Definition at line 68 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

◆ ~PropertyManager()

Mantid::Kernel::PropertyManager::~PropertyManager ( )
overridevirtual

Virtual destructor.

Definition at line 98 of file PropertyManager.cpp.

References clear().

Member Function Documentation

◆ asJson()

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

Return the property manager serialized as a json object.

Note that this method does not serialize WorkspaceProperties with workspaces not in the ADS.

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

Implements Mantid::Kernel::IPropertyManager.

Definition at line 581 of file PropertyManager.cpp.

References count, getPointerToPropertyOrdinal(), Mantid::Kernel::Property::getSettings(), Mantid::Kernel::Property::isDefault(), Mantid::Kernel::IPropertySettings::isEnabled(), Mantid::Kernel::Property::isValueSerializable(), Mantid::Kernel::Property::name(), propertyCount(), and Mantid::Kernel::Property::valueAsJson().

Referenced by asString(), and Mantid::Kernel::encodeAsJson().

◆ asString()

std::string Mantid::Kernel::PropertyManager::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 serialized version of the manager

Implements Mantid::Kernel::IPropertyManager.

Definition at line 567 of file PropertyManager.cpp.

References asJson().

Referenced by Mantid::Geometry::CompositeBraggScatterer::clone(), and Mantid::Geometry::IsotropicAtomBraggScatterer::clone().

◆ clear()

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

Clears the whole property map.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 737 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

Referenced by ~PropertyManager().

◆ declareOrReplaceProperty()

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

Add or replace a property in the list of managed properties.

Parameters
p:: The property object to add (sinks the unique_ptr)
doc:: A description of the property that may be displayed to users
Exceptions
std::invalid_argumentif the property declared has an empty name.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 259 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

◆ 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::PropertyManager::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 (sinks the unique_ptr)
doc:: A description of the property that may be displayed to users
Exceptions
Exception::ExistsErrorif a property with the given name already exists
std::invalid_argumentif the property declared has an empty name.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 238 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

Referenced by Mantid::Geometry::BraggScattererInCrystalStructure::declareProperties(), Mantid::Geometry::IsotropicAtomBraggScatterer::declareScattererProperties(), Mantid::DataHandling::SetSample::exec(), Mantid::DataHandling::SetSample::materialSettingsEnsureLegacyCompatibility(), Mantid::API::Run::mergeMergables(), operator+=(), Mantid::Geometry::CompositeBraggScatterer::redeclareProperties(), and MantidQt::API::AlgorithmRuntimeProps::setPropertyValue().

◆ 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::PropertyManager::existsProperty ( const std::string &  name) const
overridevirtual

◆ filterByProperty()

void Mantid::Kernel::PropertyManager::filterByProperty ( const TimeSeriesProperty< bool > &  filter,
const std::vector< std::string > &  excludedFromFiltering = std::vector<std::string>() 
)
overridevirtual

Filter the managed properties by the given boolean property mask.

It replaces all time series properties with filtered time series properties

Parameters
filter:: A boolean time series to filter each property on
excludedFromFiltering:: A string list of properties that will be excluded from filtering

Implements Mantid::Kernel::IPropertyManager.

Definition at line 195 of file PropertyManager.cpp.

References existsProperty(), getInvalidValuesFilterLogName(), getPointerToProperty(), isAnInvalidValuesFilterLog(), m_orderedProperties, m_properties, and Mantid::Kernel::Property::name().

◆ filterByTime()

void Mantid::Kernel::PropertyManager::filterByTime ( const Types::Core::DateAndTime &  start,
const Types::Core::DateAndTime &  stop 
)
overridevirtual

Filter out a run by time.

Takes out any TimeSeriesProperty log entries outside of the given absolute time range.

Parameters
start:: Absolute start time. Any log entries at times >= to this time are kept.
stop:: Absolute stop time. Any log entries at times < than this time are kept.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 139 of file PropertyManager.cpp.

References m_properties.

◆ getDeclaredPropertyNames()

std::vector< std::string > Mantid::Kernel::PropertyManager::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 667 of file PropertyManager.cpp.

References getProperties().

◆ getInvalidValuesFilterLogName()

std::string Mantid::Kernel::PropertyManager::getInvalidValuesFilterLogName ( const std::string &  logName)
static

Gets the correct log name for the matching invalid values log for a given log name.

Definition at line 43 of file PropertyManager.cpp.

References INVALID_VALUES_SUFFIX.

Referenced by export_PropertyManager(), filterByProperty(), and Mantid::API::LogManager::getInvalidValuesFilterLogName().

◆ getLogNameFromInvalidValuesFilter()

std::string Mantid::Kernel::PropertyManager::getLogNameFromInvalidValuesFilter ( const std::string &  logName)
static

Definition at line 46 of file PropertyManager.cpp.

References INVALID_VALUES_SUFFIX, and isAnInvalidValuesFilterLog().

Referenced by export_PropertyManager().

◆ getPointerToProperty()

Property * Mantid::Kernel::PropertyManager::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 618 of file PropertyManager.cpp.

References m_properties.

Referenced by filterByProperty(), getPropertyValue(), operator+=(), removeProperty(), setPropertyValue(), and setPropertyValueFromJson().

◆ getPointerToPropertyOrdinal()

Property * Mantid::Kernel::PropertyManager::getPointerToPropertyOrdinal ( const int &  index) const
overrideprotectedvirtual

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 647 of file PropertyManager.cpp.

References index, and m_orderedProperties.

Referenced by asJson(), and setPropertyOrdinal().

◆ getPointerToPropertyOrNull()

Property * Mantid::Kernel::PropertyManager::getPointerToPropertyOrNull ( const std::string &  name) const
protected

Get a property by name.

Parameters
name:: The name of the property (case insensitive)
Returns
A pointer to the named property; NULL if not found

Definition at line 632 of file PropertyManager.cpp.

References m_properties.

Referenced by splitByTime().

◆ getProperties()

const std::vector< Property * > & Mantid::Kernel::PropertyManager::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 660 of file PropertyManager.cpp.

References m_orderedProperties.

Referenced by Mantid::CurveFitting::Algorithms::Fit::copyMinimizerOutput(), getDeclaredPropertyNames(), Mantid::Geometry::CompositeBraggScatterer::getPropertyCountMap(), Mantid::API::Run::mergeMergables(), and resetProperties().

◆ getProperty()

PropertyManager::TypedValue Mantid::Kernel::PropertyManager::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.

Reimplemented in MantidQt::API::AlgorithmRuntimeProps.

Definition at line 693 of file PropertyManager.cpp.

Referenced by Mantid::Geometry::BraggScattererInCrystalStructure::afterPropertySet(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::convergenceCheck(), Mantid::DataHandling::SetSample::createSphereXML(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::finalize(), Mantid::Geometry::IsotropicAtomBraggScatterer::getOccupancy(), MantidQt::API::AlgorithmRuntimeProps::getProperty(), Mantid::Geometry::IsotropicAtomBraggScatterer::getU(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::initChainsAndParameters(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::initialize(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::initSimulatedAnnealing(), Mantid::Geometry::BraggScatterer::isPropertyExposedToComposite(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMDMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::DampedGaussNewtonMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::jumpUpdate(), Mantid::DataHandling::SetSample::materialSettingsEnsureLegacyCompatibility(), Mantid::API::Run::mergeMergables(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::outputPDF(), and Mantid::DataHandling::SetSample::setMaterial().

◆ getPropertyValue()

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

◆ isAnInvalidValuesFilterLog()

bool Mantid::Kernel::PropertyManager::isAnInvalidValuesFilterLog ( const std::string &  logName)
static

◆ operator!=()

bool Mantid::Kernel::PropertyManager::operator!= ( const PropertyManager other) const

Definition at line 610 of file PropertyManager.cpp.

References operator==().

◆ operator+=()

PropertyManager & Mantid::Kernel::PropertyManager::operator+= ( const PropertyManager rhs)

Addition operator.

Parameters
rhs:: The object that is being added to this.
Returns
A reference to the summed object

Definition at line 106 of file PropertyManager.cpp.

References declareProperty(), getPointerToProperty(), and rhs.

◆ operator=()

PropertyManager & Mantid::Kernel::PropertyManager::operator= ( const PropertyManager other)

Assignment operator - performs a deep copy.

Parameters
other:: the PropertyManager to copy
Returns
pointer to this

Definition at line 82 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

◆ operator==()

bool Mantid::Kernel::PropertyManager::operator== ( const PropertyManager other) const

Definition at line 598 of file PropertyManager.cpp.

References m_properties, and value.

Referenced by operator!=().

◆ propertyCount()

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

Count the number of properties under management.

Returns
The number of properties being managed

Implements Mantid::Kernel::IPropertyManager.

Definition at line 546 of file PropertyManager.cpp.

References m_orderedProperties.

Referenced by asJson().

◆ removeProperty()

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

removes the property from properties map

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 702 of file PropertyManager.cpp.

References existsProperty(), getPointerToProperty(), m_orderedProperties, and m_properties.

Referenced by Mantid::Geometry::CompositeBraggScatterer::redeclareProperties().

◆ resetProperties()

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

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

Implements Mantid::Kernel::IPropertyManager.

Definition at line 280 of file PropertyManager.cpp.

References getProperties().

◆ setProperties() [1/4]

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

Set the ordered list of properties by a json value collection.

Parameters
jsonValue:: The jsonValue 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

Implements Mantid::Kernel::IPropertyManager.

Definition at line 335 of file PropertyManager.cpp.

References setProperties().

◆ setProperties() [2/4]

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

Set the ordered list of properties by a json value collection.

Parameters
jsonValue:: The jsonValue of property values
ignoreProperties:: A set of names of any properties NOT to set from the propertiesArray
targetPropertyManager:: the propertymanager to make the changes to, most of the time this will be *this
createMissing:: If the property does not exist then create it

Definition at line 350 of file PropertyManager.cpp.

References Mantid::Kernel::IPropertyManager::declareOrReplaceProperty(), Mantid::Kernel::decodeAsProperty(), Mantid::Kernel::IPropertyManager::setPropertyValue(), Mantid::Kernel::IPropertyManager::setPropertyValueFromJson(), and value.

◆ setProperties() [3/4]

void Mantid::Kernel::PropertyManager::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 299 of file PropertyManager.cpp.

References setProperties().

Referenced by setProperties(), setPropertiesWithJSONString(), and setPropertiesWithSimpleString().

◆ setProperties() [4/4]

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

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
targetPropertyManager:: the propertymanager to make the changes to, most of the time this will be *this
createMissing:: If the property does not exist then create it
Exceptions
invalid_argumentif error in parameters

Definition at line 317 of file PropertyManager.cpp.

References setProperties().

◆ setPropertiesWithJSONString()

void Mantid::Kernel::PropertyManager::setPropertiesWithJSONString ( const std::string &  propertiesString,
const std::unordered_set< std::string > &  ignoreProperties 
)
private

Sets all the declared properties from a string.

Parameters
propertiesString:: A JSON code string.
ignoreProperties:: A set of names of any properties NOT to set from the propertiesArray

Definition at line 405 of file PropertyManager.cpp.

References setProperties().

Referenced by setPropertiesWithString().

◆ setPropertiesWithSimpleString()

void Mantid::Kernel::PropertyManager::setPropertiesWithSimpleString ( const std::string &  propertiesString,
const std::unordered_set< std::string > &  ignoreProperties 
)
private

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

Definition at line 422 of file PropertyManager.cpp.

References n, setProperties(), Mantid::Kernel::StringTokenizer::TOK_TRIM, and value.

Referenced by setPropertiesWithString().

◆ setPropertiesWithString()

void Mantid::Kernel::PropertyManager::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:: Either a list of name = value pairs separated by a semicolon or a JSON code string.
ignoreProperties:: A set of names of any properties NOT to set from the propertiesArray

Implements Mantid::Kernel::IPropertyManager.

Definition at line 384 of file PropertyManager.cpp.

References setPropertiesWithJSONString(), and setPropertiesWithSimpleString().

◆ setPropertyOrdinal()

void Mantid::Kernel::PropertyManager::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
std::invalid_argumentIf the value is not valid for the property given

Implements Mantid::Kernel::IPropertyManager.

Definition at line 501 of file PropertyManager.cpp.

References Mantid::Kernel::IPropertyManager::afterPropertySet(), getPointerToPropertyOrdinal(), index, Mantid::Kernel::Property::name(), Mantid::Kernel::Property::setValue(), Mantid::Kernel::Property::type(), and value.

◆ setPropertyValue()

void Mantid::Kernel::PropertyManager::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.

Reimplemented in MantidQt::API::AlgorithmRuntimeProps.

Definition at line 463 of file PropertyManager.cpp.

References Mantid::Kernel::IPropertyManager::afterPropertySet(), getPointerToProperty(), and value.

Referenced by MantidQt::API::AlgorithmRuntimeProps::setPropertyValue().

◆ setPropertyValueFromJson()

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

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

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 481 of file PropertyManager.cpp.

References Mantid::Kernel::IPropertyManager::afterPropertySet(), getPointerToProperty(), and value.

◆ splitByTime()

void Mantid::Kernel::PropertyManager::splitByTime ( std::vector< SplittingInterval > &  splitter,
std::vector< PropertyManager * >  outputs 
) const
overridevirtual

Split a run by time (splits the TimeSeriesProperties contained).

Total proton charge will get re-integrated after filtering.

Parameters
splitter:: TimeSplitterType with the intervals and destinations.
outputs:: Vector of output runs.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 158 of file PropertyManager.cpp.

References getPointerToPropertyOrNull(), m_properties, n, Mantid::Kernel::Property::name(), and Mantid::Kernel::Property::splitByTime().

◆ takeProperty()

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

removes the property from the properties map and returns 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 720 of file PropertyManager.cpp.

References index, m_orderedProperties, and m_properties.

◆ validateProperties()

bool Mantid::Kernel::PropertyManager::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 527 of file PropertyManager.cpp.

References error, Mantid::Kernel::Logger::error(), Mantid::Kernel::DateAndTimeHelpers::g_log, and m_properties.

Friends And Related Function Documentation

◆ PropertyManagerOwner

friend class PropertyManagerOwner
friend

Definition at line 114 of file PropertyManager.h.

Member Data Documentation

◆ INVALID_VALUES_SUFFIX

const std::string Mantid::Kernel::PropertyManager::INVALID_VALUES_SUFFIX = "_invalid_values"
static

◆ m_orderedProperties

std::vector<Property *> Mantid::Kernel::PropertyManager::m_orderedProperties
private

◆ m_properties

PropertyMap Mantid::Kernel::PropertyManager::m_properties
private

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