casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
casa::AttributeValueTol< T > Class Template Reference

Templated class for storing Attributes which have a tolerance. More...

#include <AttValTol.h>

Inheritance diagram for casa::AttributeValueTol< T >:
casa::AttributeValue< T > casa::AttributeValueBase casa::AttributeValuePoiTol< T >

List of all members.

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 AttributeValueBaseclone () 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

itsValueTolerance
 The value of the tolerance.

Detailed Description

template<class T>
class casa::AttributeValueTol< T >

Templated class for storing Attributes which have a tolerance.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd
Test programs:
tAttribute

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.

Definition at line 96 of file AttValTol.h.


Constructor & Destructor Documentation

template<class T>
casa::AttributeValueTol< T >::AttributeValueTol ( const T &  value,
const T &  tolerance,
const Bool  strict 
)

Constructor for a scalar, with specified scalar tolerance and strictness.

template<class T>
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.

template<class T>
casa::AttributeValueTol< T >::AttributeValueTol ( const AttributeValueTol< T > &  other)

Copy contructor.

template<class T>
virtual casa::AttributeValueTol< T >::~AttributeValueTol ( ) [virtual]

Destructor.

template<class T>
casa::AttributeValueTol< T >::AttributeValueTol ( ) [private]

Default constructor.


Member Function Documentation

template<class T>
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.

template<class T>
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 >.

template<class T>
virtual T casa::AttributeValueTol< T >::getTolerance ( ) const [inline, virtual]

Definition at line 122 of file AttValTol.h.

References casa::AttributeValueTol< T >::itsValueTolerance.

template<class T>
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 >.

template<class T>
Bool casa::AttributeValueTol< T >::myMatch ( const AttributeValue< T > &  other) const [private]

Does the actual matching.

Reimplemented from casa::AttributeValue< T >.

template<class T>
const AttributeValueTol<T>& casa::AttributeValueTol< T >::operator= ( const AttributeValueTol< T > &  other)

Assignment operator.

template<class T>
virtual void casa::AttributeValueTol< T >::setTolerance ( 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().


Member Data Documentation

template<class T>
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().


The documentation for this class was generated from the following file: