26#ifndef TABLES_READASCIITABLE_H
27#define TABLES_READASCIITABLE_H
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32#include <casacore/casa/Arrays/IPosition.h>
33#include <casacore/tables/Tables/Table.h>
36#include <casacore/casa/iosfwd.h>
213 const String& commentMarkerRegex =
"",
Int firstLine = 1,
Int lastLine = -1,
221 Char separator,
const String& commentMarkerRegex,
Int firstLine,
249 const String& tablename,
Char separator =
' ',
250 const String& commentMarkerRegex =
"",
Int firstLine = 1,
Int lastLine = -1);
254 const char* tablename,
Char separator =
' ',
255 const String& commentMarkerRegex =
"",
Int firstLine = 1,
Int lastLine = -1);
264 Char separator =
' ',
const String& commentMarkerRegex =
"",
Int firstLine = 1,
269 Char separator,
const String& commentMarkerRegex,
Int firstLine,
Int lastLine);
272 Char separator =
' ',
const String& commentMarkerRegex =
"",
Int firstLine = 1,
275 const String& dataFile,
const String& tableDescName,
const char* tablename,
276 Char separator =
' ',
const String& commentMarkerRegex =
"",
Int firstLine = 1,
300 Char separator,
const String& commentMarkerRegex,
Int firstLine,
Int lastLine);
305 const String& commentMarkerRegex,
Int firstLine,
Int lastLine);
334 Char separator,
Bool testComment,
const Regex& commentMarker,
Int firstLine,
342 Char separator,
Bool testComment,
const Regex& commentMarker,
Int firstLine,
348 const Regex& commentMarker,
Int firstLine,
Int lastLine);
365 ifstream& jFile,
Int& lineNumber,
Char separator,
Bool testComment,
366 const Regex& commentMarker,
Int firstLine,
Int lastLine);
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 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 void handleKeyset(Int lineSize, char *string1, char *first, char *second, TableRecord &keysets, LogIO &logger, const std::string &fileName, ifstream &jFile, Int &lineNumber, Char separator, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine)
Handle a keyword set.
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.
For temporary backward namespace compatibility, use casa as alias for casacore.
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
bool Bool
Define the standard types used by Casacore.
NewDelAllocator< T > NewDelAllocator< T >::value
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)