Mantid
Loading...
Searching...
No Matches
PropertyManagerOwner.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include <vector>
13
15
16namespace Mantid {
17namespace Kernel {
18//----------------------------------------------------------------------
19// Forward Declaration
20//----------------------------------------------------------------------
21class PropertyManager;
22
33class MANTID_KERNEL_DLL PropertyManagerOwner : virtual public IPropertyManager {
34public:
38
39 // Function to declare properties (i.e. store them)
40 void declareProperty(std::unique_ptr<Property> p, const std::string &doc = "") override;
41
42 // Function to declare properties (i.e. store them)
43 void declareOrReplaceProperty(std::unique_ptr<Property> p, const std::string &doc = "") override;
44 void resetProperties() override;
45 using IPropertyManager::declareProperty;
46
47 // Sets all the declared properties from
48 void setProperties(const std::string &propertiesJson,
49 const std::unordered_set<std::string> &ignoreProperties = std::unordered_set<std::string>(),
50 bool createMissing = false) override;
51
52 // Sets all the declared properties from a json object
53 void setProperties(const ::Json::Value &jsonValue,
54 const std::unordered_set<std::string> &ignoreProperties = std::unordered_set<std::string>(),
55 bool createMissing = false) override;
56
57 // sets all the declared properties using a simple string format
58 void setPropertiesWithString(
59 const std::string &propertiesString,
60 const std::unordered_set<std::string> &ignoreProperties = std::unordered_set<std::string>()) override;
61
62 void setPropertyValue(const std::string &name, const std::string &value) override;
63 void setPropertyValueFromJson(const std::string &name, const Json::Value &value) override;
64 void setPropertyOrdinal(const int &index, const std::string &value) override;
65
67 virtual void copyPropertiesFrom(const PropertyManagerOwner &po) { *this = po; }
68
69 bool existsProperty(const std::string &name) const override;
70 bool validateProperties() const override;
71 size_t propertyCount() const override;
72
73 std::string getPropertyValue(const std::string &name) const override;
74 const std::vector<Property *> &getProperties() const override;
75 std::vector<std::string> getDeclaredPropertyNames() const noexcept override;
76
78 TypedValue getProperty(const std::string &name) const override;
79
81 std::string asString(bool withDefaultValues = false) const override;
82
84 ::Json::Value asJson(bool withDefaultValues = false) const override;
85
86 bool isDefault(const std::string &name) const;
87
89 void removeProperty(const std::string &name, const bool delproperty = true) override;
91 std::unique_ptr<Property> takeProperty(const size_t index) override;
93 void clear() override;
97 void afterPropertySet(const std::string &) override;
98
99public:
100 Property *getPointerToProperty(const std::string &name) const override;
101 Property *getPointerToPropertyOrdinal(const int &index) const override;
102
103private:
105 std::shared_ptr<PropertyManager> m_properties;
106};
107
108} // namespace Kernel
109} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Interface to PropertyManager.
Kernel/PropertyManagerOwner.h.
virtual void copyPropertiesFrom(const PropertyManagerOwner &po)
Make m_properties point to the same PropertyManager as po.
Property manager helper class.
Base class for properties.
Definition Property.h:94
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.