ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ast Class Reference

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

#include <Ast.h>

Collaboration diagram for Ast:

Classes

class  iterator
 

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 More...
 
SgNodeoperator* ()
 
iterator begin ()
 the returned iterator holds a pointer to the root node of the tree to be traversed More...
 
iterator end ()
 use this method to check for the end of the iteration (do not use '0') More...
 

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
 

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.

Class that provides an iterator for the ROSE AST.

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.

Definition at line 20 of file Ast.h.

Member Typedef Documentation

Definition at line 22 of file Ast.h.

Definition at line 23 of file Ast.h.

Definition at line 24 of file Ast.h.

typedef size_t Ast::size_type

Definition at line 25 of file Ast.h.

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

Definition at line 62 of file Ast.h.

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

Definition at line 57 of file Ast.h.

References startNode.

iterator Ast::end ( )
inline

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

Definition at line 59 of file Ast.h.

static NodeList Ast::successors ( SgNode astNode)
staticprotected
static unsigned int Ast::numSuccessors ( SgNode astNode)
staticprotected
static NodeList Ast::rightSiblings ( SgNode astNode)
staticprotected
static unsigned int Ast::numRightSiblings ( SgNode astNode)
staticprotected
static SgNode* Ast::nextRightSibling ( SgNode astNode)
staticprotected
static SgNode* Ast::parent ( SgNode astNode)
staticprotected
static SgNode* Ast::first ( NodeList  l)
inlinestaticprivate

Definition at line 70 of file Ast.h.

Member Data Documentation

SgNode* Ast::startNode
private

Definition at line 71 of file Ast.h.

Referenced by begin().


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