nedsupport.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __NEDSUPPORT_H
00019 #define __NEDSUPPORT_H
00020
00021 #include "cdynamicexpression.h"
00022
00023 NAMESPACE_BEGIN
00024
00025 namespace NEDSupport {
00026
00027 class ModuleIndex : public cDynamicExpression::Functor
00028 {
00029 public:
00030 ModuleIndex();
00031 ModuleIndex *dup() const {return new ModuleIndex();}
00032 virtual const char *getFullName() const {return "index";}
00033 virtual const char *getArgTypes() const {return "";}
00034 virtual char getReturnType() const {return 'L';}
00035 virtual cNEDValue evaluate(cComponent *context, cNEDValue args[], int numargs);
00036 virtual std::string str(std::string args[], int numargs);
00037 };
00038
00042 class ParameterRef : public cDynamicExpression::Functor
00043 {
00044 protected:
00045 bool ofParent;
00046 bool explicitKeyword;
00047 std::string paramName;
00048 public:
00049 ParameterRef(const char *paramName, bool ofParent, bool explicitKeyword);
00050 ParameterRef *dup() const {return new ParameterRef(paramName.c_str(), ofParent, explicitKeyword);}
00051 virtual const char *getFullName() const {return paramName.c_str();}
00052 virtual const char *getArgTypes() const {return "";}
00053 virtual char getReturnType() const {return '*';}
00054 virtual cNEDValue evaluate(cComponent *context, cNEDValue args[], int numargs);
00055 virtual std::string str(std::string args[], int numargs);
00056 };
00057
00061 class SiblingModuleParameterRef : public cDynamicExpression::Functor
00062 {
00063 protected:
00064 bool ofParent;
00065 std::string moduleName;
00066 bool withModuleIndex;
00067 std::string paramName;
00068 public:
00069 SiblingModuleParameterRef(const char *moduleName, const char *paramName, bool ofParent, bool withModuleIndex);
00070 SiblingModuleParameterRef *dup() const {return new SiblingModuleParameterRef(moduleName.c_str(), paramName.c_str(), ofParent, withModuleIndex);}
00071 virtual const char *getFullName() const {return paramName.c_str();}
00072 virtual const char *getArgTypes() const {return withModuleIndex ? "L" : "";}
00073 virtual char getReturnType() const {return '*';}
00074 virtual cNEDValue evaluate(cComponent *context, cNEDValue args[], int numargs);
00075 virtual std::string str(std::string args[], int numargs);
00076 };
00077
00081 class LoopVar : public cDynamicExpression::Functor
00082 {
00083 private:
00084
00085 static const char *varNames[32];
00086 static long vars[32];
00087 static int varCount;
00088 public:
00089 static long& pushVar(const char *varName);
00090 static void popVar();
00091 static void reset();
00092 static const char **getVarNames() {return varNames;}
00093 static int getNumVars() {return varCount;}
00094
00095 protected:
00096 std::string varName;
00097 public:
00098 LoopVar(const char *varName) {this->varName = varName;}
00099 LoopVar *dup() const {return new LoopVar(varName.c_str());}
00100 virtual const char *getFullName() const {return varName.c_str();}
00101 virtual const char *getArgTypes() const {return "";}
00102 virtual char getReturnType() const {return 'L';}
00103 virtual cNEDValue evaluate(cComponent *context, cNEDValue args[], int numargs);
00104 virtual std::string str(std::string args[], int numargs);
00105 };
00106
00107
00111 class Sizeof : public cDynamicExpression::Functor
00112 {
00113 protected:
00114 bool ofParent;
00115 bool explicitKeyword;
00116 std::string ident;
00117 public:
00118 Sizeof(const char *ident, bool ofParent, bool explicitKeyword);
00119 Sizeof *dup() const {return new Sizeof(ident.c_str(), ofParent, explicitKeyword);}
00120 virtual const char *getFullName() const {return ident.c_str();}
00121 virtual const char *getArgTypes() const {return "";}
00122 virtual char getReturnType() const {return 'L';}
00123 virtual cNEDValue evaluate(cComponent *context, cNEDValue args[], int numargs);
00124 virtual std::string str(std::string args[], int numargs);
00125 };
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 };
00149
00150 NAMESPACE_END
00151
00152
00153 #endif
00154
00155