# NEDGenerator Class Reference
[Generating NED]

`#include <nedgenerator.h>`

List of all members.

## Detailed Description

Generates NED code from a NED object tree.

Assumes object tree has already passed all validation stages (DTD, basic, semantic).

## Public Member Functions

| NEDGenerator (ostream &out)
| ~NEDGenerator ()
void | setIndentSize (int indentsize)
void | setNewSyntax (bool value)
void | generate (NEDElement *node, const char *indent)

## Protected Member Functions

void | generateNedItem (NEDElement *node, const char *indent, bool islast, const char *arg=NULL)
void | generateChildren (NEDElement *node, const char *indent, const char *arg=NULL)
void | generateChildrenWithType (NEDElement *node, int tagcode, const char *indent, const char *arg=0)
Change indentation level
const char * | increaseIndent (const char *indent)
const char * | decreaseIndent (const char *indent)
Utilities
void | printExpression (NEDElement *node, const char *attr, const char *indent)
void | printVector (NEDElement *node, const char *attr, const char *indent)
void | printIfExpression (NEDElement *node, const char *attr, const char *indent)
Format and write comments to the output
void | appendBannerComment (const char *comment, const char *indent)
void | appendRightComment (const char *comment, const char *indent)
void | appendInlineRightComment (const char *comment, const char *indent)
void | appendTrailingComment (const char *comment, const char *indent)
Generate NED code from the given element
void | doNedfiles (NedFilesNode *node, const char *indent, bool islast, const char *)
void | doNedfile (NedFileNode *node, const char *indent, bool islast, const char *)
void | doImports (ImportNode *node, const char *indent, bool islast, const char *)
void | doImport (ImportedFileNode *node, const char *indent, bool islast, const char *)
void | doChannel (ChannelNode *node, const char *indent, bool islast, const char *)
void | doChanattr (ChannelAttrNode *node, const char *indent, bool islast, const char *)
void | doNetwork (NetworkNode *node, const char *indent, bool islast, const char *)
void | doSimple (SimpleModuleNode *node, const char *indent, bool islast, const char *)
void | doModule (CompoundModuleNode *node, const char *indent, bool islast, const char *)
void | doParams (ParamsNode *node, const char *indent, bool islast, const char *)
void | doParam (ParamNode *node, const char *indent, bool islast, const char *)
void | doGates (GatesNode *node, const char *indent, bool islast, const char *)
void | doGate (GateNode *node, const char *indent, bool islast, const char *)
void | doMachines (MachinesNode *node, const char *indent, bool islast, const char *)
void | doMachine (MachineNode *node, const char *indent, bool islast, const char *)
void | doSubmodules (SubmodulesNode *node, const char *indent, bool islast, const char *)
void | doSubmodule (SubmoduleNode *node, const char *indent, bool islast, const char *)
void | doSubstparams (SubstparamsNode *node, const char *indent, bool islast, const char *)
void | doSubstparam (SubstparamNode *node, const char *indent, bool islast, const char *)
void | doGatesizes (GatesizesNode *node, const char *indent, bool islast, const char *)
void | doGatesize (GatesizeNode *node, const char *indent, bool islast, const char *)
void | doSubstmachines (SubstmachinesNode *node, const char *indent, bool islast, const char *)
void | doSubstmachine (SubstmachineNode *node, const char *indent, bool islast, const char *)
void | doConnections (ConnectionsNode *node, const char *indent, bool islast, const char *)
void | printGate (NEDElement *conn, const char *modname, const char *modindexattr, const char *gatename, const char *gateindexattr, bool isplusplus, const char *indent)
void | doConnection (ConnectionNode *node, const char *indent, bool islast, const char *)
void | doConnattr (ConnAttrNode *node, const char *indent, bool islast, const char *arrow)
void | doForloop (ForLoopNode *node, const char *indent, bool islast, const char *)
void | doLoopvar (LoopVarNode *node, const char *indent, bool islast, const char *)
void | doDisplaystring (DisplayStringNode *node, const char *indent, bool islast, const char *)
void | doExpression (ExpressionNode *node, const char *indent, bool islast, const char *)
int | getOperatorPriority (const char *op, int args)
bool | isOperatorLeftAssoc (const char *op)
void | doOperator (OperatorNode *node, const char *indent, bool islast, const char *)
void | doFunction (FunctionNode *node, const char *indent, bool islast, const char *)
void | doParamref (ParamRefNode *node, const char *indent, bool islast, const char *)
void | doIdent (IdentNode *node, const char *indent, bool islast, const char *)
void | doConst (ConstNode *node, const char *indent, bool islast, const char *)
void | doCplusplus (CplusplusNode *node, const char *indent, bool islast, const char *)
void | doStructDecl (StructDeclNode *node, const char *indent, bool islast, const char *)
void | doClassDecl (ClassDeclNode *node, const char *indent, bool islast, const char *)
void | doMessageDecl (MessageDeclNode *node, const char *indent, bool islast, const char *)
void | doEnumDecl (EnumDeclNode *node, const char *indent, bool islast, const char *)
void | doEnum (EnumNode *node, const char *indent, bool islast, const char *)
void | doEnumFields (EnumFieldsNode *node, const char *indent, bool islast, const char *)
void | doEnumField (EnumFieldNode *node, const char *indent, bool islast, const char *)
void | doMessage (MessageNode *node, const char *indent, bool islast, const char *)
void | doClass (ClassNode *node, const char *indent, bool islast, const char *)
void | doStruct (StructNode *node, const char *indent, bool islast, const char *)
void | doFields (FieldsNode *node, const char *indent, bool islast, const char *)
void | doField (FieldNode *node, const char *indent, bool islast, const char *)
void | doProperties (PropertiesNode *node, const char *indent, bool islast, const char *)
void | doProperty (PropertyNode *node, const char *indent, bool islast, const char *)

