Main Page Modules Class Hierarchy Compound List File List Compound Members

# nedgenerator.h

    00001 //==========================================================================
    00002 //   NEDGEN.H -
    00003 //            part of OMNeT++
    00004 //
    00005 //==========================================================================
    00006
    00007 /*--------------------------------------------------------------*
    00008   Copyright (C) 2002-2003 Andras Varga
    00009
    00010   This file is distributed WITHOUT ANY WARRANTY. See the file
    00011   `license' for details on this and other legal matters.
    00012 *--------------------------------------------------------------*/
    00013
    00014 #ifndef __NEDGENERATOR_H
    00015 #define __NEDGENERATOR_H
    00016
    00017 #include <iostream>
    00018 #include "nedelements.h"
    00019
    00020 using std::ostream;
    00021
    00027 void generateNed(ostream& out, NEDElement *node, bool newsyntax);
    00028
    00035 class NEDGenerator
    00036 {
    00037   protected:
    00038     bool newsyntax;
    00039     int indentsize;
    00040     ostream& out;
    00041
    00042   public:
    00047     NEDGenerator(ostream& out);
    00048
    00052     ~NEDGenerator();
    00053
    00057     void setIndentSize(int indentsize);
    00058
    00063     void setNewSyntax(bool value);
    00064
    00068     void generate(NEDElement *node, const char *indent);
    00069
    00070   protected:
    00071     const char *increaseIndent(const char *indent);
    00072     const char *decreaseIndent(const char *indent);
    00073     void generateNedItem(NEDElement *node, const char *indent, bool islast, const char *arg=NULL);;
    00074     void generateChildren(NEDElement *node, const char *indent, const char *arg=NULL);
    00075     void generateChildrenWithType(NEDElement *node, int tagcode, const char *indent, const char *arg=0);
    00076     void printExpression(NEDElement *node, const char *attr, const char *indent);
    00077     void printVector(NEDElement *node, const char *attr, const char *indent);
    00078     void printIfExpression(NEDElement *node, const char *attr, const char *indent);
    00079     void appendBannerComment(const char *comment, const char *indent);
    00080     void appendRightComment(const char *comment, const char *indent);
    00081     void appendInlineRightComment(const char *comment, const char *indent);
    00082     void appendTrailingComment(const char *comment, const char *indent);
    00083
    00084     void doNedfiles(NedFilesNode *node, const char *indent, bool islast, const char *);
    00085     void doNedfile(NedFileNode *node, const char *indent, bool islast, const char *);
    00086     void doImports(ImportNode *node, const char *indent, bool islast, const char *);
    00087     void doImport(ImportedFileNode *node, const char *indent, bool islast, const char *);
    00088     void doChannel(ChannelNode *node, const char *indent, bool islast, const char *);
    00089     void doChanattr(ChannelAttrNode *node, const char *indent, bool islast, const char *);
    00090     void doNetwork(NetworkNode *node, const char *indent, bool islast, const char *);
    00091     void doSimple(SimpleModuleNode *node, const char *indent, bool islast, const char *);
    00092     void doModule(CompoundModuleNode *node, const char *indent, bool islast, const char *);
    00093     void doParams(ParamsNode *node, const char *indent, bool islast, const char *);
    00094     void doParam(ParamNode *node, const char *indent, bool islast, const char *);
    00095     void doGates(GatesNode *node, const char *indent, bool islast, const char *);
    00096     void doGate(GateNode *node, const char *indent, bool islast, const char *);
    00097     void doMachines(MachinesNode *node, const char *indent, bool islast, const char *);
    00098     void doMachine(MachineNode *node, const char *indent, bool islast, const char *);
    00099     void doSubmodules(SubmodulesNode *node, const char *indent, bool islast, const char *);
    00100     void doSubmodule(SubmoduleNode *node, const char *indent, bool islast, const char *);
    00101     void doSubstparams(SubstparamsNode *node, const char *indent, bool islast, const char *);
    00102     void doSubstparam(SubstparamNode *node, const char *indent, bool islast, const char *);
    00103     void doGatesizes(GatesizesNode *node, const char *indent, bool islast, const char *);
    00104     void doGatesize(GatesizeNode *node, const char *indent, bool islast, const char *);
    00105     void doSubstmachines(SubstmachinesNode *node, const char *indent, bool islast, const char *);
    00106     void doSubstmachine(SubstmachineNode *node, const char *indent, bool islast, const char *);
    00107     void doConnections(ConnectionsNode *node, const char *indent, bool islast, const char *);
    00108     void printGate(NEDElement *conn, const char *modname, const char *modindexattr,
    00109                    const char *gatename, const char *gateindexattr, const char *indent);
    00110     void doConnection(ConnectionNode *node, const char *indent, bool islast, const char *);
    00111     void doConnattr(ConnAttrNode *node, const char *indent, bool islast, const char *arrow);
    00112     void doForloop(ForLoopNode *node, const char *indent, bool islast, const char *);
    00113     void doLoopvar(LoopVarNode *node, const char *indent, bool islast, const char *);
    00114     void doDisplaystring(DisplayStringNode *node, const char *indent, bool islast, const char *);
    00115     void doExpression(ExpressionNode *node, const char *indent, bool islast, const char *);
    00116     int getOperatorPriority(const char *op, int args);
    00117     bool isOperatorLeftAssoc(const char *op);
    00118     void doOperator(OperatorNode *node, const char *indent, bool islast, const char *);
    00119     void doFunction(FunctionNode *node, const char *indent, bool islast, const char *);
    00120     void doParamref(ParamRefNode *node, const char *indent, bool islast, const char *);
    00121     void doIdent(IdentNode *node, const char *indent, bool islast, const char *);
    00122     void doConst(ConstNode *node, const char *indent, bool islast, const char *);
    00123
    00124     void doCppinclude(CppincludeNode *node, const char *indent, bool islast, const char *);
    00125     void doCppStruct(CppStructNode *node, const char *indent, bool islast, const char *);
    00126     void doCppCobject(CppCobjectNode *node, const char *indent, bool islast, const char *);
    00127     void doCppNoncobject(CppNoncobjectNode *node, const char *indent, bool islast, const char *);
    00128     void doEnum(EnumNode *node, const char *indent, bool islast, const char *);
    00129     void doEnumFields(EnumFieldsNode *node, const char *indent, bool islast, const char *);
    00130     void doEnumField(EnumFieldNode *node, const char *indent, bool islast, const char *);
    00131     void doMessage(MessageNode *node, const char *indent, bool islast, const char *);
    00132     void doClass(ClassNode *node, const char *indent, bool islast, const char *);
    00133     void doStruct(StructNode *node, const char *indent, bool islast, const char *);
    00134     void doFields(FieldsNode *node, const char *indent, bool islast, const char *);
    00135     void doField(FieldNode *node, const char *indent, bool islast, const char *);
    00136     void doProperties(PropertiesNode *node, const char *indent, bool islast, const char *);
    00137     void doProperty(PropertyNode *node, const char *indent, bool islast, const char *);
    00138
    00139 };
    00140
    00141 #endif
    00142
    00143