Mantid
Loading...
Searching...
No Matches
Framework
Kernel
src
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 +
7
#include "
MantidKernel/MaskedProperty.h
"
8
#include "
MantidKernel/PropertyHistory.h
"
9
10
// PropertyWithValue implementation
11
#include "
MantidKernel/PropertyWithValue.h
"
12
#include "
MantidKernel/PropertyWithValue.hxx
"
13
14
namespace
Mantid::Kernel
{
15
23
template
<
typename
TYPE>
24
MaskedProperty<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
37
template
<
typename
TYPE>
38
MaskedProperty<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
46
template
<
typename
TYPE>
MaskedProperty<TYPE>
*
MaskedProperty<TYPE>::clone
()
const
{
47
return
new
MaskedProperty<TYPE>
(*
this
);
48
}
49
53
template
<
typename
TYPE>
const
Kernel::PropertyHistory
MaskedProperty<TYPE>::createHistory
()
const
{
54
return
Kernel::PropertyHistory
(this->
name
(), this->getMaskedValue(), this->type(), this->isDefault(),
55
Kernel::PropertyWithValue<TYPE>::direction
());
56
}
57
60
template
<
typename
TYPE>
TYPE
MaskedProperty<TYPE>::getMaskedValue
()
const
{
61
doMasking();
62
return
m_maskedValue;
63
}
64
65
//---------------------------------------------------------------------------
66
// Private methods
67
//---------------------------------------------------------------------------
68
72
template
<
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
82
template
class
MANTID_KERNEL_DLL
Mantid::Kernel::MaskedProperty<std::string>
;
84
85
}
// namespace Mantid::Kernel
name
std::string name
Definition
Run.cpp:60
value
double value
The value of the point.
Definition
FitMW.cpp:51
MaskedProperty.h
PropertyHistory.h
PropertyWithValue.h
PropertyWithValue.hxx
Mantid::Kernel::MaskedProperty
A property class for masking the properties.
Definition
MaskedProperty.h:27
Mantid::Kernel::MaskedProperty::createHistory
const Kernel::PropertyHistory createHistory() const override
Mask out the out the value in the history.
Definition
MaskedProperty.cpp:53
Mantid::Kernel::MaskedProperty::doMasking
void doMasking() const
Perform the actual masking.
Definition
MaskedProperty.cpp:72
Mantid::Kernel::MaskedProperty::clone
MaskedProperty * clone() const override
"virtual" copy constructor
Definition
MaskedProperty.cpp:46
Mantid::Kernel::MaskedProperty::MaskedProperty
MaskedProperty(std::string name, TYPE defaultvalue, IValidator_sptr validator=nullptr, const unsigned int direction=Direction::Input)
Constructor with a validator.
Definition
MaskedProperty.cpp:24
Mantid::Kernel::MaskedProperty::getMaskedValue
TYPE getMaskedValue() const
This method returns the masked property value.
Definition
MaskedProperty.cpp:60
Mantid::Kernel::PropertyHistory
This class stores information about the parameters used by an algorithm.
Definition
PropertyHistory.h:34
Mantid::Kernel::PropertyWithValue
The concrete, templated class for properties.
Definition
PropertyWithValue.h:35
Mantid::Kernel::Property::setRemember
void setRemember(bool)
Set wheter to remeber this property input.
Definition
Property.cpp:130
Mantid::DataHandling::TYPE
TYPE
Definition
PatchBBY.cpp:21
Mantid::Kernel
Definition
AnnularRingAbsorption.h:16
Mantid::Kernel::IValidator_sptr
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition
IValidator_fwd.h:17
std
STL namespace.
Generated by
1.9.8