Ast Class Reference
[AST Processing]

#include <Ast.h>

Collaboration diagram for Ast:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class allows to use iterators on the AST; it is different to the AstProcessing classes because no visit function needs to be implemented.

usage: Ast x(mystartnode); for(Ast::iterator i=x.begin();i!=x.end();x++) { MYCODE }

The iterator refers to pointers of AST nodes, it never holds a null-pointer of the traversed tree.

Todo:
(DQ 2/1/2006): Could we please change the name of this class, it is not an AST.


Public Types

typedef SgNode elementType
typedef elementTypepointer
typedef elementTypereference
typedef size_t size_type

Public Member Functions

 Ast (SgNode *astNode)
 the argument is the root node of tree to iterate on
SgNodeoperator * ()
iterator begin ()
 the returned iterator holds a pointer to the root node of the tree to be traversed
iterator end ()
 use this method to check for the end of the iteration (do not use '0')

Protected Types

typedef std::vector< SgNode * > NodeList

Static Protected Member Functions

static NodeList successors (SgNode *astNode)
static unsigned int numSuccessors (SgNode *astNode)
static NodeList rightSiblings (SgNode *astNode)
static unsigned int numRightSiblings (SgNode *astNode)
static SgNodenextRightSibling (SgNode *astNode)
static SgNodeparent (SgNode *astNode)

Static Private Member Functions

static SgNodefirst (NodeList l)

Private Attributes

SgNodestartNode

Classes

class  iterator


Member Typedef Documentation

typedef SgNode Ast::elementType

typedef elementType* Ast::pointer

typedef elementType& Ast::reference

typedef size_t Ast::size_type

typedef std::vector<SgNode*> Ast::NodeList [protected]


Constructor & Destructor Documentation

Ast::Ast ( SgNode astNode  ) 

the argument is the root node of tree to iterate on


Member Function Documentation

SgNode* Ast::operator * (  ) 

iterator Ast::begin (  )  [inline]

the returned iterator holds a pointer to the root node of the tree to be traversed

iterator Ast::end (  )  [inline]

use this method to check for the end of the iteration (do not use '0')

static NodeList Ast::successors ( SgNode astNode  )  [static, protected]

static unsigned int Ast::numSuccessors ( SgNode astNode  )  [static, protected]

static NodeList Ast::rightSiblings ( SgNode astNode  )  [static, protected]

static unsigned int Ast::numRightSiblings ( SgNode astNode  )  [static, protected]

static SgNode* Ast::nextRightSibling ( SgNode astNode  )  [static, protected]

static SgNode* Ast::parent ( SgNode astNode  )  [static, protected]

static SgNode* Ast::first ( NodeList  l  )  [inline, static, private]


Member Data Documentation

SgNode* Ast::startNode [private]


The documentation for this class was generated from the following file:
Generated on Mon Aug 30 21:33:23 2010 for ROSE by  doxygen 1.4.7