casa
5.7.0-16
|
Holds a potentially multi-dimensional array. More...
#include <TBArray.h>
Public Member Functions | |
TBArray (int row, int col, casacore::String type, casacore::String array) | |
Constructor for a data array (in other words, an array found in the data of a table). More... | |
TBArray (int keywordIndex, casacore::String type, casacore::String array) | |
Constructor for a table keyword array (in other words, an array found in the table keywords). More... | |
TBArray (casacore::String col, int index, casacore::String type, casacore::String array) | |
Constructor for a field keyword array (in other words, an array found in the field keywords). More... | |
TBArray (casacore::String type, casacore::String array) | |
Constructor for a non-specific array. More... | |
~TBArray () | |
bool | isValid () |
Returns true if the array is valid, false otherwise. More... | |
std::vector< int > | getDimensions () |
Returns the dimensions of the array in list format. More... | |
unsigned int | dim () |
Returns the dimensionality of the array. More... | |
int | dimensionAt (unsigned int i) |
If the dimensions are thought of as a list (e.g., 2x4x2), then this method returns the ith dimension in the list. More... | |
bool | isOneDimensional () |
Returns true if the array is one-dimensional, false otherwise. More... | |
casacore::String | getType () |
Returns the type of the array. More... | |
std::vector< void * > * | getData () |
Returns the data representation. More... | |
int | getRow () |
Returns the row of the table where the array is located. More... | |
int | getCol () |
Returns the column of the table where the array is located. More... | |
bool | sameLocationAs (TBArray *array) |
Returns true if the given array is in the same location as this array, false otherwise. More... | |
casacore::String | getName (TBTable *table) |
Returns the name of this array, assuming that it belongs to the given table. More... | |
casacore::String | dataAt (std::vector< int > d) |
Returns the data at the given coordinates, or blank if the coordinates are invalid. More... | |
void | setDataAt (std::vector< int > d, casacore::String newVal) |
Sets the data at the given coordinates to the given value. More... | |
bool | dimensionIsValid (std::vector< int > d) |
Returns true if the given coordinates are valid for this array, false otherwise. More... | |
casacore::String | toFlattenedString () |
Returns a "flattened" casacore::String representation of this array. More... | |
bool | contains (casacore::String value) |
Returns true if this array contains the given value, false otherwise. More... | |
bool | containsBetween (casacore::String value1, casacore::String value2) |
Returns true if this array contains any value that is between the two given values, false otherwise. More... | |
bool | containsLessThan (casacore::String value) |
Returns true if this array contains any value that is less than the given value, false otherwise. More... | |
bool | containsGreaterThan (casacore::String value) |
Returns true if this array contains any value that is greater than the given value, false otherwise. More... | |
Private Member Functions | |
void | parseArray (casacore::String *table) |
Parses the given casacore::String into the array. More... | |
casacore::String | parseRow (casacore::String &str, std::vector< void * > *r, std::vector< int > d, int x) |
Helper for parseArray(). More... | |
void | parseMultidimensionalTable (casacore::String str) |
Helper for parseArray(). More... | |
void | insertPlaceholders (std::vector< void * > *r, std::vector< int > d, int x) |
Helper for parseArray(). More... | |
casacore::String | toFlattenedString (std::vector< void * > *row, int d) |
Helper method for toFlattenedString();. More... | |
bool | contains (std::vector< void * > *data, int n, casacore::String v) |
Helper method for contains(). More... | |
bool | containsBetween (std::vector< void * > *data, int n, double v1, double v2) |
Helper method for containsBetween(). More... | |
bool | containsLessThan (std::vector< void * > *data, int n, double v) |
Helper method for containsLessThan(). More... | |
bool | containsGreaterThan (std::vector< void * > *data, int n, double v) |
Helper method for containsGreaterThan(). More... | |
void | deleteData (std::vector< void * > *data, int n) |
Deletes the data in the given row. More... | |
Private Attributes | |
std::vector< int > | dimensions |
Holds the dimensions of this array. More... | |
std::vector< void * > | data |
casacore::Data representation. More... | |
bool | valid |
Indicates whether the array is valid or not. More... | |
casacore::String | type |
The type of the array. More... | |
int | row |
The row of the array for data arrays, or the keyword index for other arrays. More... | |
int | col |
The column of the array for data arrays, invalid for other arrays. More... | |
bool | oneDim |
Indicates whether this array is one-dimensional or not. More... | |
bool | isData |
Indicates whether this is a data array or not. More... | |
bool | isColKeyword |
Indicates whether this is a field keyword array or not. More... | |
casacore::String | field |
Holds the field name for a field keyword array, empty otherwise. More... | |
Holds a potentially multi-dimensional array.
A TBArray holds a array object as used by the table browser. The data is represented by casacore::String values, while the array structure is represented by vectors of void*s. For all but the "last" dimension, the void*s point to other vector<void*>s, and on the last dimension the void*s point to Strings. NOTE: this class is mostly obsolete now that the browser uses the TBData structure.
casa::TBArray::TBArray | ( | int | row, |
int | col, | ||
casacore::String | type, | ||
casacore::String | array | ||
) |
Constructor for a data array (in other words, an array found in the data of a table).
Takes as input the row and column of the array in table, the type of table, and the casacore::String holding the values of the array which need to be parsed.
casa::TBArray::TBArray | ( | int | keywordIndex, |
casacore::String | type, | ||
casacore::String | array | ||
) |
Constructor for a table keyword array (in other words, an array found in the table keywords).
Takes as input the index of the keyword in the table keywords list, the type of the array, and the casacore::String holding the values of the array which need to be parsed.
casa::TBArray::TBArray | ( | casacore::String | col, |
int | index, | ||
casacore::String | type, | ||
casacore::String | array | ||
) |
Constructor for a field keyword array (in other words, an array found in the field keywords).
Takes as input the name of the field, the index of the keyword in the field keywords list, the type of the array, and the casacore::String holding the values of the array which need to be parsed.
casa::TBArray::TBArray | ( | casacore::String | type, |
casacore::String | array | ||
) |
Constructor for a non-specific array.
Takes as input the type of the array and the casacore::String holding the values of the array which need to be parsed.
casa::TBArray::~TBArray | ( | ) |
bool casa::TBArray::contains | ( | casacore::String | value | ) |
Returns true if this array contains the given value, false otherwise.
|
private |
Helper method for contains().
bool casa::TBArray::containsBetween | ( | casacore::String | value1, |
casacore::String | value2 | ||
) |
Returns true if this array contains any value that is between the two given values, false otherwise.
|
private |
Helper method for containsBetween().
bool casa::TBArray::containsGreaterThan | ( | casacore::String | value | ) |
Returns true if this array contains any value that is greater than the given value, false otherwise.
|
private |
Helper method for containsGreaterThan().
bool casa::TBArray::containsLessThan | ( | casacore::String | value | ) |
Returns true if this array contains any value that is less than the given value, false otherwise.
|
private |
Helper method for containsLessThan().
casacore::String casa::TBArray::dataAt | ( | std::vector< int > | d | ) |
Returns the data at the given coordinates, or blank if the coordinates are invalid.
|
private |
Deletes the data in the given row.
unsigned int casa::TBArray::dim | ( | ) |
Returns the dimensionality of the array.
For example, a 4x4 array would return 2 while a 4x4x4 array would return 3.
int casa::TBArray::dimensionAt | ( | unsigned int | i | ) |
If the dimensions are thought of as a list (e.g., 2x4x2), then this method returns the ith dimension in the list.
bool casa::TBArray::dimensionIsValid | ( | std::vector< int > | d | ) |
Returns true if the given coordinates are valid for this array, false otherwise.
int casa::TBArray::getCol | ( | ) |
Returns the column of the table where the array is located.
This is only valid for data arrays.
std::vector<void*>* casa::TBArray::getData | ( | ) |
Returns the data representation.
In all but the last dimension, the void*s point to vector<void*>s; in the last dimension the void*s point to Strings.
std::vector<int> casa::TBArray::getDimensions | ( | ) |
Returns the dimensions of the array in list format.
casacore::String casa::TBArray::getName | ( | TBTable * | table | ) |
Returns the name of this array, assuming that it belongs to the given table.
For data arrays: "[table name][[row],[col]]"; for table keyword arrays: "[table name] [keyword name]"; for field keyword arrays: "[table name] [field name, keyword name]".
int casa::TBArray::getRow | ( | ) |
Returns the row of the table where the array is located.
This is only valid for data arrays.
casacore::String casa::TBArray::getType | ( | ) |
Returns the type of the array.
|
private |
Helper for parseArray().
Creates placeholder objects (such as empty Strings and vectors) into the given row.
bool casa::TBArray::isOneDimensional | ( | ) |
Returns true if the array is one-dimensional, false otherwise.
bool casa::TBArray::isValid | ( | ) |
Returns true if the array is valid, false otherwise.
|
private |
Parses the given casacore::String into the array.
|
private |
Helper for parseArray().
Parses a table with dimension > 1.
|
private |
Helper for parseArray().
Parses a single row into the given vector.
bool casa::TBArray::sameLocationAs | ( | TBArray * | array | ) |
Returns true if the given array is in the same location as this array, false otherwise.
For data arrays: true if the row and col values are equal; for table keyword arrays: true if they refer to the same keyword index; for field keyword arrays: true if the fields are the same and the keyword indices are the same.
void casa::TBArray::setDataAt | ( | std::vector< int > | d, |
casacore::String | newVal | ||
) |
Sets the data at the given coordinates to the given value.
This call does NOT write through to the underlying table; it only updates the data representation.
casacore::String casa::TBArray::toFlattenedString | ( | ) |
Returns a "flattened" casacore::String representation of this array.
Each cell is appended to the casacore::String separated by a space.
|
private |
Helper method for toFlattenedString();.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |