PSParseNode Class Reference

A PSParseNode encapsulates one "chunk" of information parsed from a raw SQL string. ParseNodes are hierarchically organized with parent PSParseNodes "owning" child ParseNodes. ParseNodes are unidirectional from parent to child. ParseNodes cannot share children. The ParseNodes form a tree, not a graph. More...

Inherited by PSFlagParseNode, PSIdentifierParseNode, PSIntervalDataTypeParseNode, PSIntervalLiteralParseNode, PSLiteralParseNode, PSNonTerminalParseNode, PSNullParseNode, PSParameterParseNode, and PSScalarOrAggrFnParseNode.

List of all members.

Public Member Functions

virtual void AcceptVisitor (IParseTreeVisitor &in_visitor)=0
 Node's Accept method, used to pass a visitor.
virtual PSParseNodeAddChild (PSParseNode *in_child)
 Add a child to the end of the list of children.
virtual PSParseNodeAddChildren (PSParseNode *in_parent)
 Add children from another node to the end of the list of children.
virtual PSParseNodeClone () const =0
 Returns a clone of this node object.
virtual PSNonTerminalParseNodeGetAsNonTerminalParseNode ()
 Gets the object as a PSNonTerminalParseNode object.
virtual PSParseNodeGetChild (simba_size_t in_childIndex)
 Get a pointer reference to the specified child node.
virtual simba_size_t GetChildCount () const
Simba::SQLEngine::PSNodeIterator GetChildren ()
 Get an iterator that iterates through all the child nodes.
virtual PSDataType GetDataType () const =0
 Returns the data type of this PSParseNode. This method _MUST_ be overriden in subclasses derived from PSParseNode. The implementation should return the data type corresponding to what type of data the PSParseNode contains.
virtual PSFlagValue GetFlagValue () const
 Get the flag value of this PSParseNode. This method is only valid for a PS_DT_FLAG node.
virtual PSIntervalDataType GetIntervalDataType () const
 Get the interval data type of this PSParseNode. This method is only valid for a PS_DT_INTERVAL_DATATYPE node.
virtual PSLiteralType GetLiteralType () const
 Get the literal type of this PSParseNode. This method is only valid for a PS_DT_LITERAL node.
virtual simba_wstring GetLogString () const
 Get a string that identifies this object for logging purpose.
virtual PSNonTerminalType GetNonTerminalType () const
 Retrieve the PSNonTerminalType type.
virtual bool IsQuoted () const
 Returns whether or not the node was quoted.
virtual void SetChild (simba_size_t in_childIndex, PSParseNode *in_child)
 Set the given child index to the specified child node.
virtual void SetString (const simba_wstring &in_string)
 Sets the string for this node to the given string.
virtual PSParseNodeTakeChild (simba_size_t in_childIndex)
 Takes ownership of the child at the given index.
virtual const simba_wstringToString () const
 Returns a string representation of this node.
virtual ~PSParseNode ()
 Destructor.

Protected Member Functions

 PSParseNode (const PSParseNode &in_other)
 Copy constructor.
 PSParseNode ()
 Constructor.

Protected Attributes

simba_wstring m_string
 The string representation of this parse node (empty string by default).

Detailed Description

A PSParseNode encapsulates one "chunk" of information parsed from a raw SQL string. ParseNodes are hierarchically organized with parent PSParseNodes "owning" child ParseNodes. ParseNodes are unidirectional from parent to child. ParseNodes cannot share children. The ParseNodes form a tree, not a graph.

All PSParseNodes should derive from this abstract base class.


Constructor & Destructor Documentation

virtual ~PSParseNode (  )  [virtual]

Destructor.

PSParseNode (  )  [protected]

Constructor.

PSParseNode ( const PSParseNode in_other  )  [protected]

Copy constructor.

To support "cloning". See Clone() method.

Parameters:
in_other The other node from which to create a copy.

Member Function Documentation

