casa
5.7.0-16
|
Type-dependent interface for values of Attributes. More...
#include <AttVal.h>
Public Member Functions | |
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 AttributeValueBase * | clone () const |
Returns a new copy of the AttributeValue. More... | |
virtual void | operator+= (const AttributeValueBase &other) |
Add other to *this . More... | |
virtual casacore::String | className () const |
Return class name. 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 or not. More... | |
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 | |
void | setType () |
Sett T type in base class. More... | |
casacore::Bool | myMatch (const AttributeValue< T > &other) const |
Do actual matching. More... | |
AttributeValue () | |
Default constructor. More... | |
Private Attributes | |
casacore::Vector< T > | itsValue |
The attribute value. 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... | |
Type-dependent interface for values of Attributes.
Public interface
An AttributeValue stores the value of an Attribute
An Attribute in the Display Library has a name and a value. In order to facilite easy use of Attributes in user code, the value of an Attribute has to be wrapped in a templated class, the AttributeValue, which itself is derived from a non-templated base class, AttributeValueBase . What is stored in the AttributeValue is a value and the type of that value. Only some types are supported; see AttributeValueBase for a list. The value is always stored as a casacore::Vector, even if the value used in the constructor is a single value. The operation needed for the AttributeValue is to be able to check whether it matches another AttributeValue. For two AttributeValues to match they must have the same value and be of the same type (with some tolerance, see below). AttributeValues of different types (through the base class AttributeValueBase), never match.
The parameter strict
in some constructors defines whether matching has to be done for each element ( strict == true
), or whether AttributeValues match if any one element of one casacore::Vector is equal to any other element of the other Vector. An AttributeValue created with a scalar type can match an AttributeValue created with a casacore::Vector of that scalar type.
A few simple examples of the use of the AttributeValue class follow.
At this point, intAtt1==intAtt2
will return true
, and intAtt1==intAtt3
will return false
.
and now vecAtt1==intAtt1
is true
, and vecAtt1==intAtt3
returns false
.
Finally,
gives false
for vecAtt2==intAtt1
, since they cannot match element wise because they have different lengths, and similarly vecAtt2==intAtt2
is also false
.
and Attribute .
casa::AttributeValue< T >::AttributeValue | ( | const T & | value, |
const casacore::Bool | strict | ||
) |
Construct from a scalar value.
The parameter strict
defines whether whether matching has to be done for each element (strict == true
) (a scalar value AttributeValue is considered a casacore::Vector of length one), or whether AttributeValues match if any one element of one casacore::Vector is equal to any other element of the other casacore::Vector (strict == false
).
casa::AttributeValue< T >::AttributeValue | ( | const casacore::Vector< T > & | value, |
const casacore::Bool | strict | ||
) |
Construct from a casacore::Vector
.
The parameter strict
defines whether whether matching has to be done for each element (strict == true
), or whether AttributeValues match if any one element of one casacore::Vector is equal to any other element of the other casacore::Vector (strict == false
).
|
virtual |
Destructor.
casa::AttributeValue< T >::AttributeValue | ( | const AttributeValue< T > & | other | ) |
Copy constructor.
|
private |
Default constructor.
|
inlinevirtual |
Return class name.
Reimplemented from casa::AttributeValueBase.
Reimplemented in casa::AttributeValuePoi< T >, casa::AttributeValueTol< T >, and casa::AttributeValuePoiTol< T >.
|
virtual |
Returns a new copy of the AttributeValue.
Implements casa::AttributeValueBase.
Reimplemented in casa::AttributeValuePoi< T >, casa::AttributeValueTol< T >, and casa::AttributeValuePoiTol< T >.
|
inlinevirtual |
Definition at line 151 of file AttVal.h.
References casa::AttributeValue< T >::itsValue.
|
protectedvirtual |
Implements when the values of two Attributes match or not.
The state of strict
determines whether whether matching has to be done for each element ( strict == true
), or whether AttributeValues match if any one element of one casacore::Vector is equal to any other element of the other Vector.
Implements casa::AttributeValueBase.
Reimplemented in casa::AttributeValueTol< T >.
|
protected |
Cast from Base class.
|
private |
Do actual matching.
|
virtual |
Add other
to *this
.
Implements casa::AttributeValueBase.
Reimplemented in casa::AttributeValuePoi< T >, and casa::AttributeValuePoiTol< T >.
const AttributeValue<T>& casa::AttributeValue< T >::operator= | ( | const AttributeValue< T > & | other | ) |
Assignment (copy semantics)
|
inlinevirtual |
Implements casa::AttributeValueBase.
Definition at line 167 of file AttVal.h.
References casa::AttributeValue< T >::itsValue.
|
private |
Sett T type in base class.
|
virtual |
Set/get the value of the AttributeValue.
Reimplemented in casa::AttributeValuePoi< T >, and casa::AttributeValuePoiTol< T >.
|
virtual |
Reimplemented in casa::AttributeValuePoi< T >, and casa::AttributeValuePoiTol< T >.
|
private |
The attribute value.
Definition at line 185 of file AttVal.h.
Referenced by casa::AttributeValue< T >::getValue(), and casa::AttributeValue< T >::print().