casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Attributes
casa::TBArrayData Class Reference

Data type that holds an array. More...

#include <TBData.h>

Inheritance diagram for casa::TBArrayData:
casa::TBData casa::TBArrayDataBool casa::TBArrayDataChar casa::TBArrayDataComplex casa::TBArrayDataDComplex casa::TBArrayDataDouble casa::TBArrayDataFloat casa::TBArrayDataInt casa::TBArrayDataShort casa::TBArrayDataString casa::TBArrayDataUChar casa::TBArrayDataUInt

List of all members.

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.
TBDatafirstItem ()
 Returns the first item in the array, or NULL if there is no data loaded.
virtual TBDatadataAt (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.
RecordasRecord ()
 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.

Detailed Description

Data type that holds an array.

Synopsis

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.

Definition at line 986 of file TBData.h.


Constructor & Destructor Documentation

Default Constructor.


Member Function Documentation

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.

Definition at line 1044 of file TBData.h.

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.

Definition at line 1045 of file TBData.h.

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.

Definition at line 1048 of file TBData.h.

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.

Definition at line 1049 of file TBData.h.

double casa::TBArrayData::asDouble ( ) [inline, virtual]

Invalid operations.

Implements casa::TBData.

Definition at line 1040 of file TBData.h.

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.

Definition at line 1041 of file TBData.h.

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.

Definition at line 1042 of file TBData.h.

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.

Definition at line 1050 of file TBData.h.

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.

Definition at line 1047 of file TBData.h.

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.

Definition at line 1046 of file TBData.h.

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.

Definition at line 1043 of file TBData.h.

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]

equals() must be implemented by any subclass.

Returns true if the given TBData is equal to this TBData object, false otherwise. Note: the behavior of this method is undefined if the given TBData is not of the same type as "this" TBData.

Implements casa::TBData.

Definition at line 1053 of file TBData.h.

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.

Returns true if the array is empty (i.e., all dimensions have size 0), false otherwise.

Returns true if the array has data loaded into it, false otherwise.

Returns true if the array is one-dimensional, false otherwise.

virtual bool casa::TBArrayData::release ( ) [pure virtual]
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.

Definition at line 1051 of file TBData.h.

virtual String casa::TBArrayData::to1DString ( ) [pure virtual]

Member Data Documentation

bool casa::TBArrayData::loaded [protected]

Whether data is loaded.

Definition at line 1088 of file TBData.h.

bool casa::TBArrayData::oneDim [protected]

Whether the array is one-dimensional.

Definition at line 1091 of file TBData.h.

vector<int> casa::TBArrayData::shape [protected]

Array shape.

Definition at line 1085 of file TBData.h.


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