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::AlgorithmRuntimeProps Mantid::API::IFuncMinimizer Mantid::API::ILiveListener Mantid::Geometry::BraggScatterer 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.
 
std::string asString (bool withDefaultValues=false) const override
 Return the property manager serialized as a string.
 
void clear () override final
 Clears the whole property map.
 
PropertyManagercloneInTimeROI (const Kernel::TimeROI &timeROI)
 Create a partial copy of this object such that every time series property is cloned according to the input TimeROI.
 
void declareOrReplaceProperty (std::unique_ptr< Property > p, const std::string &doc="") override
 Add or replace a property in the list of managed properties.
 
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).
 
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.
 
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).
 
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.
 
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.
 
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.
 
void declareProperty (std::unique_ptr< Property > p, const std::string &doc="") override
 Add a property to the list of managed properties.
 
virtual void declareProperty (std::unique_ptr< Property > p, const std::string &doc="")=0
 Function to declare properties (i.e. store them)
 
bool existsProperty (const std::string &name) const override
 Checks whether the named property is already in the list of managed property.
 
void filterByProperty (Mantid::Kernel::LogFilter *logFilter, const std::vector< std::string > &excludedFromFiltering=std::vector< std::string >()) override
 Filter the managed properties by the given boolean property mask.
 
std::vector< std::string > getDeclaredPropertyNames () const noexcept override
 Return the list of declared property names.
 
PropertygetPointerToProperty (const std::string &name) const override
 Get a property by name.
 
const std::vector< Property * > & getProperties () const override
 Get the list of managed properties.
 
TypedValue getProperty (const std::string &name) const override
 Get the value of a property.
 
std::string getPropertyValue (const std::string &name) const override
 Get the value of a property as a string.
 
bool operator!= (const PropertyManager &other) const
 
PropertyManageroperator+= (const PropertyManager &rhs)
 Addition operator.
 
PropertyManageroperator= (const PropertyManager &)
 Assignment operator - performs a deep copy.
 
bool operator== (const PropertyManager &other) const
 
size_t propertyCount () const override
 Count the number of properties under management.
 
 PropertyManager ()
 Default constructor.
 
 PropertyManager (const PropertyManager &)
 copy constructor
 
void removeDataOutsideTimeROI (const Kernel::TimeROI &timeROI)
 For time series properties, remove time values outside of TimeROI regions, each defined as [roi_begin,roi_end].
 
void removeProperty (const std::string &name, const bool delproperty=true) override
 removes the property from properties map
 
void resetProperties () override
 Reset property values back to initial values (blank or default values)
 
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.
 
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.
 
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.
 
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.
 
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.
 
void setPropertyOrdinal (const int &index, const std::string &value) override
 Set the value of a property by an index N.B.
 
void setPropertyValue (const std::string &name, const std::string &value) override
 Set the value of a property by string N.B.
 
void setPropertyValueFromJson (const std::string &name, const Json::Value &value) override
 Set the value of a property by Json::Value.
 
std::unique_ptr< PropertytakeProperty (const size_t index) override
 removes the property from the properties map and returns a pointer to it
 
bool validateProperties () const override
 Validates all the properties in the collection.
 
virtual ~PropertyManager () override
 Virtual destructor.
 
- Public Member Functions inherited from Mantid::Kernel::IPropertyManager
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).
 
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.
 
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).
 
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.
 
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.
 
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.
 
std::vector< Property * > getPropertiesInGroup (const std::string &group) const
 Get the list of managed properties in a given group.
 
IPropertyManagersetProperty (const std::string &name, const char *value)
 Specialised version of setProperty template method to handle const char *.
 
IPropertyManagersetProperty (const std::string &name, const std::string &value)
 Specialised version of setProperty template method to handle std::string.
 
template<typename T >
IPropertyManagersetProperty (const std::string &name, const T &value)
 Templated method to set the value of a PropertyWithValue.
 
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.
 
void setPropertyGroup (const std::string &name, const std::string &group)
 Set the group for a given property.
 
void setPropertySettings (const std::string &name, std::unique_ptr< IPropertySettings > settings)
 
void updatePropertyValues (const IPropertyManager &other)
 Update values of the existing properties.
 
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.
 
static std::string getLogNameFromInvalidValuesFilter (const std::string &logName)
 
static bool isAnInvalidValuesFilterLog (const std::string &logName)
 Determine if the log's name has a substring indicating it should not be filtered.
 

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.
 
