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
99 void filterByTime(const Types::Core::DateAndTime & /*start*/, const Types::Core::DateAndTime & /*stop*/) override {
100 throw(std::runtime_error("Not yet implmented"));
101 }
102 void splitByTime(std::vector<SplittingInterval> & /*splitter*/,
103 std::vector<PropertyManager *> /* outputs*/) const override {
104 throw(std::runtime_error("Not yet implmented"));
105 }
106
107 void filterByProperty(const TimeSeriesProperty<bool> & /*filter*/, const std::vector<std::string> &
108 /* excludedFromFiltering */) override {
109 throw(std::runtime_error("Not yet implmented"));
110 }
111
112public:
113 Property *getPointerToProperty(const std::string &name) const override;
114 Property *getPointerToPropertyOrdinal(const int &index) const override;
115
116private:
118 std::shared_ptr<PropertyManager> m_properties;
119};
120
121} // namespace Kernel
122} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Interface to PropertyManager.
Kernel/PropertyManagerOwner.h.
void splitByTime(std::vector< SplittingInterval > &, std::vector< PropertyManager * >) const override
std::shared_ptr< PropertyManager > m_properties
Shared pointer to the 'real' property manager.
virtual void copyPropertiesFrom(const PropertyManagerOwner &po)
Make m_properties point to the same PropertyManager as po.
void filterByProperty(const TimeSeriesProperty< bool > &, const std::vector< std::string > &) override
Base class for properties.
Definition: Property.h:94
A specialised Property class for holding a series of time-value pairs.
Definition: Algorithm.h:38
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.