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

Envelope class for a node in the raw TaQL parse tree. More...

#include <TaQLNode.h>

Inheritance diagram for casa::TaQLNode:
casa::TaQLConstNode casa::TaQLMultiNode casa::TaQLQueryNode casa::TaQLRegexNode

List of all members.

Public Member Functions

 TaQLNode ()
 Default constructor.
 TaQLNode (TaQLNodeRep *rep)
 Construct for given letter.
 TaQLNode (const TaQLNode &that)
 Copy constructor (reference semantics).
TaQLNodeoperator= (const TaQLNode &that)
 Assignment (reference semantics).
const TaQLStylestyle () const
 Get the TaQL style.
 ~TaQLNode ()
 Destructor deletes the letter if no more references.
Bool isValid () const
 Does the envelope contain a letter?
char nodeType () const
 Return the type of letter.
const TaQLNodeRepgetRep () const
 Get read access to the letter.
TaQLNodeResult visit (TaQLNodeVisitor &visitor) const
 Let the visitor visit the node.
void show (std::ostream &os) const
 Print the node (recursively) in the given stream.
void save (AipsIO &aio) const
 Save and restore the entire tree.
void saveNode (AipsIO &aio) const
 Helper functions for save/restore of tree.

Static Public Member Functions

static TaQLNode parse (const String &command)
 Parse a TaQL command and return the result.
static TaQLNode restore (AipsIO &aio)
static TaQLNode restoreNode (AipsIO &aio)
static TaQLMultiNode restoreMultiNode (AipsIO &aio)

Static Public Attributes

static TaQLNode theirNode
 The object getting the final tree.
static std::vector< TaQLNode * > theirNodesCreated
 A list of objects created by the parser and deleted at the end.
static TaQLStyle theirStyle
 Keep the TaQL style to use.
static Mutex theirMutex
 Use a mutex to guard the statics.

Protected Attributes

TaQLNodeRepitsRep
 
   

Static Private Member Functions

static void clearNodesCreated ()

Detailed Description

Envelope class for a node in the raw TaQL parse tree.

Intended use:

Internal

Review Status

Test programs:
tTaQLNode

Prerequisite

Synopsis

The result of parsing a TaQL command is stored in TaQLNode objects. Each part of the command can have its own specialized TaQLNodeRep object, which forms the letter in the TaQLNode envelope.
The actual scanning/parsing of the command is done using flex/bison as defined in the TableGram files.

Motivation

The letter-envelope idiom (counted pointer) makes if much easier to keep track of memory, especially in the case of exceptions.

Definition at line 80 of file TaQLNode.h.


Constructor & Destructor Documentation

Default constructor.

Definition at line 84 of file TaQLNode.h.

Construct for given letter.

It takes over the pointer.

Definition at line 88 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::link().

casa::TaQLNode::TaQLNode ( const TaQLNode that) [inline]

Copy constructor (reference semantics).

Definition at line 92 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::link().

Destructor deletes the letter if no more references.

Definition at line 109 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::unlink().


Member Function Documentation

static void casa::TaQLNode::clearNodesCreated ( ) [static, private]
const TaQLNodeRep* casa::TaQLNode::getRep ( ) const [inline]

Get read access to the letter.

Definition at line 125 of file TaQLNode.h.

References itsRep.

Bool casa::TaQLNode::isValid ( ) const [inline]

Does the envelope contain a letter?

Definition at line 117 of file TaQLNode.h.

References itsRep.

char casa::TaQLNode::nodeType ( ) const [inline]

Return the type of letter.

Definition at line 121 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::nodeType().

TaQLNode& casa::TaQLNode::operator= ( const TaQLNode that) [inline]

Assignment (reference semantics).

Definition at line 96 of file TaQLNode.h.

References itsRep, casa::TaQLNodeRep::link(), and casa::TaQLNodeRep::unlink().

static TaQLNode casa::TaQLNode::parse ( const String command) [static]

Parse a TaQL command and return the result.

An exception is thrown in case of parse errors.

static TaQLNode casa::TaQLNode::restore ( AipsIO aio) [static]
static TaQLNode casa::TaQLNode::restoreNode ( AipsIO aio) [static]
void casa::TaQLNode::save ( AipsIO aio) const

Save and restore the entire tree.

void casa::TaQLNode::saveNode ( AipsIO aio) const

Helper functions for save/restore of tree.

void casa::TaQLNode::show ( std::ostream &  os) const [inline]

Print the node (recursively) in the given stream.

Definition at line 134 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::show().

const TaQLStyle& casa::TaQLNode::style ( ) const [inline]

Get the TaQL style.

Definition at line 105 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::style().

TaQLNodeResult casa::TaQLNode::visit ( TaQLNodeVisitor visitor) const [inline]

Let the visitor visit the node.

If no node, return an empty result.

Definition at line 130 of file TaQLNode.h.

References itsRep, and casa::TaQLNodeRep::visit().

Referenced by casa::TaQLNodeVisitor::visitNode().


Member Data Documentation

   

Definition at line 144 of file TaQLNode.h.

Referenced by getRep(), isValid(), nodeType(), operator=(), show(), style(), TaQLNode(), visit(), and ~TaQLNode().

Use a mutex to guard the statics.

Definition at line 162 of file TaQLNode.h.

The object getting the final tree.

Definition at line 156 of file TaQLNode.h.

A list of objects created by the parser and deleted at the end.

Definition at line 158 of file TaQLNode.h.

Keep the TaQL style to use.

Definition at line 160 of file TaQLNode.h.


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