Generates NED code from a NED object tree. More...
#include <ned2generator.h>
Public Member Functions | |
| NED2Generator (NEDErrorStore *errors) | |
| ~NED2Generator () | |
| void | setIndentSize (int indentsize) |
| void | generate (std::ostream &out, NEDElement *node, const char *indent) |
| std::string | 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) |
| void | generateChildrenWithTypes (NEDElement *node, int tagcodes[], const char *indent, const char *arg=0) |
Change indentation level | |
| const char * | increaseIndent (const char *indent) |
| const char * | decreaseIndent (const char *indent) |
Utilities | |
| void | printInheritance (NEDElement *node, const char *indent) |
| bool | hasExpression (NEDElement *node, const char *attr) |
| void | printExpression (NEDElement *node, const char *attr, const char *indent) |
| void | printOptVector (NEDElement *node, const char *attr, const char *indent) |
| void | doMsgClassOrStructBody (NEDElement *msgclassorstruct, const char *indent) |
Getters for comments | |
| std::string | concatInnerComments (NEDElement *node) |
| std::string | getBannerComment (NEDElement *node, const char *indent) |
| std::string | getRightComment (NEDElement *node) |
| std::string | getInlineRightComment (NEDElement *node) |
| std::string | getTrailingComment (NEDElement *node) |
Generate NED code from the given element | |
| void | doFiles (FilesElement *node, const char *indent, bool islast, const char *) |
| void | doNedFile (NedFileElement *node, const char *indent, bool islast, const char *) |
| void | doPackage (PackageElement *node, const char *indent, bool islast, const char *) |
| void | doImport (ImportElement *node, const char *indent, bool islast, const char *) |
| void | doPropertyDecl (PropertyDeclElement *node, const char *indent, bool islast, const char *) |
| void | doExtends (ExtendsElement *node, const char *indent, bool islast, const char *) |
| void | doInterfaceName (InterfaceNameElement *node, const char *indent, bool islast, const char *) |
| void | doSimpleModule (SimpleModuleElement *node, const char *indent, bool islast, const char *) |
| void | doModuleInterface (ModuleInterfaceElement *node, const char *indent, bool islast, const char *) |
| void | doCompoundModule (CompoundModuleElement *node, const char *indent, bool islast, const char *) |
| void | doChannelInterface (ChannelInterfaceElement *node, const char *indent, bool islast, const char *) |
| void | doChannel (ChannelElement *node, const char *indent, bool islast, const char *) |
| void | doParameters (ParametersElement *node, const char *indent, bool islast, const char *) |
| void | doParam (ParamElement *node, const char *indent, bool islast, const char *) |
| void | doProperty (PropertyElement *node, const char *indent, bool islast, const char *) |
| void | doPropertyKey (PropertyKeyElement *node, const char *indent, bool islast, const char *) |
| void | doGates (GatesElement *node, const char *indent, bool islast, const char *) |
| void | doGate (GateElement *node, const char *indent, bool islast, const char *) |
| void | doTypes (TypesElement *node, const char *indent, bool islast, const char *) |
| void | doSubmodules (SubmodulesElement *node, const char *indent, bool islast, const char *) |
| void | doSubmodule (SubmoduleElement *node, const char *indent, bool islast, const char *) |
| void | doConnections (ConnectionsElement *node, const char *indent, bool islast, const char *) |
| void | doConnection (ConnectionElement *node, const char *indent, bool islast, const char *) |
| void | doConnectionGroup (ConnectionGroupElement *node, const char *indent, bool islast, const char *) |
| void | doLoop (LoopElement *node, const char *indent, bool islast, const char *) |
| void | doCondition (ConditionElement *node, const char *indent, bool islast, const char *) |
| void | printConnectionGate (NEDElement *conn, const char *modname, const char *modindexattr, const char *gatename, const char *gateindexattr, bool isplusplus, int gatesubg, const char *indent) |
| void | doExpression (ExpressionElement *node, const char *indent, bool islast, const char *) |
| int | getOperatorPrecedence (const char *op, int args) |
| bool | isOperatorLeftAssoc (const char *op) |
| void | doOperator (OperatorElement *node, const char *indent, bool islast, const char *) |
| void | doFunction (FunctionElement *node, const char *indent, bool islast, const char *) |
| void | doIdent (IdentElement *node, const char *indent, bool islast, const char *) |
| void | doLiteral (LiteralElement *node, const char *indent, bool islast, const char *) |
| void | doMsgFile (MsgFileElement *node, const char *indent, bool islast, const char *) |
| void | doNamespace (NamespaceElement *node, const char *indent, bool islast, const char *) |
| void | doCplusplus (CplusplusElement *node, const char *indent, bool islast, const char *) |
| void | doStructDecl (StructDeclElement *node, const char *indent, bool islast, const char *) |
| void | doClassDecl (ClassDeclElement *node, const char *indent, bool islast, const char *) |
| void | doMessageDecl (MessageDeclElement *node, const char *indent, bool islast, const char *) |
| void | doPacketDecl (PacketDeclElement *node, const char *indent, bool islast, const char *) |
| void | doEnumDecl (EnumDeclElement *node, const char *indent, bool islast, const char *) |
| void | doEnum (EnumElement *node, const char *indent, bool islast, const char *) |
| void | doEnumFields (EnumFieldsElement *node, const char *indent, bool islast, const char *) |
| void | doEnumField (EnumFieldElement *node, const char *indent, bool islast, const char *) |
| void | doMessage (MessageElement *node, const char *indent, bool islast, const char *) |
| void | doPacket (PacketElement *node, const char *indent, bool islast, const char *) |
| void | doClass (ClassElement *node, const char *indent, bool islast, const char *) |
| void | doStruct (StructElement *node, const char *indent, bool islast, const char *) |
| void | doField (FieldElement *node, const char *indent, bool islast, const char *) |
| void | doComment (CommentElement *node, const char *indent, bool islast, const char *) |
Protected Attributes | |
| int | indentsize |
| std::ostream * | outp |
| NEDErrorStore * | errors |
Generates NED code from a NED object tree.
Assumes object tree has already passed all validation stages (DTD, syntax, semantic).
| NED2Generator::NED2Generator | ( | NEDErrorStore * | errors | ) |
Constructor.
| NED2Generator::~NED2Generator | ( | ) |
Destructor.
| std::string NED2Generator::concatInnerComments | ( | NEDElement * | node | ) | [protected] |
| const char* NED2Generator::decreaseIndent | ( | const char * | indent | ) | [protected] |
| void NED2Generator::doChannel | ( | ChannelElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doChannelInterface | ( | ChannelInterfaceElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doClass | ( | ClassElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doClassDecl | ( | ClassDeclElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doComment | ( | CommentElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doCompoundModule | ( | CompoundModuleElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doCondition | ( | ConditionElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doConnection | ( | ConnectionElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doConnectionGroup | ( | ConnectionGroupElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doConnections | ( | ConnectionsElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doCplusplus | ( | CplusplusElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doEnum | ( | EnumElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doEnumDecl | ( | EnumDeclElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doEnumField | ( | EnumFieldElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doEnumFields | ( | EnumFieldsElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doExpression | ( | ExpressionElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doExtends | ( | ExtendsElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doField | ( | FieldElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doFiles | ( | FilesElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doFunction | ( | FunctionElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doGate | ( | GateElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doGates | ( | GatesElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doIdent | ( | IdentElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doImport | ( | ImportElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doInterfaceName | ( | InterfaceNameElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doLiteral | ( | LiteralElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doLoop | ( | LoopElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doMessage | ( | MessageElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doMessageDecl | ( | MessageDeclElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doModuleInterface | ( | ModuleInterfaceElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doMsgClassOrStructBody | ( | NEDElement * | msgclassorstruct, | |
| const char * | indent | |||
| ) | [protected] |
| void NED2Generator::doMsgFile | ( | MsgFileElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doNamespace | ( | NamespaceElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doNedFile | ( | NedFileElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doOperator | ( | OperatorElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doPackage | ( | PackageElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doPacket | ( | PacketElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doPacketDecl | ( | PacketDeclElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doParam | ( | ParamElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doParameters | ( | ParametersElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doProperty | ( | PropertyElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doPropertyDecl | ( | PropertyDeclElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doPropertyKey | ( | PropertyKeyElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doSimpleModule | ( | SimpleModuleElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doStruct | ( | StructElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doStructDecl | ( | StructDeclElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doSubmodule | ( | SubmoduleElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doSubmodules | ( | SubmodulesElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| void NED2Generator::doTypes | ( | TypesElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | ||||
| ) | [protected] |
| std::string NED2Generator::generate | ( | NEDElement * | node, | |
| const char * | indent | |||
| ) |
Generates NED code and returns it as a string.
| void NED2Generator::generate | ( | std::ostream & | out, | |
| NEDElement * | node, | |||
| const char * | indent | |||
| ) |
Generates NED code.
Takes an output stream where the generated NED code will be written, the object tree and the base indentation.
| void NED2Generator::generateChildren | ( | NEDElement * | node, | |
| const char * | indent, | |||
| const char * | arg = NULL | |||
| ) | [protected] |
Invoke generateNedItem() on all children.
| void NED2Generator::generateChildrenWithType | ( | NEDElement * | node, | |
| int | tagcode, | |||
| const char * | indent, | |||
| const char * | arg = 0 | |||
| ) | [protected] |
Invoke generateNedItem() on all children of the given tagcode.
| void NED2Generator::generateChildrenWithTypes | ( | NEDElement * | node, | |
| int | tagcodes[], | |||
| const char * | indent, | |||
| const char * | arg = 0 | |||
| ) | [protected] |
Invoke generateNedItem() on children of the given tagcodes (NED_NULL-terminated array).
| void NED2Generator::generateNedItem | ( | NEDElement * | node, | |
| const char * | indent, | |||
| bool | islast, | |||
| const char * | arg = NULL | |||
| ) | [protected] |
Dispatch to various doXXX() methods according to node type.
| std::string NED2Generator::getBannerComment | ( | NEDElement * | node, | |
| const char * | indent | |||
| ) | [protected] |
| std::string NED2Generator::getInlineRightComment | ( | NEDElement * | node | ) | [protected] |
| int NED2Generator::getOperatorPrecedence | ( | const char * | op, | |
| int | args | |||
| ) | [protected] |
| std::string NED2Generator::getRightComment | ( | NEDElement * | node | ) | [protected] |
| std::string NED2Generator::getTrailingComment | ( | NEDElement * | node | ) | [protected] |
| bool NED2Generator::hasExpression | ( | NEDElement * | node, | |
| const char * | attr | |||
| ) | [protected] |
| const char* NED2Generator::increaseIndent | ( | const char * | indent | ) | [protected] |
| bool NED2Generator::isOperatorLeftAssoc | ( | const char * | op | ) | [protected] |
| void NED2Generator::printConnectionGate | ( | NEDElement * | conn, | |
| const char * | modname, | |||
| const char * | modindexattr, | |||
| const char * | gatename, | |||
| const char * | gateindexattr, | |||
| bool | isplusplus, | |||
| int | gatesubg, | |||
| const char * | indent | |||
| ) | [protected] |
| void NED2Generator::printExpression | ( | NEDElement * | node, | |
| const char * | attr, | |||
| const char * | indent | |||
| ) | [protected] |
| void NED2Generator::printInheritance | ( | NEDElement * | node, | |
| const char * | indent | |||
| ) | [protected] |
| void NED2Generator::printOptVector | ( | NEDElement * | node, | |
| const char * | attr, | |||
| const char * | indent | |||
| ) | [protected] |
| void NED2Generator::setIndentSize | ( | int | indentsize | ) |
Sets the indent size in the generated NED code.
Default is 4 spaces.
NEDErrorStore* NED2Generator::errors [protected] |
int NED2Generator::indentsize [protected] |
std::ostream* NED2Generator::outp [protected] |
1.6.3