| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Attributes | List of all members
erpcgen::AstNode Class Reference

Homogeneous AST node class. More...

`#include <AstNode.h>`

## Public Types
typedef std::map< std::string, Value * > | attribute_map_t
typedef std::vector< AstNode * > | child_list_t
typedef child_list_t::iterator | iterator
typedef child_list_t::const_iterator | const_iterator

## Public Member Functions
| AstNode (const Token &token)
| This function is constructor of AstNode class. More...
| AstNode (Token &token, AstNode *parent)
| This function is constructor of AstNode class. More...
| AstNode (const AstNode &other)
| This function is copy constructor of AstNode class. More...
AstNode & | operator= (const AstNode &other)
| Assignment operator. More...
virtual | ~AstNode ()
| This function is destructor of AstNode class. More...
virtual AstNode * | clone () const
| This function returns an exact duplicate of this object. More...
virtual std::string | nodeName () const
| This function returns name of this node. More...
std::string | getDescription () const
| This function returns string description of the node. More...
Token
Token & | getToken ()
| This function returns token of this node. More...
const Token & | getToken () const
| This function returns constant token of this node. More...
void | setToken (Token &token)
| This function set token to this node. More...
Value * | getTokenValue ()
| This function returns value of token of this node. More...
std::string | getTokenString ()
| This function returns string representation of this node token value. More...
Parent
AstNode * | getParent () const
| This function returns pointer to parent node. More...
void | setParent (AstNode *newParent)
| This function set parent for this node. More...
Attribute
size_t | attributeCount () const
| This function returns count of node attributes. More...
bool | hasAttribute (const std::string &name) const
| This function find attribute in AstNode attributes. More...
Value * | getAttribute (const std::string &name)
| This function return attribute from AstNode attributes. More...
void | setAttribute (const std::string &name, Value *node)
| This function set attribute in AstNode attributes. More...
void | removeAttribute (const std::string &name)
| This function remove attribute from AstNode attributes. More...
Value *& | operator[] (const std::string &name)
| Square brackets. More...
Children
void | appendChild (AstNode *node)
| This function add given node to the end of children list for current AstNode. More...
size_t | childCount () const
| This function return count of children for current node. More...
AstNode * | getChild (int index) const
| This function return child node from node children. More...
size_t | getIndexOfChild (AstNode *child)
| This function return index of searched child node. More...
size_t | getIndex ()
| This function return index of current node in parent's list of children. More...
void | replaceChild (AstNode *original, AstNode *replacement)
| This function replace child in AstNode tree. More...
void | reverseExpr ()
| This function replace children location in AstNode tree. More...
AstNode *& | operator[] (int index)
| Square brackets. More...
const AstNode * | operator[] (int index) const
| Square brackets. More...
Child iterators
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const

## Protected Attributes
Token | m_token
AstNode * | m_parent
attribute_map_t | m_attributes
child_list_t | m_children

## Detailed Description

Homogeneous AST node class.

This class is meant to represent arbitrary AST nodes. Each node optionally has a Token object associated with it. It has an ordered list of child nodes and a pointer to its parent. Named attribute values can be set on a node. The attribute values are members of the Value class hierarchy of boxed types.

## Member Typedef Documentation

typedef std::map<std::string, Value *> erpcgen::AstNode::attribute_map_t

Map type of named attributes.

typedef std::vector<AstNode *> erpcgen::AstNode::child_list_t

Vector of AstNode children.

typedef child_list_t::const_iterator erpcgen::AstNode::const_iterator

Constant iterator of AstNode children vector.

typedef child_list_t::iterator erpcgen::AstNode::iterator

Iterator of AstNode children vector.

## Constructor & Destructor Documentation

erpcgen::AstNode::AstNode | ( | const Token & | token | ) |
| inline

This function is constructor of AstNode class.

This function set parent AstNode variable for this object to nullptr and token variable for this object to given token.

