casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Static Public Member Functions | Private Types | Static Private Member Functions
casa::ReadAsciiTable Class Reference

Helper class for readAsciiTable. More...

#include <ReadAsciiTable.h>

List of all members.

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.

Detailed Description

Helper class for readAsciiTable.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
<h3>Intended use:</h3> Internal

<h3>Synopsis</h3>
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 casa::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 casa::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 casa::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 casa::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 casa::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 casa::ReadAsciiTable::getTypeShape ( const String typestr,
IPosition shape,
Int type 
) [static, private]

Get the shape and type from the type string.

static Bool casa::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 casa::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 casa::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 casa::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.

static Bool casa::ReadAsciiTable::makeBool ( const String str) [static, private]

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 casa::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 casa::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 casa::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 casa::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: