Loading...
Searching...
No Matches
casacore::RecordGram Class Reference
tables package (libcasa_tables) » TaQL_module » TaQL_module_internal_classes

Select-class for flex/bison scanner/parser for RecordGram. More...

`#include <RecordGram.h>`

## Public Types

enum | Token { Node , Val , Elem , Set }
| Define the types of tokens in the grammar. More...

## Static Public Member Functions

static TableExprNode | parse (const RecordInterface &record, const String &expression)
| Convert an expression string to an expression tree.
static TableExprNode | parse (const Table &table, const String &expression)
| Convert an expression string to an expression tree.
static Bool | expr2Bool (const String &expr, const Record &vars=Record())
| Evaluate an expression to the given type.
static Int64 | expr2Int (const String &expr, const Record &vars=Record())
static double | expr2Double (const String &expr, const Record &vars=Record(), const String &unit=String())
static DComplex | expr2Complex (const String &expr, const Record &vars=Record())
static String | expr2String (const String &expr, const Record &vars=Record())
static MVTime | expr2Date (const String &expr, const Record &vars=Record())
static Array< Bool > | expr2ArrayBool (const String &expr, const Record &vars=Record())
static Array< Int64 > | expr2ArrayInt (const String &expr, const Record &vars=Record())
static Array< double > | expr2ArrayDouble (const String &expr, const Record &vars=Record(), const String &unit=String())
static Array< DComplex > | expr2ArrayComplex (const String &expr, const Record &vars=Record())
static Array< String > | expr2ArrayString (const String &expr, const Record &vars=Record())
static Array< MVTime > | expr2ArrayDate (const String &expr, const Record &vars=Record())
static TableExprNode | handleLiteral (RecordGramVal *)
| Create a TableExprNode from a literal.
static TableExprNode | handleField (const String &name)
| Find the field name and create a TableExprNode from it.
static TableExprNode | handleFunc (const String &name, const TableExprNodeSet &arguments)
| Handle a function.
static TableExprNode | handleRegex (const TableExprNode &left, const String &regex)
| Handle a regex.
static void | setNodePtr (TableExprNode *nodePtr)
| Set the final node pointer.
static void | addToken (TableExprNode *ptr)
| Add a token to the list of tokens to be deleted for the possible tokens in the RecordGram.yy union.
static void | addToken (RecordGramVal *ptr)
static void | addToken (TableExprNodeSet *ptr)
static void | addToken (TableExprNodeSetElem *ptr)
static void | deleteToken (TableExprNode *ptr)
| Delete a token and remove from the list.
static void | deleteToken (RecordGramVal *ptr)
static void | deleteToken (TableExprNodeSet *ptr)
static void | deleteToken (TableExprNodeSetElem *ptr)

## Static Public Attributes

static TaQLStyle | theirTaQLStyle
| Define the global TaQLStyle to use.

## Static Private Member Functions

static void | deleteTokenStorage ()
| Delete all tokens not deleted yet.
static TableExprNode | doParse (const String &expression)
| Do the conversion of an expression string to an expression tree.
static void | addToken (void *ptr, Token type)
| Add a token to the list of tokens to be deleted.
static void | removeToken (void *ptr)
| Remove a token from the list of tokens to be deleted.

## Static Private Attributes

static std::map< void *, Token > | theirTokens
static const RecordInterface * | theirRecPtr
static const Table * | theirTabPtr
static TableExprNode * | theirNodePtr
static std::mutex | theirMutex

## Detailed Description

Select-class for flex/bison scanner/parser for RecordGram.

### Intended use:

Internal

### Review Status

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

### Prerequisite

- RecordGram.l and.y (flex and bison grammar)

### Synopsis

This class is needed for the the actions in the flex scanner and bison parser. This stores the information by constructing RecordGram objects as needed and storing them in a List.

An expression can be given as a string and parsed by the parse function. The grammar used is as much as possible the same as that for the WHERE clause in TaQL (see Note 199). It is possible to set the TaQL style to use by setting theirTaQLStyle before calling the parse functions. A better way is to define the style with the 'USING STYLE' part of the command (similar to TaQL).

### Motivation

It is necessary to be able to give a record select command in ASCII. It is used by the ACSIS people.

Definition at line 173 of file RecordGram.h.

## Member Enumeration Documentation

## Token

enum casacore::RecordGram::Token

Define the types of tokens in the grammar.

Enumerator
Node |
Val |
Elem |
Set |

Definition at line 177 of file RecordGram.h.

## Member Function Documentation

## addToken() [1/5]

void casacore::RecordGram::addToken | ( | RecordGramVal * | ptr | ) |

static

## addToken() [2/5]

void casacore::RecordGram::addToken | ( | TableExprNode * | ptr | ) |

static

Add a token to the list of tokens to be deleted for the possible tokens in the RecordGram.yy union.

The addToken() functions are to be called only by the yy parser (under theirMutex).

## addToken() [3/5]

void casacore::RecordGram::addToken | ( | TableExprNodeSet * | ptr | ) |

static

## addToken() [4/5]

void casacore::RecordGram::addToken | ( | TableExprNodeSetElem * | ptr | ) |

static

## addToken() [5/5]

void casacore::RecordGram::addToken | ( | void * | ptr,
|  | Token | type )

inline static private

Add a token to the list of tokens to be deleted.

