casa
$Rev:20696$
|
Base class for values of Attributes used in the display classes. More...
#include <AttValBase.h>
Public Member Functions | |
AttributeValueBase (AttValue::ValueType type, Bool strict) | |
Constructor. | |
AttributeValueBase (const AttributeValueBase &other) | |
Copy constructor. | |
virtual | ~AttributeValueBase () |
Destructor. | |
const AttributeValueBase & | operator= (const AttributeValueBase &other) |
Copy assignment. | |
AttValue::ValueType | getType () const |
Get the type of the value stored. | |
Bool | operator== (const AttributeValueBase &other) const |
Check for equality (and inequality) of two objects derived from AttributeValueBase. | |
Bool | operator!= (const AttributeValueBase &other) const |
virtual AttributeValueBase * | clone () const =0 |
Return a new copy of the AttributeValueBase. | |
virtual void | setStrictness (const Bool &newStrict) |
Set/get the strictness state of this AttributeValue. | |
virtual Bool | getStrictness () const |
virtual void | operator+= (const AttributeValueBase &other)=0 |
Add other to *this . | |
virtual String | className () const |
Return class name. | |
virtual void | print (ostream &os)=0 |
Protected Member Functions | |
virtual Bool | matches (const AttributeValueBase &other) const =0 |
Calculate whether *this matches other . | |
virtual void | setType (const AttValue::ValueType &newType) |
Set the type of the value stored. | |
Bool | myMatch (const AttributeValueBase &other) const |
Check that private data match. | |
Protected Attributes | |
AttValue::ValueType | itsValueType |
The type of what is stored. | |
Bool | itsStrictness |
Whether the match is strict or not. |
Base class for values of Attributes used in the display classes.
Public interface
"AttributeValueBase" is a concatenation, representing a "Base" class for "Attribute Values."
This class is the base for storing Attribute values. Attributes are simple name-value pairs, where the name is a String, and the value can be a scalar or Array.
This class defines the type-independent interface for Attribute values, and the type-dependent interface and implementation is provided in AttributeValue . This type independent interface allows comparison of Attributes of different types.
To provide the non-templated (ie. type-independent) interface of AttributeValues in a single place, thus enabling the hiding of the templated aspect of Attributes from the end-user. In particular it allows implementation of the comparison operators in the base class, regardless of type.
Definition at line 167 of file AttValBase.h.
casa::AttributeValueBase::AttributeValueBase | ( | AttValue::ValueType | type, |
Bool | strict | ||
) |
Constructor.
casa::AttributeValueBase::AttributeValueBase | ( | const AttributeValueBase & | other | ) |
Copy constructor.
virtual casa::AttributeValueBase::~AttributeValueBase | ( | ) | [virtual] |
Destructor.
virtual String casa::AttributeValueBase::className | ( | ) | const [inline, virtual] |
Return class name.
Reimplemented in casa::AttributeValue< T >, casa::AttributeValuePoi< T >, casa::AttributeValueTol< T >, and casa::AttributeValuePoiTol< T >.
Definition at line 215 of file AttValBase.h.
References String.
virtual AttributeValueBase* casa::AttributeValueBase::clone | ( | ) | const [pure virtual] |
Return a new copy of the AttributeValueBase.
Implemented in casa::AttributeValue< T >, casa::AttributeValuePoi< T >, casa::AttributeValueTol< T >, and casa::AttributeValuePoiTol< T >.
virtual Bool casa::AttributeValueBase::getStrictness | ( | ) | const [virtual] |
Get the type of the value stored.
virtual Bool casa::AttributeValueBase::matches | ( | const AttributeValueBase & | other | ) | const [protected, pure virtual] |
Calculate whether *this
matches other
.
Since the meaning of "match" can be different for different types, it is left to the derived class to define this method.
Implemented in casa::AttributeValue< T >, and casa::AttributeValueTol< T >.
Bool casa::AttributeValueBase::myMatch | ( | const AttributeValueBase & | other | ) | const [protected] |
Check that private data match.
Bool casa::AttributeValueBase::operator!= | ( | const AttributeValueBase & | other | ) | const |
virtual void casa::AttributeValueBase::operator+= | ( | const AttributeValueBase & | other | ) | [pure virtual] |
Add other
to *this
.
Implemented in casa::AttributeValue< T >, casa::AttributeValuePoi< T >, and casa::AttributeValuePoiTol< T >.
const AttributeValueBase& casa::AttributeValueBase::operator= | ( | const AttributeValueBase & | other | ) |
Copy assignment.
Bool casa::AttributeValueBase::operator== | ( | const AttributeValueBase & | other | ) | const |
Check for equality (and inequality) of two objects derived from AttributeValueBase.
It is implemented in terms of the pure virtual method matches
, which must be implemented in derived classes. The operator==
only returns True
if this->matches(other)
and other.matches(*this)
are both True
. This guarantees that if a == b
it follows that b == a
(this is enforced this way because a
and b
can be classes derived differently from AttributeValueBase which can therefore have a different implementation of match()
).
virtual void casa::AttributeValueBase::print | ( | ostream & | os | ) | [pure virtual] |
Implemented in casa::AttributeValue< T >.
virtual void casa::AttributeValueBase::setStrictness | ( | const Bool & | newStrict | ) | [virtual] |
Set/get the strictness state of this AttributeValue.
virtual void casa::AttributeValueBase::setType | ( | const AttValue::ValueType & | newType | ) | [protected, virtual] |
Set the type of the value stored.
Bool casa::AttributeValueBase::itsStrictness [protected] |
Whether the match is strict or not.
Definition at line 225 of file AttValBase.h.
The type of what is stored.
Definition at line 222 of file AttValBase.h.