28 #ifndef TABLES_READASCIITABLE_H
29 #define TABLES_READASCIITABLE_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/BasicSL/String.h>
34 #include <casacore/casa/Arrays/IPosition.h>
35 #include <casacore/tables/Tables/Table.h>
38 #include <casacore/casa/iosfwd.h>
217 Char separator =
' ',
218 const String& commentMarkerRegex =
"",
219 Int firstLine = 1,
Int lastLine = -1,
229 Char separator,
const String& commentMarkerRegex,
230 Int firstLine,
Int lastLine);
258 Char separator =
' ',
259 const String& commentMarkerRegex =
"",
260 Int firstLine = 1,
Int lastLine = -1);
264 const String& tableDescName,
const char* tablename,
265 Char separator =
' ',
266 const String& commentMarkerRegex =
"",
267 Int firstLine = 1,
Int lastLine = -1);
277 Char separator =
' ',
278 const String& commentMarkerRegex =
"",
279 Int firstLine = 1,
Int lastLine = -1,
286 Char separator,
const String& commentMarkerRegex,
287 Int firstLine,
Int lastLine);
291 Char separator =
' ',
292 const String& commentMarkerRegex =
"",
293 Int firstLine = 1,
Int lastLine = -1);
296 const String& tableDescName,
const char* tablename,
297 Char separator =
' ',
298 const String& commentMarkerRegex =
"",
299 Int firstLine = 1,
Int lastLine = -1);
329 const String& commentMarkerRegex,
330 Int firstLine,
Int lastLine);
338 const String& commentMarkerRegex,
339 Int firstLine,
Int lastLine);
360 Bool testComment,
const Regex& commentMarker,
361 Int firstLine,
Int lastLine);
372 Bool testComment,
const Regex& commentMarker,
373 Int firstLine,
Int lastLine);
378 char* line,
Int lineSize,
379 Bool testComment,
const Regex& commentMarker,
380 Int firstLine,
Int lastLine);
406 const Regex& commentMarker,
407 Int firstLine,
Int lastLine);
430 Int type,
void* valueBlock);
Helper class for readAsciiTable.
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 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 Bool getLine(ifstream &file, Int &lineNumber, char *line, Int lineSize, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine)
Get the next line.
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 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 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 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 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 void handleScalar(char *string1, Int lineSize, char *first, Int &at1, Char separator, Int type, TableColumn &tabcol, rownr_t rownr)
Handle the next scalar with the given type from the data line and put it into the table column.
static double stringToPos(const String &pos, Bool isDMS)
Read a position using MVAngle.
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 handleArray(char *string1, Int lineSize, char *first, Int &at1, Char separator, const IPosition &shape, Int varAxis, Int type, TableColumn &tabcol, rownr_t rownr)
Get the next array with the given type from the data line and put it into the table column.
static Int getTypeShape(const String &typestr, IPosition &shape, Int &type)
Get the shape and type from the type string.
static Bool makeBool(const String &str)
Turn the string into a Bool value.
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.
String: the storage and methods of handling collections of characters.
TableType
Define the possible table types.
const Double second
Time interval [T]:
this file contains all the compiler specific defines
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
uInt64 rownr_t
Define the type of a row number in a table.
String readAsciiTable(const String &headerFile, const String &dataFile, const String &tableDescName, const char *tablename, Char separator=' ', const String &commentMarkerRegex="", Int firstLine=1, Int lastLine=-1)
String readAsciiTable(const String &headerFile, const String &dataFile, const String &tableDescName, const String &tablename, Char separator=' ', const String &commentMarkerRegex="", Int firstLine=1, Int lastLine=-1)
This form reads TWO Ascii files.
Table readAsciiTable(String &formatString, Table::TableType tableType, const String &filein, const String &tableproto, const String &tablename, const Vector< String > &columnNames, const Vector< String > &dataTypes, Char separator, const String &commentMarkerRegex, Int firstLine, Int lastLine)
String readAsciiTable(const String &filein, const String &tableproto, const String &tablename, const Vector< String > &columnNames, const Vector< String > &dataTypes, Char separator, const String &commentMarkerRegex, Int firstLine, Int lastLine)
This form gets the header info in the given vectors.
String readAsciiTable(const String &filein, const String &tableDescName, const String &tableName, Bool autoHeader=False, Char separator=' ', const String &commentMarkerRegex="", Int firstLine=1, Int lastLine=-1, const IPosition &autoShape=IPosition())
Create a table with name as given by tableName.
Table readAsciiTable(String &formatString, Table::TableType tableType, const String &headerFile, const String &dataFile, const String &tableDescName, const String &tablename, Char separator=' ', const String &commentMarkerRegex="", Int firstLine=1, Int lastLine=-1)
Table readAsciiTable(String &formatString, Table::TableType tableType, const String &filein, const String &tableDescName, const String &tableName, Bool autoHeader=False, Char separator=' ', const String &commentMarkerRegex="", Int firstLine=1, Int lastLine=-1, const IPosition &autoShape=IPosition())
Similar versions as above, but returning a Table object.
Table readAsciiTable(String &formatString, Table::TableType tableType, const String &headerFile, const String &dataFile, const String &tableDescName, const char *tablename, Char separator=' ', const String &commentMarkerRegex="", Int firstLine=1, Int lastLine=-1)