casa
$Rev:20696$
|
Templated class for storing Attributes which have a tolerance. More...
#include <AttValTol.h>
Public Member Functions | |
AttributeValueTol (const T &value, const T &tolerance, const Bool strict) | |
Constructor for a scalar, with specified scalar tolerance and strictness. | |
AttributeValueTol (const Vector< T > &value, const T &tolerance, const Bool strict) | |
Constructor for a Vector value, with specified scalar tolerance and strictness. | |
AttributeValueTol (const AttributeValueTol< T > &other) | |
Copy contructor. | |
virtual | ~AttributeValueTol () |
Destructor. | |
const AttributeValueTol< T > & | operator= (const AttributeValueTol< T > &other) |
Assignment operator. | |
virtual AttributeValueBase * | clone () const |
Return a new copy of the AttributeValueTol (virtual constructor). | |
virtual void | setTolerance (T value) |
Change or retrieve the scalar tolerance. | |
virtual T | getTolerance () const |
virtual String | className () const |
Return class name. | |
Protected Member Functions | |
virtual Bool | matches (const AttributeValueBase &other) const |
Implements when the values of two Attributes match, taking note of tolerance in this particular implementation. | |
Private Member Functions | |
Bool | myMatch (const AttributeValue< T > &other) const |
Does the actual matching. | |
AttributeValueTol () | |
Default constructor. | |
Private Attributes | |
T | itsValueTolerance |
The value of the tolerance. |
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.
AttributeValueTol<Float> Att1(3.0, 1.2, False); AttributeValueTol<Float> Att2(2.0, 1.1, False); AttributeValueTol<Float> Att3(2.1, 0.5, False);
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 Bool | strict | ||
) |
Constructor for a scalar, with specified scalar tolerance and strictness.
casa::AttributeValueTol< T >::AttributeValueTol | ( | const Vector< T > & | value, |
const T & | tolerance, | ||
const Bool | strict | ||
) |
Constructor for a Vector
value, with specified scalar tolerance and strictness.
casa::AttributeValueTol< T >::AttributeValueTol | ( | const AttributeValueTol< T > & | other | ) |
Copy contructor.
virtual casa::AttributeValueTol< T >::~AttributeValueTol | ( | ) | [virtual] |
Destructor.
casa::AttributeValueTol< T >::AttributeValueTol | ( | ) | [private] |
Default constructor.
virtual String casa::AttributeValueTol< T >::className | ( | ) | const [inline, virtual] |
Return class name.
Reimplemented from casa::AttributeValue< T >.
Reimplemented in casa::AttributeValuePoiTol< T >.
Definition at line 126 of file AttValTol.h.
References String.
virtual AttributeValueBase* casa::AttributeValueTol< T >::clone | ( | ) | const [virtual] |
Return a new copy of the AttributeValueTol (virtual constructor).
Reimplemented from casa::AttributeValue< T >.
Reimplemented in casa::AttributeValuePoiTol< T >.
virtual T casa::AttributeValueTol< T >::getTolerance | ( | ) | const [inline, virtual] |
Definition at line 122 of file AttValTol.h.
References casa::AttributeValueTol< T >::itsValueTolerance.
virtual Bool casa::AttributeValueTol< T >::matches | ( | const AttributeValueBase & | other | ) | const [protected, virtual] |
Implements when the values of two Attributes match, taking note of tolerance in this particular implementation.
Reimplemented from casa::AttributeValue< T >.
Bool casa::AttributeValueTol< T >::myMatch | ( | const AttributeValue< T > & | other | ) | const [private] |
Does the actual matching.
Reimplemented from casa::AttributeValue< T >.
const AttributeValueTol<T>& casa::AttributeValueTol< T >::operator= | ( | const AttributeValueTol< T > & | other | ) |
Assignment operator.
virtual void casa::AttributeValueTol< T >::setTolerance | ( | T | value | ) | [inline, virtual] |
Change or retrieve the scalar tolerance.
Definition at line 121 of file AttValTol.h.
References casa::AttributeValueTol< T >::itsValueTolerance, and casa::value().
T casa::AttributeValueTol< T >::itsValueTolerance [private] |
The value of the tolerance.
Definition at line 137 of file AttValTol.h.
Referenced by casa::AttributeValueTol< T >::getTolerance(), and casa::AttributeValueTol< T >::setTolerance().