Envelope class for a node in the raw TaQL parse tree. More...
#include <TaQLNode.h>
Public Member Functions | |
TaQLNode () | |
Default constructor. | |
TaQLNode (TaQLNodeRep *rep) | |
Construct for given letter. | |
TaQLNode (const TaQLNode &that) | |
Copy constructor (reference semantics). | |
TaQLNode & | operator= (const TaQLNode &that) |
Assignment (reference semantics). | |
const TaQLStyle & | style () 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 TaQLNodeRep * | getRep () 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 | |
TaQLNodeRep * | itsRep |
Static Private Member Functions | |
static void | clearNodesCreated () |
Envelope class for a node in the raw TaQL parse tree.
Internal
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.
The letter-envelope idiom (counted pointer) makes if much easier to keep track of memory, especially in the case of exceptions.
Definition at line 81 of file TaQLNode.h.
casacore::TaQLNode::TaQLNode | ( | ) | [inline] |
Default constructor.
Definition at line 85 of file TaQLNode.h.
casacore::TaQLNode::TaQLNode | ( | TaQLNodeRep * | rep | ) | [inline] |
Construct for given letter.
It takes over the pointer.
Definition at line 89 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::link().
casacore::TaQLNode::TaQLNode | ( | const TaQLNode & | that | ) | [inline] |
Copy constructor (reference semantics).
Definition at line 93 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::link().
casacore::TaQLNode::~TaQLNode | ( | ) | [inline] |
Destructor deletes the letter if no more references.
Definition at line 110 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::unlink().
static void casacore::TaQLNode::clearNodesCreated | ( | ) | [static, private] |
const TaQLNodeRep* casacore::TaQLNode::getRep | ( | ) | const [inline] |
Bool casacore::TaQLNode::isValid | ( | ) | const [inline] |
char casacore::TaQLNode::nodeType | ( | ) | const [inline] |
Return the type of letter.
Definition at line 122 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::nodeType().
Assignment (reference semantics).
Definition at line 97 of file TaQLNode.h.
References itsRep, casacore::TaQLNodeRep::link(), and casacore::TaQLNodeRep::unlink().
Parse a TaQL command and return the result.
An exception is thrown in case of parse errors.
static TaQLMultiNode casacore::TaQLNode::restoreMultiNode | ( | AipsIO & | aio | ) | [static] |
void casacore::TaQLNode::save | ( | AipsIO & | aio | ) | const |
Save and restore the entire tree.
void casacore::TaQLNode::saveNode | ( | AipsIO & | aio | ) | const |
Helper functions for save/restore of tree.
void casacore::TaQLNode::show | ( | std::ostream & | os | ) | const [inline] |
Print the node (recursively) in the given stream.
Definition at line 135 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::show().
const TaQLStyle& casacore::TaQLNode::style | ( | ) | const [inline] |
Get the TaQL style.
Definition at line 106 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::style().
TaQLNodeResult casacore::TaQLNode::visit | ( | TaQLNodeVisitor & | visitor | ) | const [inline] |
Let the visitor visit the node.
If no node, return an empty result.
Definition at line 131 of file TaQLNode.h.
References itsRep, and casacore::TaQLNodeRep::visit().
Referenced by casacore::TaQLNodeVisitor::visitNode().
TaQLNodeRep* casacore::TaQLNode::itsRep [protected] |
Definition at line 145 of file TaQLNode.h.
Referenced by getRep(), isValid(), nodeType(), operator=(), show(), style(), TaQLNode(), visit(), and ~TaQLNode().
Mutex casacore::TaQLNode::theirMutex [static] |
Use a mutex to guard the statics.
Definition at line 163 of file TaQLNode.h.
TaQLNode casacore::TaQLNode::theirNode [static] |
The object getting the final tree.
Definition at line 157 of file TaQLNode.h.
std::vector<TaQLNode*> casacore::TaQLNode::theirNodesCreated [static] |
A list of objects created by the parser and deleted at the end.
Definition at line 159 of file TaQLNode.h.
TaQLStyle casacore::TaQLNode::theirStyle [static] |
Keep the TaQL style to use.
Definition at line 161 of file TaQLNode.h.