casa
5.7.0-16
|
casacore::Data type that holds an array. More...
#include <TBData.h>
Public Member Functions | |
TBArrayData () | |
Default Constructor. More... | |
~TBArrayData () | |
std::vector< int > | getShape () |
Returns the array's shape. More... | |
bool | isLoaded () |
Returns true if the array has data loaded into it, false otherwise. More... | |
bool | isOneDimensional () |
Returns true if the array is one-dimensional, false otherwise. More... | |
bool | coordIsValid (std::vector< int > d) |
Returns true if the given coordinate is a valid index for this array given its shape, false otherwise. More... | |
bool | isEmpty () |
Returns true if the array is empty (i.e., all dimensions have size 0), false otherwise. More... | |
TBData * | firstItem () |
Returns the first item in the array, or NULL if there is no data loaded. More... | |
virtual TBData * | dataAt (std::vector< int > d)=0 |
dataAt() must be implemented by any subclass. More... | |
virtual casacore::String | asString ()=0 |
asString() must be implemented by any subclass. More... | |
virtual bool | release ()=0 |
release() must be implemented by any subclass. More... | |
virtual void | setDataAt (std::vector< int > d, TBData &value)=0 |
setDataAt() must be implemented by any subclass. More... | |
double | asDouble () |
Invalid operations. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
std::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. More... | |
std::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. More... | |
casacore::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. More... | |
void | setValue (TBData &value) |
setValue() must be implemented by any subclass. More... | |
bool | equals (TBData *data) |
equals() must be implemented by any subclass. More... | |
virtual bool | contains (TBData *data)=0 |
contains() must be implemented by any subclass. More... | |
virtual bool | containsBetween (TBData *data, TBData *data2)=0 |
containsBetween() must be implemented by any subclass. More... | |
virtual bool | containsLessThan (TBData *data)=0 |
containsLessThan() must be implemented by any subclass. More... | |
virtual bool | containsGreaterThan (TBData *data)=0 |
containsGreaterThan() must be implemented by any subclass. More... | |
virtual casacore::String | to1DString ()=0 |
to1DString() must be implemented by any subclass. More... | |
Public Member Functions inherited from casa::TBData | |
TBData () | |
Default Constructor. More... | |
virtual | ~TBData () |
casacore::String | displayValue () |
See TBData::asString(). More... | |
virtual casacore::String | getType ()=0 |
getType() must be implemented by any subclass. More... | |
Protected Attributes | |
std::vector< int > | shape |
casacore::Array shape. More... | |
bool | loaded |
Whether data is loaded. More... | |
bool | oneDim |
Whether the array is one-dimensional. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from casa::TBData | |
static TBData * | create (casacore::String value, casacore::String type) |
Creates and returns a TBData object representing the given value and type. More... | |
static TBData * | create (TBArray *array, casacore::String type) |
Creates a TBArrayData object containing the data in the given TBArray object with the given type. More... | |
static TBData * | create (TBData &data) |
Creates and returns a copy of the given TBData. More... | |
casacore::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.
casa::TBArrayData::TBArrayData | ( | ) |
Default Constructor.
casa::TBArrayData::~TBArrayData | ( | ) |
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
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.
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
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.
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.
|
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.
|
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 | ( | std::vector< int > | d | ) |
Returns true if the given coordinate is a valid index for this array given its shape, false otherwise.
|
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.
|
inlinevirtual |
TBData* casa::TBArrayData::firstItem | ( | ) |
Returns the first item in the array, or NULL if there is no data loaded.
std::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.
|
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.
|
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.
|
inlinevirtual |
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.
|
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.
|
protected |
|
protected |
|
protected |
casacore::Array shape.