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);
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
62 bool operator==(const PropertyHistory &other) const {
63 return name() == other.name() && value() == other.value() && type() == other.type() &&
64 isDefault() == other.isDefault();
65 }
66
67private:
69 std::string m_name;
71 std::string m_value;
73 std::string m_type;
77 unsigned int m_direction;
78};
79
80// typedefs for property history pointers
81using PropertyHistory_sptr = std::shared_ptr<PropertyHistory>;
82using PropertyHistory_const_sptr = std::shared_ptr<const PropertyHistory>;
83using PropertyHistories = std::vector<PropertyHistory_sptr>;
84
85MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const PropertyHistory &);
86
87} // namespace Kernel
88} // namespace Mantid
const std::string & m_value
Definition: Algorithm.cpp:71
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 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.