casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Private Types | Static Private Member Functions | List of all members
casacore::ReadAsciiTable Class Reference

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. More...
 
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. More...
 

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. More...
 
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. More...
 
static Bool getLine (ifstream &file, Int &lineNumber, char *line, Int lineSize, Bool testComment, const Regex &commentMarker, Int firstLine, Int lastLine)
 Get the next line. More...
 
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. More...
 
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. More...
 
static Bool makeBool (const String &str)
 Turn the string into a Bool value. More...
 
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. More...
 
static Int getTypeShape (const String &typestr, IPosition &shape, Int &type)
 Get the shape and type from the type string. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Helper class for readAsciiTable.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Intended use:

Internal

Synopsis

This class contains static functions as helpers for readAsciiTable.

Definition at line 319 of file ReadAsciiTable.h.

Member Enumeration Documentation

Define types.

Enumerator
RATBool 
RATShort 
RATInt 
RATFloat 
RATDouble 
RATString 
RATComX 
RATComZ 
RATDComX 
RATDComZ 
RATDMS 
RATHMS 

Definition at line 349 of file ReadAsciiTable.h.

Member Function Documentation

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 
)
staticprivate

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 
)
staticprivate

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 
)
staticprivate

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 
)
staticprivate

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 
)
staticprivate

Derive the types from the values in the first data line.

static Int casacore::ReadAsciiTable::getTypeShape ( const String typestr,
IPosition shape,
Int type 
)
staticprivate

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 
)
staticprivate

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 
)
staticprivate

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 
)
staticprivate

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 
)
staticprivate

Handle the next scalar with the given type from the data line and put it into the table column.

static Bool casacore::ReadAsciiTable::makeBool ( const String str)
staticprivate

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 
)
staticprivate

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
static double casacore::ReadAsciiTable::stringToPos ( const String pos,
Bool  isDMS 
)
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 :.


The documentation for this class was generated from the following file: