Mantid
Loading...
Searching...
No Matches
MaskedProperty.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
9
10// PropertyWithValue implementation
12#include "MantidKernel/PropertyWithValue.tcc"
13
14namespace Mantid::Kernel {
15
23template <typename TYPE>
24MaskedProperty<TYPE>::MaskedProperty(std::string name, TYPE defaultvalue, IValidator_sptr validator,
25 const unsigned int direction)
26 : Kernel::PropertyWithValue<TYPE>(std::move(name), std::move(defaultvalue), std::move(validator), direction),
27 m_maskedValue("") {
28 this->setRemember(false);
29}
30
37template <typename TYPE>
38MaskedProperty<TYPE>::MaskedProperty(std::string name, TYPE defaultvalue, const unsigned int direction)
39 : Kernel::PropertyWithValue<TYPE>(std::move(name), std::move(defaultvalue), direction), m_maskedValue("") {
40 this->setRemember(false);
41}
42
46template <typename TYPE> MaskedProperty<TYPE> *MaskedProperty<TYPE>::clone() const {
47 return new MaskedProperty<TYPE>(*this);
48}
49
53template <typename TYPE> const Kernel::PropertyHistory MaskedProperty<TYPE>::createHistory() const {
54 return Kernel::PropertyHistory(this->name(), this->getMaskedValue(), this->type(), this->isDefault(),
56}
57
60template <typename TYPE> TYPE MaskedProperty<TYPE>::getMaskedValue() const {
61 doMasking();
62 return m_maskedValue;
63}
64
65//---------------------------------------------------------------------------
66// Private methods
67//---------------------------------------------------------------------------
68
72template <typename TYPE> void MaskedProperty<TYPE>::doMasking() const {
73 TYPE value(this->value());
74 m_maskedValue = std::string(value.size(), '*');
75}
76
77//---------------------------------------------------------------------------
78// Template Instantiations
79//---------------------------------------------------------------------------
80
82template class MANTID_KERNEL_DLL Mantid::Kernel::MaskedProperty<std::string>;
84
85} // namespace Mantid::Kernel
double value
The value of the point.
Definition: FitMW.cpp:51
A property class for masking the properties.
const Kernel::PropertyHistory createHistory() const override
Mask out the out the value in the history.
void doMasking() const
Perform the actual masking.
MaskedProperty(std::string name, TYPE defaultvalue, IValidator_sptr validator=IValidator_sptr(new NullValidator), const unsigned int direction=Direction::Input)
Constructor with a validator.
MaskedProperty * clone() const override
"virtual" copy constructor
TYPE getMaskedValue() const
This method returns the masked property value.
This class stores information about the parameters used by an algorithm.
The concrete, templated class for properties.
void setRemember(bool)
Set wheter to remeber this property input.
Definition: Property.cpp:115
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26
STL namespace.