## Protected Attributes

bool | newsyntax
int | indentsize
ostream & | out

## Constructor & Destructor Documentation

NEDGenerator::NEDGenerator | ( | ostream & | out | ) |

| Constructor. Takes an output stream where the generated NED code will be written.

NEDGenerator::~NEDGenerator | ( |  | ) |

| Destructor.

## Member Function Documentation

void NEDGenerator::appendBannerComment | ( | const char * | comment,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::appendInlineRightComment | ( | const char * | comment,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::appendRightComment | ( | const char * | comment,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::appendTrailingComment | ( | const char * | comment,
|  | const char * | indent
| ) | `[protected]`

const char* NEDGenerator::decreaseIndent | ( | const char * | indent | ) | `[protected]`

void NEDGenerator::doChanattr | ( | ChannelAttrNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doChannel | ( | ChannelNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doClass | ( | ClassNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doClassDecl | ( | ClassDeclNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doConnattr | ( | ConnAttrNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * | arrow
| ) | `[protected]`

void NEDGenerator::doConnection | ( | ConnectionNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doConnections | ( | ConnectionsNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doConst | ( | ConstNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doCplusplus | ( | CplusplusNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doDisplaystring | ( | DisplayStringNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doEnum | ( | EnumNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doEnumDecl | ( | EnumDeclNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doEnumField | ( | EnumFieldNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doEnumFields | ( | EnumFieldsNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doExpression | ( | ExpressionNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doField | ( | FieldNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doFields | ( | FieldsNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doForloop | ( | ForLoopNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doFunction | ( | FunctionNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doGate | ( | GateNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doGates | ( | GatesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doGatesize | ( | GatesizeNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doGatesizes | ( | GatesizesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doIdent | ( | IdentNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doImport | ( | ImportedFileNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doImports | ( | ImportNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doLoopvar | ( | LoopVarNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doMachine | ( | MachineNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doMachines | ( | MachinesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doMessage | ( | MessageNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doMessageDecl | ( | MessageDeclNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doModule | ( | CompoundModuleNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doNedfile | ( | NedFileNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doNedfiles | ( | NedFilesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doNetwork | ( | NetworkNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doOperator | ( | OperatorNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doParam | ( | ParamNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doParamref | ( | ParamRefNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doParams | ( | ParamsNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doProperties | ( | PropertiesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doProperty | ( | PropertyNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSimple | ( | SimpleModuleNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doStruct | ( | StructNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doStructDecl | ( | StructDeclNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSubmodule | ( | SubmoduleNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSubmodules | ( | SubmodulesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSubstmachine | ( | SubstmachineNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSubstmachines | ( | SubstmachinesNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSubstparam | ( | SubstparamNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::doSubstparams | ( | SubstparamsNode * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * |
| ) | `[protected]`

void NEDGenerator::generate | ( | NEDElement * | node,
|  | const char * | indent
| ) |

| Generates NED code. Takes object tree and base indentation.

void NEDGenerator::generateChildren | ( | NEDElement * | node,
|  | const char * | indent,
|  | const char * | arg = `NULL`
| ) | `[protected]`

| Invoke generateNedItem() with all children.

void NEDGenerator::generateChildrenWithType | ( | NEDElement * | node,
|  | int | tagcode,
|  | const char * | indent,
|  | const char * | arg = `0`
| ) | `[protected]`

| Invoke generateNedItem() with all children of the given tagcode.

void NEDGenerator::generateNedItem | ( | NEDElement * | node,
|  | const char * | indent,
|  | bool | islast,
|  | const char * | arg = `NULL`
| ) | `[protected]`

| Dispatch to various doXXX() methods according to node type.

int NEDGenerator::getOperatorPriority | ( | const char * | op,
|  | int | args
| ) | `[protected]`

const char* NEDGenerator::increaseIndent | ( | const char * | indent | ) | `[protected]`

bool NEDGenerator::isOperatorLeftAssoc | ( | const char * | op | ) | `[protected]`

void NEDGenerator::printExpression | ( | NEDElement * | node,
|  | const char * | attr,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::printGate | ( | NEDElement * | conn,
|  | const char * | modname,
|  | const char * | modindexattr,
|  | const char * | gatename,
|  | const char * | gateindexattr,
|  | bool | isplusplus,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::printIfExpression | ( | NEDElement * | node,
|  | const char * | attr,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::printVector | ( | NEDElement * | node,
|  | const char * | attr,
|  | const char * | indent
| ) | `[protected]`

void NEDGenerator::setIndentSize | ( | int | indentsize | ) |

| Sets the indent size in the generated NED code. Default is 4 spaces.

void NEDGenerator::setNewSyntax | ( | bool | value | ) |

| Sets if new NED syntax (e.g. using curly braces like module { ... } instead of module ... endmodule) should be used. Default is true.

## Member Data Documentation

int NEDGenerator::indentsize`[protected]`

bool NEDGenerator::newsyntax`[protected]`

ostream& NEDGenerator::out`[protected]`

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

- nedgenerator.h