- Main Page
- Modules
- Classes
- Files
- Directories

- File List
- File Members

# nedgenerator.h

Go to the documentation of this file.

    00001 //==========================================================================
    00002 //  NEDGENERATOR.H - part of
    00003 //
    00004 //                     OMNeT++/OMNEST
    00005 //            Discrete System Simulation in C++
    00006 //
    00007 //==========================================================================
    00008
    00009 /*--------------------------------------------------------------*
    00010   Copyright (C) 2002-2005 Andras Varga
    00011
    00012   This file is distributed WITHOUT ANY WARRANTY. See the file
    00013   `license' for details on this and other legal matters.
    00014 *--------------------------------------------------------------*/
    00015
    00016 #ifndef __NEDGENERATOR_H
    00017 #define __NEDGENERATOR_H
    00018
    00019 #include <iostream>
    00020 #include "nedelements.h"
    00021
    00022 using std::ostream;
    00023
    00029 void generateNed(ostream& out, NEDElement *node, bool newsyntax);
    00030
    00037 class NEDGenerator
    00038 {
    00039   protected:
    00040     bool newsyntax;
    00041     int indentsize;
    00042     ostream& out;
    00043
    00044   public:
    00049     NEDGenerator(ostream& out);
    00050
    00054     ~NEDGenerator();
    00055
    00059     void setIndentSize(int indentsize);
    00060
    00065     void setNewSyntax(bool value);
    00066
    00070     void generate(NEDElement *node, const char *indent);
    00071
    00072   protected:
    00075     const char *increaseIndent(const char *indent);
    00076     const char *decreaseIndent(const char *indent);
    00078
    00080     void generateNedItem(NEDElement *node, const char *indent, bool islast, const char *arg=NULL);;
    00081
    00083     void generateChildren(NEDElement *node, const char *indent, const char *arg=NULL);
    00084
    00086     void generateChildrenWithType(NEDElement *node, int tagcode, const char *indent, const char *arg=0);
    00087
    00090     void printExpression(NEDElement *node, const char *attr, const char *indent);
    00091     void printVector(NEDElement *node, const char *attr, const char *indent);
    00092     void printIfExpression(NEDElement *node, const char *attr, const char *indent);
    00094
    00097     void appendBannerComment(const char *comment, const char *indent);
    00098     void appendRightComment(const char *comment, const char *indent);
    00099     void appendInlineRightComment(const char *comment, const char *indent);
    00100     void appendTrailingComment(const char *comment, const char *indent);
    00102
    00105     void doNedfiles(NedFilesNode *node, const char *indent, bool islast, const char *);
    00106     void doNedfile(NedFileNode *node, const char *indent, bool islast, const char *);
    00107     void doImports(ImportNode *node, const char *indent, bool islast, const char *);
    00108     void doImport(ImportedFileNode *node, const char *indent, bool islast, const char *);
    00109     void doChannel(ChannelNode *node, const char *indent, bool islast, const char *);
    00110     void doChanattr(ChannelAttrNode *node, const char *indent, bool islast, const char *);
    00111     void doNetwork(NetworkNode *node, const char *indent, bool islast, const char *);
    00112     void doSimple(SimpleModuleNode *node, const char *indent, bool islast, const char *);
    00113     void doModule(CompoundModuleNode *node, const char *indent, bool islast, const char *);
    00114     void doParams(ParamsNode *node, const char *indent, bool islast, const char *);
    00115     void doParam(ParamNode *node, const char *indent, bool islast, const char *);
    00116     void doGates(GatesNode *node, const char *indent, bool islast, const char *);
    00117     void doGate(GateNode *node, const char *indent, bool islast, const char *);
    00118     void doMachines(MachinesNode *node, const char *indent, bool islast, const char *);
    00119     void doMachine(MachineNode *node, const char *indent, bool islast, const char *);
    00120     void doSubmodules(SubmodulesNode *node, const char *indent, bool islast, const char *);
    00121     void doSubmodule(SubmoduleNode *node, const char *indent, bool islast, const char *);
    00122     void doSubstparams(SubstparamsNode *node, const char *indent, bool islast, const char *);
    00123     void doSubstparam(SubstparamNode *node, const char *indent, bool islast, const char *);
    00124     void doGatesizes(GatesizesNode *node, const char *indent, bool islast, const char *);
    00125     void doGatesize(GatesizeNode *node, const char *indent, bool islast, const char *);
    00126     void doSubstmachines(SubstmachinesNode *node, const char *indent, bool islast, const char *);
    00127     void doSubstmachine(SubstmachineNode *node, const char *indent, bool islast, const char *);
    00128     void doConnections(ConnectionsNode *node, const char *indent, bool islast, const char *);
    00129     void printGate(NEDElement *conn, const char *modname, const char *modindexattr,
    00130                    const char *gatename, const char *gateindexattr, bool isplusplus,
    00131                    const char *indent);
    00132     void doConnection(ConnectionNode *node, const char *indent, bool islast, const char *);
    00133     void doConnattr(ConnAttrNode *node, const char *indent, bool islast, const char *arrow);
    00134     void doForloop(ForLoopNode *node, const char *indent, bool islast, const char *);
    00135     void doLoopvar(LoopVarNode *node, const char *indent, bool islast, const char *);
    00136     void doDisplaystring(DisplayStringNode *node, const char *indent, bool islast, const char *);
    00137     void doExpression(ExpressionNode *node, const char *indent, bool islast, const char *);
    00138     int getOperatorPriority(const char *op, int args);
    00139     bool isOperatorLeftAssoc(const char *op);
    00140     void doOperator(OperatorNode *node, const char *indent, bool islast, const char *);
    00141     void doFunction(FunctionNode *node, const char *indent, bool islast, const char *);
    00142     void doParamref(ParamRefNode *node, const char *indent, bool islast, const char *);
    00143     void doIdent(IdentNode *node, const char *indent, bool islast, const char *);
    00144     void doConst(ConstNode *node, const char *indent, bool islast, const char *);
    00145
    00146     void doCplusplus(CplusplusNode *node, const char *indent, bool islast, const char *);
    00147     void doStructDecl(StructDeclNode *node, const char *indent, bool islast, const char *);
    00148     void doClassDecl(ClassDeclNode *node, const char *indent, bool islast, const char *);
    00149     void doMessageDecl(MessageDeclNode *node, const char *indent, bool islast, const char *);
    00150     void doEnumDecl(EnumDeclNode *node, const char *indent, bool islast, const char *);
    00151     void doEnum(EnumNode *node, const char *indent, bool islast, const char *);
    00152     void doEnumFields(EnumFieldsNode *node, const char *indent, bool islast, const char *);
    00153     void doEnumField(EnumFieldNode *node, const char *indent, bool islast, const char *);
    00154     void doMessage(MessageNode *node, const char *indent, bool islast, const char *);
    00155     void doClass(ClassNode *node, const char *indent, bool islast, const char *);
    00156     void doStruct(StructNode *node, const char *indent, bool islast, const char *);
    00157     void doFields(FieldsNode *node, const char *indent, bool islast, const char *);
    00158     void doField(FieldNode *node, const char *indent, bool islast, const char *);
    00159     void doProperties(PropertiesNode *node, const char *indent, bool islast, const char *);
    00160     void doProperty(PropertyNode *node, const char *indent, bool islast, const char *);
    00162 };
    00163
    00164 #endif
    00165
    00166