Main Page Modules Class Hierarchy Compound List File List Compound Members

# NEDCppGenerator Class Reference

`#include <cppgenerator.h>`

List of all members.

## Public Methods

| NEDCppGenerator (ostream &out, ostream &outh, NEDSymbolTable *symtab)
| ~NEDCppGenerator ()
void | setIndentSize (int indentsize)
void | generate (NEDElement *node)

## Protected Types

enum | { MODE_NORMAL, MODE_CLEANUP }

## Protected Methods

const char* | increaseIndent (const char *indent)
const char* | decreaseIndent (const char *indent)
void | generateItem (NEDElement *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | generateChildren (NEDElement *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | generateChildrenWithTags (NEDElement *node, const char *tags, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | generateChildrenExceptTags (NEDElement *node, const char *tags, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
ExpressionNode* | findExpression (NEDElement *parent, const char *target)
| Find given expression node in parent.
ConstNode* | getConstantExpression (ExpressionNode *node)
| If expression consists of a constant, return its pointer, NULL otherwise.
NEDElement* | findFirstChildWithAttribute (NEDElement *node, int tagcode, const char *attr, const char *attrvalue)
| Find first child in node which has given attribute with given value.
void | writeProlog (ostream &out)
void | printTemporaryVariables (const char *indent)
void | beginConditionalBlock (NEDElement *node, const char *&indent, int mode, const char *)
void | endConditionalBlock (NEDElement *node, const char *&indent, int mode, const char *)
void | doNedFile (NedFileNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doNedFiles (NedFilesNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doImports (ImportNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doImport (ImportedFileNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doChannel (ChannelNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doChannelAttr (ChannelAttrNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doNetwork (NetworkNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSimple (SimpleModuleNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doModule (CompoundModuleNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doParams (ParamsNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doParam (ParamNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doGates (GatesNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doGate (GateNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doMachines (MachinesNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doMachine (MachineNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubmodules (SubmodulesNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubmodule (SubmoduleNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubmoduleCleanup (SubmoduleNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubstparams (SubstparamsNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubstparam (SubstparamNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doGatesizes (GatesizesNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doGatesize (GatesizeNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubstmachines (SubstmachinesNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doSubstmachine (SubstmachineNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doConnections (ConnectionsNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | resolveGate (const char *modname, ExpressionNode *modindex, const char *gatename, ExpressionNode *gateindex)
void | resolveConnectionAttributes (ConnectionNode *node, const char *indent, int mode)
void | doConnection (ConnectionNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doConnattr (ConnAttrNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doForloop (ForLoopNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doLoopvar (LoopVarNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doDisplayString (DisplayStringNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doExpression (ExpressionNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doCppinclude (CppincludeNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doCppStruct (CppStructNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doCppCobject (CppCobjectNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doCppNoncobject (CppNoncobjectNode *node, const char *indent, int mode=MODE_NORMAL, const char *arg=NULL)
void | doEnum (EnumNode *node, const char *indent, int mode, const char *)
void | doEnumFields (EnumFieldsNode *node, const char *indent, int mode, const char *)
void | doEnumField (EnumFieldNode *node, const char *indent, int mode, const char *)
void | doMessage (MessageNode *node, const char *, int, const char *)
void | doClass (ClassNode *node, const char *, int, const char *)
void | doStruct (StructNode *node, const char *, int, const char *)
void | prepareForCodeGeneration (NEDElement *node, ClassDesc &cld, FieldDesc *&fld, int &numfields)
void | generateClass (ClassDesc &cld, FieldDesc *&fld, int numfields)
void | generateStruct (ClassDesc &cld, FieldDesc *&fld, int numfields)
void | generateDescriptorClass (ClassDesc &cld, FieldDesc *&fld, int numfields)

## Protected Attributes

ostream& | out
ostream& | outh
bool | in_network
std::string | module_name
std::string | submodule_name
std::string | submodule_var
int | indentsize
CppExpressionGenerator | exprgen
NEDSymbolTable* | symboltable

## Detailed Description

Nedc functionality: generates C++ code from a NED object tree. Assumes object tree has already passed all validation stages (DTD, basic, semantic).

Uses CppExpressionGenerator.

## Constructor & Destructor Documentation

NEDCppGenerator::NEDCppGenerator ( | ostream & out,
| ostream & outh,
| NEDSymbolTable * symtab )

| Constructor. It expects two streams on which it will write the generated code (stream for the C++ source code and stream for the C++ header), and the symbol table.

NEDCppGenerator::~NEDCppGenerator ( | )

| Destructor.

## Member Function Documentation

void NEDCppGenerator::generate ( | NEDElement * node )

| Generate C++ source code. Code will be written to the streams given to the constructor.

void NEDCppGenerator::setIndentSize ( | int indentsize )

| Set indentation in generated C++ source. Default is 4 spaces.

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

- cppgenerator.h