Parameters

  [in] | token | Constant reference to token.

See also
  AstNode::AstNode(Token * token, AstNode * parent)
  AstNode::AstNode(const AstNode & other)

erpcgen::AstNode::AstNode | ( | Token & | token,
|  | AstNode * | parent
| ) |  |
| inline

This function is constructor of AstNode class.

This function set parent AstNode variable for this object to given node and token variable for this object to given token.

Parameters

  [in] | token | Pointer to given token.
  [in] | parent | Pointer to given parent node.

See also
  AstNode::AstNode(Token * token)
  AstNode::AstNode(const AstNode & other)

AstNode::AstNode | ( | const AstNode & | other | ) |

This function is copy constructor of AstNode class.

This function copy data from given node to this object.

Parameters

  [in] | other | Given node.

See also
  AstNode::AstNode(Token * token)
  AstNode::AstNode(Token * token, AstNode * parent)

AstNode::~AstNode | ( |  | ) |
| virtual

This function is destructor of AstNode class.

This function also call for children destructors.

## Member Function Documentation

void AstNode::appendChild | ( | AstNode * | node | ) |

This function add given node to the end of children list for current AstNode.

If node is NULL then a NULL pointer is added to the children list. The list node's location is automatically updated after the node is added by a call to updateLocation().

Parameters

  [in] | node | Child node for current AstNode.

size_t erpcgen::AstNode::attributeCount | ( |  | ) | const
| inline

This function returns count of node attributes.

Returns
  Size of node attributes.

size_t erpcgen::AstNode::childCount | ( |  | ) | const
| inline

This function return count of children for current node.

Returns
  Count of children for current node.

virtual AstNode* erpcgen::AstNode::clone | ( |  | ) | const
| inline virtual

This function returns an exact duplicate of this object.

Returns
  Pointer to new (cloned) AstNode object.

Value * AstNode::getAttribute | ( | const std::string & | name | ) |

This function return attribute from AstNode attributes.

This function return attribute from giving name in AstNode attributes.

Parameters

  [in] | name | Name for AstNode attribute.

Returns

See also
  bool AstNode::hasAttribute() const
  void AstNode::setAttribute()
  void AstNode::removeAttribute()

AstNode* erpcgen::AstNode::getChild | ( | int | index | ) | const
| inline

This function return child node from node children.

Parameters

  [in] | index | Index of node child.

Returns
  Pointer to searched child node.

See also
  size_t AstNode::getIndex()
  size_t getIndexOfChild()

string AstNode::getDescription | ( |  | ) | const

This function returns string description of the node.

Returns
  String description of the node.

size_t AstNode::getIndex | ( |  | ) |

This function return index of current node in parent's list of children.

Returns
  Return value is from parent getIndexOfChild.

See also
  size_t AstNode::getIndexOfChild()
  AstNode * getChild()

size_t AstNode::getIndexOfChild | ( | AstNode * | child | ) |

This function return index of searched child node.

Parameters

  [in] | child | Searched child node for current AstNode.

Returns
  Index of searched child node.

Return values

  -1 | If child was not found.

See also
  size_t AstNode::getIndex()
  AstNode * getChild()

AstNode* erpcgen::AstNode::getParent | ( |  | ) | const
| inline

This function returns pointer to parent node.

Returns
  Pointer to parent node.

Token& erpcgen::AstNode::getToken | ( |  | ) |
| inline

This function returns token of this node.

Returns
  Node token.

See also
  const Token & getToken()

const Token& erpcgen::AstNode::getToken | ( |  | ) | const
| inline

This function returns constant token of this node.

Returns
  Node constant token pointer.

See also
  Token & getToken()

std::string erpcgen::AstNode::getTokenString | ( |  | ) |
| inline

This function returns string representation of this node token value.

Returns
  Node token value string representation.

Value* erpcgen::AstNode::getTokenValue | ( |  | ) |
| inline

