Mantid
|
Property manager helper class. More...
#include <PropertyManager.h>
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... | |
Property * | getPointerToProperty (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 |
PropertyManager & | operator+= (const PropertyManager &rhs) |
Addition operator. More... | |
PropertyManager & | operator= (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< Property > | takeProperty (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 Property * | getPointerToProperty (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... | |
IPropertyManager * | setProperty (const std::string &name, const char *value) |
Specialised version of setProperty template method to handle const char *. More... | |
IPropertyManager * | setProperty (const std::string &name, const std::string &value) |
Specialised version of setProperty template method to handle std::string. More... | |
template<typename T > | |
IPropertyManager * | setProperty (const std::string &name, const T &value) |
Templated method to set the value of a PropertyWithValue. More... | |
template<typename T > | |
IPropertyManager * | setProperty (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< Property > | takeProperty (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 | |
Property * | getPointerToPropertyOrdinal (const int &index) const override |
Get a property by an index. More... | |
Property * | getPointerToPropertyOrNull (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 Property * | getPointerToPropertyOrdinal (const int &index) const =0 |
Get a property by an index. More... | |
template<typename T > | |
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 |
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().
Definition at line 42 of file PropertyManager.h.
|
private |
typedef for the map holding the properties
Definition at line 126 of file PropertyManager.h.
Mantid::Kernel::PropertyManager::PropertyManager | ( | ) |
Default constructor.
Definition at line 63 of file PropertyManager.cpp.
Mantid::Kernel::PropertyManager::PropertyManager | ( | const PropertyManager & | other | ) |
copy constructor
other | :: the PropertyManager to copy |
Definition at line 68 of file PropertyManager.cpp.
References m_orderedProperties, and m_properties.
|
overridevirtual |
|
overridevirtual |
Return the property manager serialized as a json object.
Note that this method does not serialize WorkspaceProperties with workspaces not in the ADS.
withDefaultValues | :: If true then the value of default parameters will be included |
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().
|
overridevirtual |
Return the property manager serialized as a string.
The format is propName=value,propName=value,propName=value
withDefaultValues | :: If true then the value of default parameters will be included |
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().
|
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().
|
overridevirtual |
Add or replace a property in the list of managed properties.
p | :: The property object to add (sinks the unique_ptr) |
doc | :: A description of the property that may be displayed to users |
std::invalid_argument | if 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.
|
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.
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 |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if the name argument is empty |
std::invalid_argument | if value is a nullptr |
Definition at line 165 of file IPropertyManager.h.
|
inline |
Add a property of string type to the list of managed properties.
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 |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if the name argument is empty |
Definition at line 182 of file IPropertyManager.h.
|
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.
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 |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if the name argument is empty |
std::invalid_argument | if value is a nullptr |
Definition at line 136 of file IPropertyManager.h.
|
inline |
Add a property to the list of managed properties with no validator.
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 |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if the name argument is empty |
Definition at line 97 of file IPropertyManager.h.
|
inline |
Add a property of the template type to the list of managed properties.
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 |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if the name argument is empty |
Definition at line 112 of file IPropertyManager.h.
|
inline |
Add a property of the template type to the list of managed properties.
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 |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if the name argument is empty |
Definition at line 80 of file IPropertyManager.h.
|
overridevirtual |
Add a property to the list of managed properties.
p | :: The property object to add (sinks the unique_ptr) |
doc | :: A description of the property that may be displayed to users |
Exception::ExistsError | if a property with the given name already exists |
std::invalid_argument | if 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().
|
virtual |
Function to declare properties (i.e. store them)
Implements Mantid::Kernel::IPropertyManager.
|
overridevirtual |
Checks whether the named property is already in the list of managed property.
name | :: The name of the property (case insensitive) |
Implements Mantid::Kernel::IPropertyManager.
Definition at line 517 of file PropertyManager.cpp.
References m_properties.
Referenced by Mantid::DataHandling::SetSample::createCylinderLikeXML(), Mantid::DataHandling::SetSample::createFlatPlateHolderXML(), Mantid::DataHandling::SetSample::createFlatPlateXML(), Mantid::DataHandling::SetSample::exec(), filterByProperty(), Mantid::DataHandling::SetSample::materialSettingsEnsureLegacyCompatibility(), Mantid::Geometry::CompositeBraggScatterer::redeclareProperties(), removeProperty(), Mantid::DataHandling::SetSample::setMaterial(), MantidQt::API::AlgorithmRuntimeProps::setPropertyValue(), and Mantid::DataHandling::SetSample::tryCreateXMLFromArgsOnly().
|
overridevirtual |
Filter the managed properties by the given boolean property mask.
It replaces all time series properties with filtered time series properties
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().
|
overridevirtual |
Filter out a run by time.
Takes out any TimeSeriesProperty log entries outside of the given absolute time range.
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.
|
overridevirtualnoexcept |
Return the list of declared property names.
Implements Mantid::Kernel::IPropertyManager.
Definition at line 667 of file PropertyManager.cpp.
References getProperties().
|
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().
|
static |
Definition at line 46 of file PropertyManager.cpp.
References INVALID_VALUES_SUFFIX, and isAnInvalidValuesFilterLog().
Referenced by export_PropertyManager().
|
overridevirtual |
Get a property by name.
name | :: The name of the property (case insensitive) |
Exception::NotFoundError | if 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().
|
overrideprotectedvirtual |
Get a property by an index.
index | :: The name of the property (case insensitive) |
std::runtime_error | if 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().
|
protected |
Get a property by name.
name | :: The name of the property (case insensitive) |
Definition at line 632 of file PropertyManager.cpp.
References m_properties.
Referenced by splitByTime().
|
overridevirtual |
Get the list of managed properties.
The properties will be stored in the order that they were declared.
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().
|
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"). ***
name | :: The name of the property |
std::runtime_error | If an attempt is made to assign a property to a different type |
Exception::NotFoundError | If 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().
|
overridevirtual |
Get the value of a property as a string.
name | :: The name of the property (case insensitive) |
Exception::NotFoundError | if the named property is unknown |
Implements Mantid::Kernel::IPropertyManager.
Definition at line 554 of file PropertyManager.cpp.
References getPointerToProperty(), and Mantid::Kernel::Property::value().
Referenced by Mantid::Geometry::IsotropicAtomBraggScatterer::afterScattererPropertySet(), Mantid::DataHandling::SetSample::createCylinderLikeXML(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::finalize(), Mantid::Geometry::CompositeBraggScatterer::propagateProperty(), Mantid::Geometry::CompositeBraggScatterer::redeclareProperties(), Mantid::DataHandling::SetSample::setMaterial(), Mantid::DataHandling::SetSample::tryCreateXMLFromArgsOnly(), and Mantid::DataHandling::SetSample::validateGeometry().
|
static |
Definition at line 53 of file PropertyManager.cpp.
References INVALID_VALUES_SUFFIX.
Referenced by export_PropertyManager(), filterByProperty(), and getLogNameFromInvalidValuesFilter().
bool Mantid::Kernel::PropertyManager::operator!= | ( | const PropertyManager & | other | ) | const |
Definition at line 610 of file PropertyManager.cpp.
References operator==().
PropertyManager & Mantid::Kernel::PropertyManager::operator+= | ( | const PropertyManager & | rhs | ) |
Addition operator.
rhs | :: The object that is being added to this. |
Definition at line 106 of file PropertyManager.cpp.
References declareProperty(), getPointerToProperty(), and rhs.
PropertyManager & Mantid::Kernel::PropertyManager::operator= | ( | const PropertyManager & | other | ) |
Assignment operator - performs a deep copy.
other | :: the PropertyManager to copy |
Definition at line 82 of file PropertyManager.cpp.
References m_orderedProperties, and m_properties.
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!=().
|
overridevirtual |
Count the number of properties under management.
Implements Mantid::Kernel::IPropertyManager.
Definition at line 546 of file PropertyManager.cpp.
References m_orderedProperties.
Referenced by asJson().
|
overridevirtual |
removes the property from properties map
Removes the property from properties map.
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().
|
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().
|
overridevirtual |
Set the ordered list of properties by a json value collection.
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().
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.
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.
|
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
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 |
invalid_argument | if error in parameters |
Implements Mantid::Kernel::IPropertyManager.
Definition at line 299 of file PropertyManager.cpp.
References setProperties().
Referenced by setProperties(), setPropertiesWithJSONString(), and setPropertiesWithSimpleString().
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
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 |
invalid_argument | if error in parameters |
Definition at line 317 of file PropertyManager.cpp.
References setProperties().
|
private |
Sets all the declared properties from a string.
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().
|
private |
Sets all the declared properties from a string.
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().
|
overridevirtual |
Sets all the declared properties from a string.
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().
|
overridevirtual |
Set the value of a property by an index N.B.
bool properties must be set using 1/0 rather than true/false
index | :: The index of the property to assign |
value | :: The value to assign to the property |
std::runtime_error | if the property index is too high |
std::invalid_argument | If 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.
|
overridevirtual |
Set the value of a property by string N.B.
bool properties must be set using 1/0 rather than true/false
name | :: The name of the property (case insensitive) |
value | :: The value to assign to the property |
Exception::NotFoundError | if the named property is unknown |
std::invalid_argument | If 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().
|
overridevirtual |
Set the value of a property by Json::Value.
name | :: The name of the property (case insensitive) |
value | :: The value to assign to the property |
Exception::NotFoundError | if the named property is unknown |
std::invalid_argument | If 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.
|
overridevirtual |
Split a run by time (splits the TimeSeriesProperties contained).
Total proton charge will get re-integrated after filtering.
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().
|
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.
index | :: index of the property to be removed |
Implements Mantid::Kernel::IPropertyManager.
Definition at line 720 of file PropertyManager.cpp.
References index, m_orderedProperties, and m_properties.
|
overridevirtual |
Validates all the properties in the collection.
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.
|
friend |
Definition at line 114 of file PropertyManager.h.
|
static |
Definition at line 44 of file PropertyManager.h.
Referenced by getInvalidValuesFilterLogName(), getLogNameFromInvalidValuesFilter(), and isAnInvalidValuesFilterLog().
|
private |
Stores the order in which the properties were declared.
Definition at line 130 of file PropertyManager.h.
Referenced by clear(), declareOrReplaceProperty(), declareProperty(), filterByProperty(), getPointerToPropertyOrdinal(), getProperties(), operator=(), propertyCount(), PropertyManager(), removeProperty(), and takeProperty().
|
private |
The properties under management.
Definition at line 128 of file PropertyManager.h.
Referenced by clear(), declareOrReplaceProperty(), declareProperty(), existsProperty(), filterByProperty(), filterByTime(), getPointerToProperty(), getPointerToPropertyOrNull(), operator=(), operator==(), PropertyManager(), removeProperty(), splitByTime(), takeProperty(), and validateProperties().