casa
5.7.0-16
|
Templated class for storing Attributes which have a tolerance. More...
#include <AttValTol.h>
Public Member Functions | |
AttributeValueTol (const T &value, const T &tolerance, const casacore::Bool strict) | |
Constructor for a scalar, with specified scalar tolerance and strictness. More... | |
AttributeValueTol (const casacore::Vector< T > &value, const T &tolerance, const casacore::Bool strict) | |
Constructor for a casacore::Vector value, with specified scalar tolerance and strictness. More... | |
AttributeValueTol (const AttributeValueTol< T > &other) | |
Copy contructor. More... | |
virtual | ~AttributeValueTol () |
Destructor. More... | |
const AttributeValueTol< T > & | operator= (const AttributeValueTol< T > &other) |
Assignment operator. More... | |
virtual AttributeValueBase * | clone () const |
Return a new copy of the AttributeValueTol (virtual constructor). More... | |
virtual void | setTolerance (T value) |
Change or retrieve the scalar tolerance. More... | |
virtual T | getTolerance () const |
virtual casacore::String | className () const |
Return class name. More... | |
Public Member Functions inherited from casa::AttributeValue< T > | |
AttributeValue (const T &value, const casacore::Bool strict) | |
Construct from a scalar value. More... | |
AttributeValue (const casacore::Vector< T > &value, const casacore::Bool strict) | |
Construct from a casacore::Vector . More... | |
virtual | ~AttributeValue () |
Destructor. More... | |
AttributeValue (const AttributeValue< T > &other) | |
Copy constructor. More... | |
const AttributeValue< T > & | operator= (const AttributeValue< T > &other) |
Assignment (copy semantics) More... | |
virtual void | setValue (const T &value) |
Set/get the value of the AttributeValue. More... | |
virtual void | setValue (const casacore::Vector< T > &value) |
virtual casacore::Vector< T > | getValue () const |
virtual void | operator+= (const AttributeValueBase &other) |
Add other to *this . More... | |
virtual void | print (std::ostream &os) |
Public Member Functions inherited from casa::AttributeValueBase | |
AttributeValueBase (AttValue::ValueType type, casacore::Bool strict) | |
Constructor. More... | |
AttributeValueBase (const AttributeValueBase &other) | |
Copy constructor. More... | |
virtual | ~AttributeValueBase () |
Destructor. More... | |
const AttributeValueBase & | operator= (const AttributeValueBase &other) |
Copy assignment. More... | |
AttValue::ValueType | getType () const |
Get the type of the value stored. More... | |
casacore::Bool | operator== (const AttributeValueBase &other) const |
Check for equality (and inequality) of two objects derived from AttributeValueBase. More... | |
casacore::Bool | operator!= (const AttributeValueBase &other) const |
virtual void | setStrictness (const casacore::Bool &newStrict) |
Set/get the strictness state of this AttributeValue. More... | |
virtual casacore::Bool | getStrictness () const |
Protected Member Functions | |
virtual casacore::Bool | matches (const AttributeValueBase &other) const |
Implements when the values of two Attributes match, taking note of tolerance in this particular implementation. More... | |
Protected Member Functions inherited from casa::AttributeValue< T > | |
const AttributeValue< T > & | myCast (const AttributeValueBase &other) const |
Cast from Base class. More... | |
Protected Member Functions inherited from casa::AttributeValueBase | |
virtual void | setType (const AttValue::ValueType &newType) |
Set the type of the value stored. More... | |
casacore::Bool | myMatch (const AttributeValueBase &other) const |
Check that private data match. More... | |
Private Member Functions | |
casacore::Bool | myMatch (const AttributeValue< T > &other) const |
Does the actual matching. More... | |
AttributeValueTol () | |
Default constructor. More... | |
Private Attributes | |
T | itsValueTolerance |
The value of the tolerance. More... | |
Additional Inherited Members | |
Protected Attributes inherited from casa::AttributeValueBase | |
AttValue::ValueType | itsValueType |
The type of what is stored. More... | |
casacore::Bool | itsStrictness |
Whether the match is strict or not. More... | |
Templated class for storing Attributes which have a tolerance.
Public interface
"AttributeValueTol" is a contraction of "Attribute Value" and "Tolerance", and stores an Attribute which has associated with it some tolerance to be observed in matching with other Attributes.
An AttributeValueTol differs from a AttributeValue in that it has associated with it a certain tolerance, which will be observed when matching the value with other AttributeValues. This means that values do not have to match exactly in order for the AttributeValueTols to match. Tolerant matching is defined as abs(val1-val2) <= tolerance1
. Remember though that in general both Attributes must independently match each other for a match to exist, and so it is normally also a requirement that abs(val1 - val2) <= tolerance2
when the second Attribute also has tolerance specified.
then: Att1==Att2
returns true
, Att2==Att3
returns true
, but Att3==Att1
returns false
.
The motivation for this class is to be able to provide some in-built tolerance ("fuzziness") to AttributeValues. For example, this approach might be used in selecting channel maps to display when matching on radial velocity.
Definition at line 96 of file AttValTol.h.
casa::AttributeValueTol< T >::AttributeValueTol | ( | const T & | value, |
const T & | tolerance, | ||
const casacore::Bool | strict | ||
) |
Constructor for a scalar, with specified scalar tolerance and strictness.
casa::AttributeValueTol< T >::AttributeValueTol | ( | const casacore::Vector< T > & | value, |
const T & | tolerance, | ||
const casacore::Bool | strict | ||
) |
Constructor for a casacore::Vector
value, with specified scalar tolerance and strictness.
casa::AttributeValueTol< T >::AttributeValueTol | ( | const AttributeValueTol< T > & | other | ) |
Copy contructor.
|
virtual |
Destructor.
|
private |
Default constructor.
|
inlinevirtual |
Return class name.
Reimplemented from casa::AttributeValue< T >.
Reimplemented in casa::AttributeValuePoiTol< T >.
Definition at line 130 of file AttValTol.h.
|
virtual |
Return a new copy of the AttributeValueTol (virtual constructor).
Reimplemented from casa::AttributeValue< T >.
Reimplemented in casa::AttributeValuePoiTol< T >.
|
inlinevirtual |
Definition at line 124 of file AttValTol.h.
References casa::AttributeValueTol< T >::itsValueTolerance.
|
protectedvirtual |
Implements when the values of two Attributes match, taking note of tolerance in this particular implementation.
Reimplemented from casa::AttributeValue< T >.
|
private |
Does the actual matching.
const AttributeValueTol<T>& casa::AttributeValueTol< T >::operator= | ( | const AttributeValueTol< T > & | other | ) |
Assignment operator.
|
inlinevirtual |
Change or retrieve the scalar tolerance.
Definition at line 121 of file AttValTol.h.
References casa::AttributeValueTol< T >::itsValueTolerance, and casacore::value().
|
private |
The value of the tolerance.
Definition at line 143 of file AttValTol.h.
Referenced by casa::AttributeValueTol< T >::getTolerance(), and casa::AttributeValueTol< T >::setTolerance().