virtual void AcceptVisitor ( IParseTreeVisitor in_visitor  )  [pure virtual]

Node's Accept method, used to pass a visitor.

Parameters:
in_visitor The visitor that is to be used to visit this node.

Implemented in PSFlagParseNode, PSIdentifierParseNode, PSIntervalDataTypeParseNode, PSIntervalLiteralParseNode, PSLiteralParseNode, PSNonTerminalParseNode, PSNullParseNode, PSParameterParseNode, and PSScalarOrAggrFnParseNode.

virtual PSParseNode* AddChild ( PSParseNode in_child  )  [virtual]

Add a child to the end of the list of children.

This method is only valid for a node of type PS_DT_PARENT. After a successful addition, this object owns the added child node.

The default implementation in this class always throw an SEInvalidOperationException. A sub-class of type PS_DT_PARENT must override this method.

Parameters:
in_child The child to add to the end of the list of this node's children. (NOT OWN)
Exceptions:
SEInvalidArgumentException when in_child is NULL.
SEInvalidOperationException if this method does not apply.
Returns:
A pointer to "this" node. (NOT OWN)

Reimplemented in PSNonTerminalParseNode.

virtual PSParseNode* AddChildren ( PSParseNode in_parent  )  [virtual]

Add children from another node to the end of the list of children.

This method is only valid for a node of type PS_DT_PARENT. After a successful addition, this object owns the added child nodes.

The default implementation in this class always throw an SEInvalidOperationException. A sub-class of type PS_DT_PARENT must override this method.

Parameters:
in_parent The parent node containing list of children to be added (NOT OWN)
Exceptions:
SEInvalidArgumentException when in_parent NULL.
SEInvalidOperationException if this method does not apply.
Returns:
A pointer to "this" node. (NOT OWN)

Reimplemented in PSNonTerminalParseNode.

virtual PSParseNode* Clone (  )  const [pure virtual]
virtual PSNonTerminalParseNode* GetAsNonTerminalParseNode (  )  [virtual]

Gets the object as a PSNonTerminalParseNode object.

This default implementation always throws an exception. The appropriate sub-class must override this method.

Exceptions:
SEInvalidOperationException if this object is not of expected type.
Returns:
this object as a PSNonTerminalParseNode object. (NOT OWN)

Reimplemented in PSNonTerminalParseNode.

virtual PSParseNode* GetChild ( simba_size_t  in_childIndex  )  [virtual]

Get a pointer reference to the specified child node.

The caller of this method does not own the returned object.

The default implementation in this class always throws an SEInvalidArgumentException since the default implementation in this class for GetChildCount() always returns 0.

NOTE: 0-based index.

Parameters:
in_childIndex The child index.
Exceptions:
SEInvalidArgumentException when in_childIndex is out of bound
Returns:
A pointer reference to the specified child node. (NOT OWN)

Reimplemented in PSNonTerminalParseNode.

virtual simba_size_t GetChildCount (  )  const [virtual]

Get the number of child nodes that this node has.

The default implementation in this class always returns 0. A sub-class that may have child nodes must override this method.

Returns:
number of child nodes

Reimplemented in PSNonTerminalParseNode.

Simba::SQLEngine::PSNodeIterator GetChildren (  ) 

Get an iterator that iterates through all the child nodes.

Returns:
An iterator that iterates through all child nodes.
virtual PSDataType GetDataType (  )  const [pure virtual]

Returns the data type of this PSParseNode. This method _MUST_ be overriden in subclasses derived from PSParseNode. The implementation should return the data type corresponding to what type of data the PSParseNode contains.

Returns:
The data type for this Parse Node.

Implemented in PSFlagParseNode, PSIdentifierParseNode, PSIntervalDataTypeParseNode, PSIntervalLiteralParseNode, PSLiteralParseNode, PSNonTerminalParseNode, PSNullParseNode, PSParameterParseNode, and PSScalarOrAggrFnParseNode.

