[AGENT++] [patch] AgenPro3 codegen with symbolic constants

Claus Klein claus.klein at arcormail.de
Wed Sep 1 07:08:05 CEST 2010


Hi,

to get the following code with symbolic names instead of numeric  
constants, I have changed the template for mib code.
I think this more readable and it is according our coding rules, no  
magic numbers in code.

##########################################################

  {
     long v;
     vb.get_value(v);
-   if ((v != 1)
-        && (v != 2) && (v != 4)
-        && (v != 6)) return FALSE;
+   if ((v != e_doNothing)
+        && (v != e_activate) && (v != e_export)
+        && (v != e_abort)) return FALSE;
     //--AgentGen BEGIN=svfuaLogMgmtAction::value_ok
     //--AgentGen END
     return TRUE;
  }

##########################################################

  void svfuaOperatingHoursEntry::set_row(MibTableRow* r, unsigned long  
p1)
  {
-    r->get_nth(0)->replace_value(new NS_SNMP Gauge32(p1));
+   r->get_nth(nSvfuaOperatingHoursCount)->replace_value(new NS_SNMP  
Gauge32(p1));
  }

  //--AgentGen BEGIN=svfuaOperatingHoursEntry
  //--AgentGen END

##########################################################

Are there any arguments against this changes?

With regards,
Claus




More information about the AGENTPP mailing list