casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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 >

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

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

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<casacore::Float> Att1(3.0, 1.2, false);
AttributeValueTol<casacore::Float> Att2(2.0, 1.1, false);
AttributeValueTol<casacore::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 casacore::Bool  strict 
)

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

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

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 casacore::String casa::AttributeValueTol< T >::className ( ) const
inlinevirtual

Return class name.

Reimplemented from casa::AttributeValue< T >.

Reimplemented in casa::AttributeValuePoiTol< T >.

Definition at line 130 of file AttValTol.h.

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
inlinevirtual

Definition at line 124 of file AttValTol.h.

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

template<class T>
virtual casacore::Bool casa::AttributeValueTol< T >::matches ( const AttributeValueBase other) const
protectedvirtual

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

Reimplemented from casa::AttributeValue< T >.

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

Does the actual matching.

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)
inlinevirtual

Change or retrieve the scalar tolerance.

Definition at line 121 of file AttValTol.h.

References casa::AttributeValueTol< T >::itsValueTolerance, and casacore::value().

Member Data Documentation

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


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