Main Page Modules Class Hierarchy Compound List File List Compound Members

# CppExpressionGenerator Class Reference

`#include <cppexprgenerator.h>`

List of all members.

## Public Methods

| CppExpressionGenerator (ostream &out)
| ~CppExpressionGenerator ()
void | collectExpressions (NEDElement *node)
void | generateExpressionClasses ()
void | generateExpressionUsage (ExpressionNode *expr, const char *indent)

## Protected Types

typedef std::vector<NEDElement *> | NEDElementVector
typedef std::map<ExpressionNode *, ExpressionInfo> | NEDExpressionMap
enum | { MODE_INLINE_EXPRESSION, MODE_EXPRESSION_CLASS }

## Protected Methods

void | doExtractArgs (ExpressionInfo &info, NEDElement *node)
void | doCollectExpressions (NEDElement *node)
void | collectExpressionInfo (ExpressionNode *expr)
void | generateExpressionClass (ExpressionInfo &info)
const char* | getTypeForArg (NEDElement *node)
const char* | getNameForArg (NEDElement *node)
void | doValueForArg (NEDElement *node)
void | doValueForCachedVar (NEDElement *node)
void | generateChildren (NEDElement *node, const char *indent, int mode)
void | generateItem (NEDElement *node, const char *indent, int mode)
void | doOperator (OperatorNode *node, const char *indent, int mode)
void | doFunction (FunctionNode *node, const char *indent, int mode)
void | doParamref (ParamRefNode *node, const char *indent, int mode)
void | doIdent (IdentNode *node, const char *indent, int mode)
void | doConst (ConstNode *node, const char *indent, int mode)
void | doExpression (ExpressionNode *node, const char *indent, int mode)
bool | needsExpressionClass (ExpressionNode *expr)

## Protected Attributes

ostream& | out
NEDExpressionMap | exprMap

## Static Protected Attributes

int | count

## Detailed Description

Helper class for NEDCppGenerator. Should be used in the following manner:

1. before entering a module declaration, collectExpressions() and generateExpressionClasses() should be called

2. inside the module, where expressions are actually used, generateExpressionUsage() should be called after outputting text like "value="

The internal needsExpressionClass() method decides which expressions are compiled inline and which with expression classes.

## Constructor & Destructor Documentation

CppExpressionGenerator::CppExpressionGenerator ( | ostream & out )

| Constructor.

CppExpressionGenerator::~CppExpressionGenerator ( | )`[inline]`

| Destructor.

## Member Function Documentation

void CppExpressionGenerator::collectExpressions ( | NEDElement * node )

| Recursively finds all <expression> tags within the passed node, and stores references to them.

void CppExpressionGenerator::generateExpressionClasses ( | )

| Generate compiled expression classes (those derived from cExpression) from all stored expressions. The evaluate() methods of the generated classes will hold the expressions.

void CppExpressionGenerator::generateExpressionUsage ( | ExpressionNode * expr,
| const char * indent )

| Generate a cPar initialization code that uses the compiled expression classes generated by generateExpressionClasses().

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

- cppexprgenerator.h