AttValTol.h

Classes

AttributeValueTol -- Templated class for storing Attributes which have a tolerance. (full description)

template <class T> class AttributeValueTol : public AttributeValue<T>

Interface

Public Members
AttributeValueTol(const T &value, const T &tolerance, const Bool strict)
AttributeValueTol(const Vector<T> &value, const T &tolerance, const Bool strict)
AttributeValueTol(const AttributeValueTol<T> &other)
virtual ~AttributeValueTol()
const AttributeValueTol<T> &operator=(const AttributeValueTol<T>& other)
virtual AttributeValueBase *clone() const
virtual void setTolerance(T value)
virtual T getTolerance() const
virtual String className() const
Protected Members
virtual Bool matches(const AttributeValueBase& other) const
Private Members
Bool myMatch(const AttributeValue<T>& other) const
AttributeValueTol()

Description

Review Status

Date Reviewed:
yyyy/mm/dd
Programs:
Tests:

Prerequisite

Etymology

"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.

Synopsis

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.

Example

If we have

    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.

    Motivation

    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.

    To Do

    Member Description

    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)
    virtual T getTolerance() const

    Change or retrieve the scalar tolerance.

    virtual String className() const

    Return class name

    virtual Bool matches(const AttributeValueBase& other) const

    Implements when the values of two Attributes match, taking note of tolerance in this particular implementation.

    Bool myMatch(const AttributeValue<T>& other) const

    Does the actual matching

    AttributeValueTol()

    Default constructor