Helper class for readAsciiTable. More...
#include <ReadAsciiTable.h>
Static Public Member Functions | |
static String | run (const String &headerfile, const String &filein, const String &tableproto, const String &tablename, Bool autoHeader, const IPosition &autoShape, const Vector< String > &columnNames, const Vector< String > &dataTypes, Char separator, const String &commentMarkerRegex, Int firstLine, Int lastLine) |
Run the readAsciiTable. | |
static Table | runt (String &formatString, Table::TableType tableType, const String &headerfile, const String &filein, const String &tableproto, const String &tablename, Bool autoHeader, const IPosition &autoShape, const Vector< String > &columnNames, const Vector< String > &dataTypes, Char separator, const String &commentMarkerRegex, Int firstLine, Int lastLine) |
static double | stringToPos (const String &pos, Bool isDMS) |
Read a position using MVAngle. | |
Private Types | |
enum | RATType { RATBool, RATShort, RATInt, RATFloat, RATDouble, RATString, RATComX, RATComZ, RATDComX, RATDComZ, RATDMS, RATHMS } |
Define types. More... | |
Static Private Member Functions | |
static String | doRun (const String &headerfile, const String &filein, const String &tableproto, const String &tablename, Bool autoHeader, const IPosition &autoShape, const Vector< String > &columnNames, const Vector< String > &dataTypes, Char separator, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine) |
Do the actual run. | |
static Table | makeTab (String &formatString, Table::TableType tableType, const String &headerfile, const String &filein, const String &tableproto, const String &tablename, Bool autoHeader, const IPosition &autoShape, const Vector< String > &columnNames, const Vector< String > &dataTypes, Char separator, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine) |
Do the actual work of making and filling the table. | |
static Bool | getLine (ifstream &file, Int &lineNumber, char *line, Int lineSize, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine) |
Get the next line. | |
static Int | getNext (const Char *string, Int strlen, Char *result, Int &at, Char separator) |
Get the next part of the line using the separator as delimiter. | |
static void | getTypes (const IPosition &shape, const Char *in, Int leng, Char *string1, Char *string2, Char separator) |
Derive the types from the values in the first data line. | |
static Bool | makeBool (const String &str) |
Turn the string into a Bool value. | |
static void | handleKeyset (Int lineSize, char *string1, char *first, char *second, TableRecord &keysets, LogIO &logger, const String &fileName, ifstream &jFile, Int &lineNumber, Char separator, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine) |
Handle a keyword set. | |
static Int | getTypeShape (const String &typestr, IPosition &shape, Int &type) |
Get the shape and type from the type string. | |
static Bool | getValue (char *string1, Int lineSize, char *first, Int &at1, Char separator, Int type, void *value) |
Get the next scalar value with the given type from string1. | |
static void | handleScalar (char *string1, Int lineSize, char *first, Int &at1, Char separator, Int type, TableColumn &tabcol, uInt rownr) |
Handle the next scalar with the given type from the data line and put it into the table column. | |
static IPosition | getArray (char *string1, Int lineSize, char *first, Int &at1, Char separator, const IPosition &shape, Int varAxis, Int type, void *valueBlock) |
Get the next array with the given type from string1. | |
static void | handleArray (char *string1, Int lineSize, char *first, Int &at1, Char separator, const IPosition &shape, Int varAxis, Int type, TableColumn &tabcol, uInt rownr) |
Get the next array with the given type from the data line and put it into the table column. |
Helper class for readAsciiTable.
Internal
This class contains static functions as helpers for readAsciiTable.
Definition at line 319 of file ReadAsciiTable.h.
enum casacore::ReadAsciiTable::RATType [private] |
Define types.
RATBool | |
RATShort | |
RATInt | |
RATFloat | |
RATDouble | |
RATString | |
RATComX | |
RATComZ | |
RATDComX | |
RATDComZ | |
RATDMS | |
RATHMS |
Definition at line 349 of file ReadAsciiTable.h.
static String casacore::ReadAsciiTable::doRun | ( | const String & | headerfile, | |
const String & | filein, | |||
const String & | tableproto, | |||
const String & | tablename, | |||
Bool | autoHeader, | |||
const IPosition & | autoShape, | |||
const Vector< String > & | columnNames, | |||
const Vector< String > & | dataTypes, | |||
Char | separator, | |||
Bool | testComment, | |||
const Regex & | commentMarker, | |||
Int | firstLine, | |||
Int | lastLine | |||
) | [static, private] |
Do the actual run.
static IPosition casacore::ReadAsciiTable::getArray | ( | char * | string1, | |
Int | lineSize, | |||
char * | first, | |||
Int & | at1, | |||
Char | separator, | |||
const IPosition & | shape, | |||
Int | varAxis, | |||
Int | type, | |||
void * | valueBlock | |||
) | [static, private] |
Get the next array with the given type from string1.
It returns the shape (for variable shaped arrays).
static Bool casacore::ReadAsciiTable::getLine | ( | ifstream & | file, | |
Int & | lineNumber, | |||
char * | line, | |||
Int | lineSize, | |||
Bool | testComment, | |||
const Regex & | commentMarker, | |||
Int | firstLine, | |||
Int | lastLine | |||
) | [static, private] |
Get the next line.
Skip lines to be ignored. It returns False when no more lines are available.
static Int casacore::ReadAsciiTable::getNext | ( | const Char * | string, | |
Int | strlen, | |||
Char * | result, | |||
Int & | at, | |||
Char | separator | |||
) | [static, private] |
Get the next part of the line using the separator as delimiter.
Leading blanks are ignored.
static void casacore::ReadAsciiTable::getTypes | ( | const IPosition & | shape, | |
const Char * | in, | |||
Int | leng, | |||
Char * | string1, | |||
Char * | string2, | |||
Char | separator | |||
) | [static, private] |
Derive the types from the values in the first data line.
static Int casacore::ReadAsciiTable::getTypeShape | ( | const String & | typestr, | |
IPosition & | shape, | |||
Int & | type | |||
) | [static, private] |
Get the shape and type from the type string.
static Bool casacore::ReadAsciiTable::getValue | ( | char * | string1, | |
Int | lineSize, | |||
char * | first, | |||
Int & | at1, | |||
Char | separator, | |||
Int | type, | |||
void * | value | |||
) | [static, private] |
Get the next scalar value with the given type from string1.
static void casacore::ReadAsciiTable::handleArray | ( | char * | string1, | |
Int | lineSize, | |||
char * | first, | |||
Int & | at1, | |||
Char | separator, | |||
const IPosition & | shape, | |||
Int | varAxis, | |||
Int | type, | |||
TableColumn & | tabcol, | |||
uInt | rownr | |||
) | [static, private] |
Get the next array with the given type from the data line and put it into the table column.
static void casacore::ReadAsciiTable::handleKeyset | ( | Int | lineSize, | |
char * | string1, | |||
char * | first, | |||
char * | second, | |||
TableRecord & | keysets, | |||
LogIO & | logger, | |||
const String & | fileName, | |||
ifstream & | jFile, | |||
Int & | lineNumber, | |||
Char | separator, | |||
Bool | testComment, | |||
const Regex & | commentMarker, | |||
Int | firstLine, | |||
Int | lastLine | |||
) | [static, private] |
Handle a keyword set.
static void casacore::ReadAsciiTable::handleScalar | ( | char * | string1, | |
Int | lineSize, | |||
char * | first, | |||
Int & | at1, | |||
Char | separator, | |||
Int | type, | |||
TableColumn & | tabcol, | |||
uInt | rownr | |||
) | [static, private] |
Handle the next scalar with the given type from the data line and put it into the table column.
Turn the string into a Bool value.
Empty string, value 0 and any value starting with f, F, n or N are False.
static Table casacore::ReadAsciiTable::makeTab | ( | String & | formatString, | |
Table::TableType | tableType, | |||
const String & | headerfile, | |||
const String & | filein, | |||
const String & | tableproto, | |||
const String & | tablename, | |||
Bool | autoHeader, | |||
const IPosition & | autoShape, | |||
const Vector< String > & | columnNames, | |||
const Vector< String > & | dataTypes, | |||
Char | separator, | |||
Bool | testComment, | |||
const Regex & | commentMarker, | |||
Int | firstLine, | |||
Int | lastLine | |||
) | [static, private] |
Do the actual work of making and filling the table.
static String casacore::ReadAsciiTable::run | ( | const String & | headerfile, | |
const String & | filein, | |||
const String & | tableproto, | |||
const String & | tablename, | |||
Bool | autoHeader, | |||
const IPosition & | autoShape, | |||
const Vector< String > & | columnNames, | |||
const Vector< String > & | dataTypes, | |||
Char | separator, | |||
const String & | commentMarkerRegex, | |||
Int | firstLine, | |||
Int | lastLine | |||
) | [static] |
Run the readAsciiTable.
static Table casacore::ReadAsciiTable::runt | ( | String & | formatString, | |
Table::TableType | tableType, | |||
const String & | headerfile, | |||
const String & | filein, | |||
const String & | tableproto, | |||
const String & | tablename, | |||
Bool | autoHeader, | |||
const IPosition & | autoShape, | |||
const Vector< String > & | columnNames, | |||
const Vector< String > & | dataTypes, | |||
Char | separator, | |||
const String & | commentMarkerRegex, | |||
Int | firstLine, | |||
Int | lastLine | |||
) | [static] |
Read a position using MVAngle.
If isDMS is True, a position with : is treated as DMS instead of HMS. This function is a bit more relaxed than MVAngle::read. It allows whitespace. Furthermore it allows whitespace as separator :.