casa
$Rev:20696$
|
Data type that holds an array. More...
#include <TBData.h>
Public Member Functions | |
TBArrayData () | |
Default Constructor. | |
~TBArrayData () | |
vector< int > | getShape () |
Returns the array's shape. | |
bool | isLoaded () |
Returns true if the array has data loaded into it, false otherwise. | |
bool | isOneDimensional () |
Returns true if the array is one-dimensional, false otherwise. | |
bool | coordIsValid (vector< int > d) |
Returns true if the given coordinate is a valid index for this array given its shape, false otherwise. | |
bool | isEmpty () |
Returns true if the array is empty (i.e., all dimensions have size 0), false otherwise. | |
TBData * | firstItem () |
Returns the first item in the array, or NULL if there is no data loaded. | |
virtual TBData * | dataAt (vector< int > d)=0 |
dataAt() must be implemented by any subclass. | |
virtual String | asString ()=0 |
asString() must be implemented by any subclass. | |
virtual bool | release ()=0 |
release() must be implemented by any subclass. | |
virtual void | setDataAt (vector< int > d, TBData &value)=0 |
setDataAt() must be implemented by any subclass. | |
double | asDouble () |
Invalid operations. | |
float | asFloat () |
asFloat() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a float. | |
int | asInt () |
asInt() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as an int. | |
unsigned int | asUInt () |
asUInt() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as an unsigned int. | |
bool | asBool () |
asBool() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a boolean. | |
char | asChar () |
asChar() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a char. | |
unsigned char | asUChar () |
asUChar() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as an unsigned character. | |
short int | asShort () |
asShort() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a short. | |
pair< float, float > | asComplex () |
asComplex() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a complex. | |
pair< double, double > | asDComplex () |
asDComplex() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a double complex. | |
Record * | asRecord () |
asRecord() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a record. | |
void | setValue (TBData &value) |
setValue() must be implemented by any subclass. | |
bool | equals (TBData *data) |
equals() must be implemented by any subclass. | |
virtual bool | contains (TBData *data)=0 |
contains() must be implemented by any subclass. | |
virtual bool | containsBetween (TBData *data, TBData *data2)=0 |
containsBetween() must be implemented by any subclass. | |
virtual bool | containsLessThan (TBData *data)=0 |
containsLessThan() must be implemented by any subclass. | |
virtual bool | containsGreaterThan (TBData *data)=0 |
containsGreaterThan() must be implemented by any subclass. | |
virtual String | to1DString ()=0 |
to1DString() must be implemented by any subclass. | |
Protected Attributes | |
vector< int > | shape |
Array shape. | |
bool | loaded |
Whether data is loaded. | |
bool | oneDim |
Whether the array is one-dimensional. |
Data type that holds an array.
TBArrayData is the abstract class for array data types that the browser knows about. Subclasses of TBArrayData do not have to implement much of the abstract methods in TBData, but they do have to implement some array-specific methods. Because of the way the browser is set up, an array may or may not have actual data loaded into it; generally speaking, one-dimensional arrays are loaded (copied) immediately upon construction whereas other arrays must be manually loaded. This is to save space.
Default Constructor.
bool casa::TBArrayData::asBool | ( | ) | [inline, virtual] |
asBool() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a boolean.
Implements casa::TBData.
char casa::TBArrayData::asChar | ( | ) | [inline, virtual] |
asChar() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a char.
Implements casa::TBData.
pair<float, float> casa::TBArrayData::asComplex | ( | ) | [inline, virtual] |
asComplex() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a complex.
Implements casa::TBData.
pair<double, double> casa::TBArrayData::asDComplex | ( | ) | [inline, virtual] |
asDComplex() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a double complex.
Implements casa::TBData.
double casa::TBArrayData::asDouble | ( | ) | [inline, virtual] |
float casa::TBArrayData::asFloat | ( | ) | [inline, virtual] |
asFloat() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a float.
Implements casa::TBData.
int casa::TBArrayData::asInt | ( | ) | [inline, virtual] |
asInt() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as an int.
Implements casa::TBData.
Record* casa::TBArrayData::asRecord | ( | ) | [inline, virtual] |
asRecord() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a record.
Implements casa::TBData.
short int casa::TBArrayData::asShort | ( | ) | [inline, virtual] |
asShort() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as a short.
Implements casa::TBData.
virtual String casa::TBArrayData::asString | ( | ) | [pure virtual] |
asString() must be implemented by any subclass.
Generally speaking, should return the array data for one-dimensional arrays or the shape and type otherwise.
Implements casa::TBData.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
unsigned char casa::TBArrayData::asUChar | ( | ) | [inline, virtual] |
asUChar() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as an unsigned character.
Implements casa::TBData.
unsigned int casa::TBArrayData::asUInt | ( | ) | [inline, virtual] |
asUInt() must be implemented by any subclass, although the returned value does not have to be valid for classes for which the value cannot be represented as an unsigned int.
Implements casa::TBData.
virtual bool casa::TBArrayData::contains | ( | TBData * | data | ) | [pure virtual] |
contains() must be implemented by any subclass.
Returns true if this array has data loaded and contains the given value, false otherwise.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
virtual bool casa::TBArrayData::containsBetween | ( | TBData * | data, |
TBData * | data2 | ||
) | [pure virtual] |
containsBetween() must be implemented by any subclass.
Returns true if this array has data loaded and contains a value between the two given values, false otherwise. NOTE: the behavior is undefined for arrays with non-numerical values.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
virtual bool casa::TBArrayData::containsGreaterThan | ( | TBData * | data | ) | [pure virtual] |
containsGreaterThan() must be implemented by any subclass.
Returns true if this array has data loaded and contains a value greater than the given value, false otherwise. NOTE: the behavior is undefined for arrays with non-numerical values.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
virtual bool casa::TBArrayData::containsLessThan | ( | TBData * | data | ) | [pure virtual] |
containsLessThan() must be implemented by any subclass.
Returns true if this array has data loaded and contains a value less than the given value, false otherwise. NOTE: the behavior is undefined for arrays with non-numerical values.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
bool casa::TBArrayData::coordIsValid | ( | vector< int > | d | ) |
Returns true if the given coordinate is a valid index for this array given its shape, false otherwise.
virtual TBData* casa::TBArrayData::dataAt | ( | vector< int > | d | ) | [pure virtual] |
dataAt() must be implemented by any subclass.
Returns a TBData copy of the data at the given coordinates, or NULL if the coordinates are invalid or there is no loaded data. NOTE: generally speaking, since subclasses do not internally store their data as arrays of TBData*, the returned TBData object must be deleted by the caller.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
bool casa::TBArrayData::equals | ( | TBData * | data | ) | [inline, virtual] |
Returns the first item in the array, or NULL if there is no data loaded.
vector<int> casa::TBArrayData::getShape | ( | ) |
Returns the array's shape.
bool casa::TBArrayData::isEmpty | ( | ) |
Returns true if the array is empty (i.e., all dimensions have size 0), false otherwise.
bool casa::TBArrayData::isLoaded | ( | ) |
Returns true if the array has data loaded into it, false otherwise.
bool casa::TBArrayData::isOneDimensional | ( | ) |
Returns true if the array is one-dimensional, false otherwise.
virtual bool casa::TBArrayData::release | ( | ) | [pure virtual] |
release() must be implemented by any subclass.
If data is loaded, release it and free the memory.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
virtual void casa::TBArrayData::setDataAt | ( | vector< int > | d, |
TBData & | value | ||
) | [pure virtual] |
setDataAt() must be implemented by any subclass.
Sets the data at the given coordinates to the given value. NOTE: this method's behavior is undefined if the type of the TBData does not match the type of the array.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
void casa::TBArrayData::setValue | ( | TBData & | value | ) | [inline, virtual] |
setValue() must be implemented by any subclass.
Sets this data's value to the value of the given TBData. Note: the behavior of this method is undefined if the given TBData is not the same type as "this" TBData.
Implements casa::TBData.
virtual String casa::TBArrayData::to1DString | ( | ) | [pure virtual] |
to1DString() must be implemented by any subclass.
Returns a "flattened" version of the array.
Implemented in casa::TBArrayDataDComplex, casa::TBArrayDataComplex, casa::TBArrayDataShort, casa::TBArrayDataUChar, casa::TBArrayDataChar, casa::TBArrayDataBool, casa::TBArrayDataUInt, casa::TBArrayDataInt, casa::TBArrayDataFloat, casa::TBArrayDataDouble, and casa::TBArrayDataString.
bool casa::TBArrayData::loaded [protected] |
bool casa::TBArrayData::oneDim [protected] |
vector<int> casa::TBArrayData::shape [protected] |