TaQLNode.h

Classes

TaQLNode -- Envelope class for a node in the raw TaQL parse tree. (full description)
TaQLConstNode -- Envelope class for a node containing a constant value. (full description)
TaQLMultiNode -- Envelope class for a node containing a select command. (full description)
TaQLSelectNode -- Envelope class for a node containing a list of nodes. (full description)

class TaQLNode

Interface

Public Members
TaQLNode() : itsRep(0)
TaQLNode (TaQLNodeRep* rep)
TaQLNode (const TaQLNode& that)
TaQLNode& operator= (const TaQLNode& that)
~TaQLNode()
static TaQLNode parse (const String& command)
Bool isValid() const
char nodeType() const
const TaQLNodeRep* getRep() const
TaQLNodeResult visit (TaQLNodeVisitor& visitor) const
void show (std::ostream& os) const
void save (AipsIO& aio) const
static TaQLNode restore (AipsIO& aio)
Private Members
static void clearNodesCreated()
Public Members
void saveNode (AipsIO& aio) const
static TaQLNode restoreNode (AipsIO& aio)
static TaQLMultiNode restoreMultiNode (AipsIO& aio)

Description

Review Status

Programs:
Tests:

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.

Member Description

TaQLNode() : itsRep(0)

Default constructor.

TaQLNode (TaQLNodeRep* rep)

Construct for given letter. It takes over the pointer.

TaQLNode (const TaQLNode& that)

Copy constructor (reference semantics).

TaQLNode& operator= (const TaQLNode& that)

Assignment (reference semantics).

~TaQLNode()

Destructor deletes the letter if no more references.

static TaQLNode parse (const String& command)

Parse a TaQL command and return the result. An exception is thrown in case of parse errors.

Bool isValid() const

Does the envelope contain a letter?

char nodeType() const

Return the type of letter.

const TaQLNodeRep* getRep() const

Get read access to the letter.

TaQLNodeResult visit (TaQLNodeVisitor& visitor) const

void show (std::ostream& os) const

Print the node (recursively) in the given stream.

void save (AipsIO& aio) const
static TaQLNode restore (AipsIO& aio)

Save and restore the entire tree.

static void clearNodesCreated()

void saveNode (AipsIO& aio) const
static TaQLNode restoreNode (AipsIO& aio)
static TaQLMultiNode restoreMultiNode (AipsIO& aio)

Helper functions for save/restore of tree.

class TaQLConstNode: public TaQLNode

Interface

explicit TaQLConstNode (TaQLConstNodeRep* rep)
void setIsTableName()
const String& getString() const

Description

Review Status

Programs:
Tests:

Synopsis

This is a specialization of the envelope class TaQLNode for a node containing a constant value.

Member Description

explicit TaQLConstNode (TaQLConstNodeRep* rep)

void setIsTableName()

const String& getString() const


class TaQLMultiNode: public TaQLNode

Interface

TaQLMultiNode()
explicit TaQLMultiNode (Bool isSetOrArray)
TaQLMultiNode (TaQLMultiNodeRep* rep)
void add (const TaQLNode& node)
void add (TaQLNodeRep* noderep)
void setIsSetOrArray()
void setPPFix (const String& prefix, const String& postfix)
const TaQLMultiNodeRep* getMultiRep() const

Description

Review Status

Programs:
Tests:

Synopsis

This is a specialization of the envelope class TaQLNode for a node containing a select command.

Member Description

TaQLMultiNode()

explicit TaQLMultiNode (Bool isSetOrArray)

TaQLMultiNode (TaQLMultiNodeRep* rep)

void add (const TaQLNode& node)

void add (TaQLNodeRep* noderep)

void setIsSetOrArray()

void setPPFix (const String& prefix, const String& postfix)

const TaQLMultiNodeRep* getMultiRep() const


class TaQLSelectNode: public TaQLNode

Interface

TaQLSelectNode (TaQLSelectNodeRep* rep)
void setBrackets()
void setNoExecute()
void setFromExecute()

Description

Review Status

Programs:
Tests:

Synopsis

This is a specialization of the envelope class TaQLNode for a node containing a list of nodes.

Member Description

TaQLSelectNode (TaQLSelectNodeRep* rep)

void setBrackets()

void setNoExecute()

void setFromExecute()