PropertygetPointerToPropertyOrNull (const std::string &name) const
 Get a property by name.
 
- 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.
 
template<typename T >
getValue (const std::string &name) const
 Templated method to get the value of a property.
 
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
 

Private Member Functions

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

Private Attributes

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

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 44 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 133 of file PropertyManager.h.

Constructor & Destructor Documentation

◆ PropertyManager() [1/2]

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

Default constructor.

Definition at line 65 of file PropertyManager.cpp.

Referenced by cloneInTimeROI().

◆ PropertyManager() [2/2]

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

copy constructor

Parameters
other:: the PropertyManager to copy

Definition at line 70 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

◆ ~PropertyManager()

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

Virtual destructor.

Definition at line 100 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 564 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 550 of file PropertyManager.cpp.

References asJson().

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

◆ clear()

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

Clears the whole property map.

Implements Mantid::Kernel::IPropertyManager.

Definition at line 720 of file PropertyManager.cpp.

References m_orderedProperties, and m_properties.

Referenced by operator=(), and ~PropertyManager().

◆ cloneInTimeROI()

PropertyManager * Mantid::Kernel::PropertyManager::cloneInTimeROI ( const Kernel::TimeROI timeROI)

Create a partial copy of this object such that every time series property is cloned according to the input TimeROI.

A partially cloned time series property should include all time values enclosed by the ROI regions, each defined as [roi_begin,roi_end], plus the values immediately before and after an ROI region, if available. Properties that are not time series will be cloned with no changes.

Parameters
timeROI:: time region of interest, i.e. time boundaries used to determine which time series values should be included in the copy.

Definition at line 185 of file PropertyManager.cpp.

References m_orderedProperties, m_properties, and 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 242 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 166 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 183 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 137 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 98 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 113 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 81 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 221 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 Mantid::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 ( Mantid::Kernel::LogFilter logFilter,
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
logFilter:: A LogFilter instance to filter each log on
excludedFromFiltering:: A string list of properties that will be excluded from filtering

Reimplemented from Mantid::Kernel::IPropertyManager.

Definition at line 138 of file PropertyManager.cpp.

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

◆ 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 650 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 601 of file PropertyManager.cpp.

References m_properties, and name.

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

References m_properties, and name.

◆ 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 643 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()

IPropertyManager::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.

Definition at line 676 of file PropertyManager.cpp.

References name.

Referenced by Mantid::Geometry::BraggScattererInCrystalStructure::afterPropertySet(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::convergenceCheck(), Mantid::DataHandling::SetSample::createSphereXML(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::finalize(), Mantid::Geometry::IsotropicAtomBraggScatterer::getOccupancy(), Mantid::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

Determine if the log's name has a substring indicating it should not be filtered.

Definition at line 55 of file PropertyManager.cpp.

References INVALID_VALUES_SUFFIX.

Referenced by export_PropertyManager(), filterByProperty(), and getLogNameFromInvalidValuesFilter().

◆ operator!=()

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

Definition at line 593 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 108 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 84 of file PropertyManager.cpp.

References clear(), m_orderedProperties, and m_properties.

◆ operator==()

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

Definition at line 581 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 529 of file PropertyManager.cpp.

References m_orderedProperties.

Referenced by asJson().

◆ removeDataOutsideTimeROI()

void Mantid::Kernel::PropertyManager::removeDataOutsideTimeROI ( const Kernel::TimeROI timeROI)

For time series properties, remove time values outside of TimeROI regions, each defined as [roi_begin,roi_end].

However, keep the values immediately before and after each ROI region, if available.

Parameters
timeROI:: a series of time regions used to determine which values to remove or to keep

Definition at line 206 of file PropertyManager.cpp.

References m_orderedProperties, and removeDataOutsideTimeROI().

Referenced by removeDataOutsideTimeROI().

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

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

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 263 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 318 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 333 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 282 of file PropertyManager.cpp.

References setProperties().

Referenced by setProperties(), setProperties(), 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 300 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 388 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 405 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 367 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 484 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.

Definition at line 446 of file PropertyManager.cpp.

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

Referenced by Mantid::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 464 of file PropertyManager.cpp.

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

◆ 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 703 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 510 of file PropertyManager.cpp.

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

Friends And Related Symbol Documentation

◆ PropertyManagerOwner

friend class PropertyManagerOwner
friend

Definition at line 121 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: