Mantid
Loading...
Searching...
No Matches
PropertyHistory.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 "MantidKernel/DllConfig.h"
13
14#include <memory>
15
16#include <iosfwd>
17#include <string>
18#include <vector>
19
20namespace Mantid {
21namespace Kernel {
22//----------------------------------------------------------------------
23// Forward Declaration
24//----------------------------------------------------------------------
25class Property;
26
34class MANTID_KERNEL_DLL PropertyHistory {
35public:
36 PropertyHistory(std::string name, std::string value, std::string type, const bool isdefault,
37 const unsigned int direction = 99, const bool pythonVariable = false);
38
40 PropertyHistory(Property const *const prop);
42 virtual ~PropertyHistory() = default;
44 const std::string &name() const { return m_name; };
46 const std::string &value() const { return m_value; };
48 void setValue(const std::string &value) { m_value = value; };
50 const std::string &type() const { return m_type; };
52 bool isDefault() const { return m_isDefault; };
54 unsigned int direction() const { return m_direction; };
56 void printSelf(std::ostream &, const int indent = 0, const size_t maxPropertyLength = 0) const;
59 bool isEmptyDefault() const;
60 bool pythonVariable() const { return m_pythonVariable; };
61
63 bool operator==(const PropertyHistory &other) const {
64 return name() == other.name() && value() == other.value() && type() == other.type() &&
65 isDefault() == other.isDefault();
66 }
67
68private:
70 std::string m_name;
72 std::string m_value;
74 std::string m_type;
78 unsigned int m_direction;
81};
82
83// typedefs for property history pointers
84using PropertyHistory_sptr = std::shared_ptr<PropertyHistory>;
85using PropertyHistory_const_sptr = std::shared_ptr<const PropertyHistory>;
86using PropertyHistories = std::vector<PropertyHistory_sptr>;
87
88MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const PropertyHistory &);
89
90} // namespace Kernel
91} // namespace Mantid
const std::string & m_value
Definition Algorithm.cpp:71
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
This class stores information about the parameters used by an algorithm.
unsigned int direction() const
get direction flag of algorithm parameter const
const std::string & name() const
get name of algorithm parameter const
void setValue(const std::string &value)
set value of algorithm parameter
const std::string & value() const
get value of algorithm parameter const
virtual ~PropertyHistory()=default
destructor
bool m_isDefault
flag defining if the parameter is a default or a user-defined parameter
bool isDefault() const
get isdefault flag of algorithm parameter const
std::string m_name
The name of the parameter.
const std::string & type() const
get type of algorithm parameter const
std::string m_value
The value of the parameter.
std::string m_type
The type of the parameter.
unsigned int m_direction
direction of parameter
bool m_pythonVariable
Whether the property should be treated as a python variable instead of string when building a script ...
bool operator==(const PropertyHistory &other) const
this is required for boost.python
Base class for properties.
Definition Property.h:94
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
Definition CPUTimer.cpp:86
std::shared_ptr< const PropertyHistory > PropertyHistory_const_sptr
std::shared_ptr< PropertyHistory > PropertyHistory_sptr
std::vector< PropertyHistory_sptr > PropertyHistories
Helper class which provides the Collimation Length for SANS instruments.