This function returns value of token of this node.

Returns
  Node token value pointer.

bool AstNode::hasAttribute | ( | const std::string & | name | ) | const

This function find attribute in AstNode attributes.

This function find attribute from giving name in AstNode attributes.

Parameters

  [in] | name | Name for AstNode attribute.

Returns
  True if attribute was found.

See also
  Value* AstNode::getAttribute()
  void AstNode::setAttribute()
  void AstNode::removeAttribute()

virtual std::string erpcgen::AstNode::nodeName | ( |  | ) | const
| inline virtual

This function returns name of this node.

Returns
  Node name as string representation.

AstNode & AstNode::operator= | ( | const AstNode & | other | ) |

Assignment operator.

This function copy data from one to second node, when assignment operator is used.

Parameters

  [in] | other | Other is AstNode, from which are copied data to second AstNode.

Returns
  Second AstNode object.

Value*& erpcgen::AstNode::operator[] | ( | const std::string & | name | ) |
| inline

Square brackets.

This function return node attribute from attributes. Attribute is requested by given attribute name in square brackets.

Parameters

  [in] | name | Name of searched attribute.

Returns
  Node attribute.

AstNode*& erpcgen::AstNode::operator[] | ( | int | index | ) |
| inline

Square brackets.

This function return node from this node children list. Attribute is requested by given attribute index number in square brackets.

Parameters

  [in] | index | Index of searched child node.

Returns
  Node child.

See also
  const AstNode *& operator [] ()

const AstNode* erpcgen::AstNode::operator[] | ( | int | index | ) | const
| inline

Square brackets.

This function return const node from this node children list. Attribute is requested by given attribute index number in square brackets.

Parameters

  [in] | index | Index of searched child node.

Returns
  Node child const node.

See also
  AstNode *& operator [] ()

void AstNode::removeAttribute | ( | const std::string & | name | ) |

This function remove attribute from AstNode attributes.

This function remove attribute from giving name in AstNode attributes.

Parameters

  [in] | name | Name for AstNode attribute.

See also
  bool AstNode::hasAttribute() const
  Value* AstNode::getAttribute()
  void AstNode::setAttribute()

void AstNode::replaceChild | ( | AstNode * | original,
|  | AstNode * | replacement
| ) |  |

This function replace child in AstNode tree.

This function replace original AstNode child with replacement.

Parameters

  [in] | original | Original AstNode child.
  [in] | replacement | Replacement AstNode child.

See also
  void AstNode::reverseExpr()

void AstNode::reverseExpr | ( |  | ) |

This function replace children location in AstNode tree.

This function move top of array AstNode node in AstNode tree to bottom of tree.

See also
  void AstNode::replaceChild()

void AstNode::setAttribute | ( | const std::string & | name,
|  | Value * | node
| ) |  |

This function set attribute in AstNode attributes.

This function set attribute for giving name and node in AstNode attributes.

Parameters

  [in] | name | Name for AstNode attribute.
  [in] | node | AstNode attribute.

See also
  bool AstNode::hasAttribute() const
  Value* AstNode::getAttribute()
  void AstNode::removeAttribute()

void erpcgen::AstNode::setParent | ( | AstNode * | newParent | ) |
| inline

This function set parent for this node.

Parameters

  [in] | newParent | Pointer to given parent node.

void erpcgen::AstNode::setToken | ( | Token & | token | ) |
| inline

This function set token to this node.

Parameters

  [in] | token | Pointer to given token.

## Member Data Documentation

attribute_map_t erpcgen::AstNode::m_attributes
| protected

Map of named attributes.

child_list_t erpcgen::AstNode::m_children
| protected

Ordered list of children of this node.

AstNode* erpcgen::AstNode::m_parent
| protected

Pointer to parent node of this object. May be NULL.

Token erpcgen::AstNode::m_token
| protected

The token associated with this node.

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

- AstNode.h
- AstNode.cpp