33 using System.Collections.Generic;
34 using System.Globalization;
41 private bool getMethodRequired =
false;
42 private bool testMethodRequired =
false;
43 private bool setMethodRequired =
false;
52 get {
return this.
FullNodeName + LwipDefs.FnctSuffix_GetValue; }
57 get {
return this.getMethodRequired; }
62 get {
return this.
FullNodeName + LwipDefs.FnctSuffix_SetTest; }
67 get {
return this.testMethodRequired; }
72 get {
return this.
FullNodeName + LwipDefs.FnctSuffix_SetValue; }
77 get {
return this.setMethodRequired; }
89 this.getMethodRequired =
false;
90 this.testMethodRequired =
false;
91 this.setMethodRequired =
false;
97 this.getMethodRequired =
true;
101 this.testMethodRequired =
true;
102 this.setMethodRequired =
true;
105 if (this.getMethodRequired && this.setMethodRequired)
114 if (this.getMethodRequired)
117 getMethodDecl.
Parameter.Add(instanceType);
121 if (generateDeclarations)
125 if (generateImplementations)
133 if (this.testMethodRequired)
136 testMethodDecl.
Parameter.Add(instanceType);
141 if (generateDeclarations)
145 if (generateImplementations)
153 if (this.setMethodRequired)
156 setMethodDecl.
Parameter.Add(instanceType);
161 if (generateDeclarations)
165 if (generateImplementations)
177 returnValue.
Type.
Name =
"value_len";
181 bool valueVarUsed =
false;
190 scalarNode.
GenerateGetMethodCode(sc, getMethod.Parameter[1].Name, ref valueVarUsed, returnValue.Type.Name);
197 scd.
AddCodeFormat(
"LWIP_DEBUGF(SNMP_MIB_DEBUG,(\"{0}(): unknown id: %\"S32_F\"\\n\", {1}));", getMethod.Name, switchSelector);
199 sw.Switches.Add(scd);
203 getMethod.AddCodeFormat(
"LWIP_UNUSED_ARG({0});", getMethod.Parameter[1].Name);
206 getMethod.AddElement(sw);
208 getMethod.AddCodeFormat(
"return {0};", returnValue.Type.Name);
218 bool valueVarUsed =
false;
219 bool lenVarUsed =
false;
228 scalarNode.
GenerateTestMethodCode(sc, testMethod.Parameter[2].Name, ref valueVarUsed, testMethod.Parameter[1].Name, ref lenVarUsed, returnValue.Type.Name);
235 scd.
AddCodeFormat(
"LWIP_DEBUGF(SNMP_MIB_DEBUG,(\"{0}(): unknown id: %\"S32_F\"\\n\", {1}));", testMethod.Name, switchSelector);
236 sw.Switches.Add(scd);
240 testMethod.AddCodeFormat(
"LWIP_UNUSED_ARG({0});", testMethod.Parameter[2].Name);
244 testMethod.AddCodeFormat(
"LWIP_UNUSED_ARG({0});", testMethod.Parameter[1].Name);
247 testMethod.AddElement(sw);
249 testMethod.AddCodeFormat(
"return {0};", returnValue.Type.Name);
259 bool valueVarUsed =
false;
260 bool lenVarUsed =
false;
269 scalarNode.
GenerateSetMethodCode(sc, setMethod.Parameter[2].Name, ref valueVarUsed, setMethod.Parameter[1].Name, ref lenVarUsed, returnValue.Type.Name);
276 scd.
AddCodeFormat(
"LWIP_DEBUGF(SNMP_MIB_DEBUG,(\"{0}(): unknown id: %\"S32_F\"\\n\", {1}));", setMethod.Name, switchSelector);
277 sw.Switches.Add(scd);
281 setMethod.AddCodeFormat(
"LWIP_UNUSED_ARG({0});", setMethod.Parameter[2].Name);
285 setMethod.AddCodeFormat(
"LWIP_UNUSED_ARG({0});", setMethod.Parameter[1].Name);
288 setMethod.AddElement(sw);
290 setMethod.AddCodeFormat(
"return {0};", returnValue.Type.Name);
virtual string SetMethodName
Code AddCodeFormat(string codeFormat, params object[] args)
SnmpScalarAggregationNode(SnmpTreeNode parentNode)
static Function FromDeclaration(FunctionDeclaration decl)
virtual void GenerateSetMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
virtual void GenerateGetMethodCode(Function getMethod, string switchSelector)
virtual void GenerateTestMethodCode(Function testMethod, string switchSelector)
List< CodeElement > Implementation
List< CodeElement > Declarations
SnmpAccessMode AccessMode
static SwitchCase GenerateDefault()
override void Analyze()
Called after node structure creation is completed and before code is created. Offers the possibility ...
void GenerateAggregatedCode(MibCFile mibFile, VariableType instanceType, string switchSelector, bool generateDeclarations=true, bool generateImplementations=true)
virtual void GenerateGetMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string retLenVarName)
virtual void GenerateSetMethodCode(Function setMethod, string switchSelector)
virtual string TestMethodName
virtual string GetMethodName
virtual void GenerateTestMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
abstract IEnumerable< SnmpScalarNode > AggregatedScalarNodes
List< CodeElement > Declarations
abstract string FullNodeName
List< VariableType > Parameter