Definition at line 271 of file RecordGram.h.

References theirTokens.

## deleteToken() [1/4]

void casacore::RecordGram::deleteToken | ( | RecordGramVal * | ptr | ) |

static

## deleteToken() [2/4]

void casacore::RecordGram::deleteToken | ( | TableExprNode * | ptr | ) |

static

Delete a token and remove from the list.

The deleteToken() functions are to be called only by the yy parser (under theirMutex).

## deleteToken() [3/4]

void casacore::RecordGram::deleteToken | ( | TableExprNodeSet * | ptr | ) |

static

## deleteToken() [4/4]

void casacore::RecordGram::deleteToken | ( | TableExprNodeSetElem * | ptr | ) |

static

## deleteTokenStorage()

void casacore::RecordGram::deleteTokenStorage | ( |  | ) |

static private

Delete all tokens not deleted yet.

## doParse()

TableExprNode casacore::RecordGram::doParse | ( | const String & | expression | ) |

static private

Do the conversion of an expression string to an expression tree.

## expr2ArrayBool()

Array< Bool > casacore::RecordGram::expr2ArrayBool | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2ArrayComplex()

Array< DComplex > casacore::RecordGram::expr2ArrayComplex | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2ArrayDate()

Array< MVTime > casacore::RecordGram::expr2ArrayDate | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2ArrayDouble()

Array< double > casacore::RecordGram::expr2ArrayDouble | ( | const String & | expr,
|  | const Record & | vars = Record(),
|  | const String & | unit = String() )

static

References casacore::Record().

## expr2ArrayInt()

Array< Int64 > casacore::RecordGram::expr2ArrayInt | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2ArrayString()

Array< String > casacore::RecordGram::expr2ArrayString | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2Bool()

Bool casacore::RecordGram::expr2Bool | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

Evaluate an expression to the given type.

The expression can contain variables; their names and values must be defined in the record. For double values it is possible to specify the desired unit. If the expression is a scalar value, the expr2Array functions will return an array with length 1.

References casacore::Record().

## expr2Complex()

DComplex casacore::RecordGram::expr2Complex | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2Date()

MVTime casacore::RecordGram::expr2Date | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2Double()

double casacore::RecordGram::expr2Double | ( | const String & | expr,
|  | const Record & | vars = Record(),
|  | const String & | unit = String() )

static

References casacore::Record().

## expr2Int()

Int64 casacore::RecordGram::expr2Int | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## expr2String()

String casacore::RecordGram::expr2String | ( | const String & | expr,
|  | const Record & | vars = Record() )

static

References casacore::Record().

## handleField()

TableExprNode casacore::RecordGram::handleField | ( | const String & | name | ) |

static

Find the field name and create a TableExprNode from it.

To be called only by the yy parser (under theirMutex).

References casacore::name().

## handleFunc()

TableExprNode casacore::RecordGram::handleFunc | ( | const String & | name,
|  | const TableExprNodeSet & | arguments )

static

Handle a function.

To be called only by the yy parser (under theirMutex).

References casacore::name().

## handleLiteral()

TableExprNode casacore::RecordGram::handleLiteral | ( | RecordGramVal * |  | ) |

static

Create a TableExprNode from a literal.

## handleRegex()

TableExprNode casacore::RecordGram::handleRegex | ( | const TableExprNode & | left,
|  | const String & | regex )

static

Handle a regex.

References casacore::regex().

## parse() [1/2]

TableExprNode casacore::RecordGram::parse | ( | const RecordInterface & | record,
|  | const String & | expression )

static

Convert an expression string to an expression tree.

The expression will operate on a series of Record objects. The given record is needed to know the type of the fields used in the expression.

References casacore::RecordInterface().

## parse() [2/2]

TableExprNode casacore::RecordGram::parse | ( | const Table & | table,
|  | const String & | expression )

static

Convert an expression string to an expression tree.

The expression will operate on the given table.

## removeToken()

void casacore::RecordGram::removeToken | ( | void * | ptr | ) |

inline static private

Remove a token from the list of tokens to be deleted.

Definition at line 274 of file RecordGram.h.

References theirTokens.

## setNodePtr()

void casacore::RecordGram::setNodePtr | ( | TableExprNode * | nodePtr | ) |

inline static

Set the final node pointer.

Definition at line 241 of file RecordGram.h.

References theirNodePtr.

## Member Data Documentation

## theirMutex

std::mutex casacore::RecordGram::theirMutex

static private

Definition at line 281 of file RecordGram.h.

## theirNodePtr

TableExprNode* casacore::RecordGram::theirNodePtr

static private

Definition at line 280 of file RecordGram.h.

Referenced by setNodePtr().

## theirRecPtr

const RecordInterface* casacore::RecordGram::theirRecPtr

static private

Definition at line 278 of file RecordGram.h.

## theirTabPtr

const Table* casacore::RecordGram::theirTabPtr

static private

Definition at line 279 of file RecordGram.h.

## theirTaQLStyle

TaQLStyle casacore::RecordGram::theirTaQLStyle

static

Define the global TaQLStyle to use.

By default it is glish style.

Definition at line 246 of file RecordGram.h.

## theirTokens

std::map<void*, Token> casacore::RecordGram::theirTokens

static private

Definition at line 277 of file RecordGram.h.

Referenced by addToken(), and removeToken().

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

- tables/TaQL/RecordGram.h