virtual PSFlagValue GetFlagValue (  )  const [virtual]

Get the flag value of this PSParseNode. This method is only valid for a PS_DT_FLAG node.

The default implementation in this class always throws an SEInvalidOperationException. A sub-class of type PS_DT_FLAG must override this method.

Exceptions:
SEInvalidOperationException if this method does not apply
Returns:
The PSFlagValue of this PSParseNode.

Reimplemented in PSFlagParseNode.

virtual PSIntervalDataType GetIntervalDataType (  )  const [virtual]

Get the interval data type of this PSParseNode. This method is only valid for a PS_DT_INTERVAL_DATATYPE node.

The default implementation in this class always throws an SEInvalidOperationException. A sub-class of type PS_DT_INTERVAL_DATATYPE must override this method.

Exceptions:
SEInvalidOperationException if this method does not apply
Returns:
The PSIntervalDataType of this PSParseNode.

Reimplemented in PSIntervalDataTypeParseNode.

virtual PSLiteralType GetLiteralType (  )  const [virtual]

Get the literal type of this PSParseNode. This method is only valid for a PS_DT_LITERAL node.

The default implementation in this class always throws an SEInvalidOperationException. A sub-class of type PS_DT_LITERAL must override this method.

Exceptions:
SEInvalidOperationException if this method does not apply
Returns:
The PSLiteralType of this PSParseNode.

Reimplemented in PSIntervalLiteralParseNode, and PSLiteralParseNode.

virtual simba_wstring GetLogString (  )  const [virtual]

Get a string that identifies this object for logging purpose.

Returns:
a logging string

Reimplemented in PSFlagParseNode, PSIdentifierParseNode, PSIntervalDataTypeParseNode, PSIntervalLiteralParseNode, PSLiteralParseNode, PSNonTerminalParseNode, PSNullParseNode, PSParameterParseNode, and PSScalarOrAggrFnParseNode.

virtual PSNonTerminalType GetNonTerminalType (  )  const [virtual]

Retrieve the PSNonTerminalType type.

Returns:
The PSNonTerminalType of this node.

Reimplemented in PSFlagParseNode, and PSNonTerminalParseNode.

virtual bool IsQuoted (  )  const [virtual]

Returns whether or not the node was quoted.

The default implementation in this class always returns false. A sub-class that may have nodes quoted can override this method.

Returns:
Whether or not the node is quoted

Reimplemented in PSIdentifierParseNode.

virtual void SetChild ( simba_size_t  in_childIndex,
PSParseNode in_child 
) [virtual]

Set the given child index to the specified child node.

This function deletes the current child at the specified index.

The default implementation in this class always throws an SEInvalidOperationException. A sub-class of type PS_DT_PARENT must override this method.

Exceptions:
SEInvalidOperationException if this method does not apply.
Parameters:
in_childIndex The child index.
in_child The child to set at the given index. (OWN)

Reimplemented in PSNonTerminalParseNode.

virtual void SetString ( const simba_wstring in_string  )  [virtual]

Sets the string for this node to the given string.

For literal or identifier types, this should be the string for the literal or identifier.

Parameters:
in_string The string to set for this node.
virtual PSParseNode* TakeChild ( simba_size_t  in_childIndex  )  [virtual]

Takes ownership of the child at the given index.

The default implementation in this class always throws an SEInvalidOperationException. A sub-class of type PS_DT_PARENT must override this method.

Exceptions:
SEInvalidOperationException if this method does not apply.
Parameters:
in_childIndex The child index.
virtual const simba_wstring& ToString (  )  const [virtual]

Returns a string representation of this node.

Returns:
The string representation of this node.

Reimplemented in PSFlagParseNode, PSNonTerminalParseNode, PSNullParseNode, PSParameterParseNode, and PSScalarOrAggrFnParseNode.


Member Data Documentation

simba_wstring m_string [protected]

The string representation of this parse node (empty string by default).


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

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba