On 8 January 2013 15:07, Kent Borg <kent.b...@csr.com> wrote: > But I am worried about the state machine used in setting a variable. How do > I save state information between MODE_SET_RESERVE1 and MODE_SET_RESERVE2, > MODE_SET_COMMIT?
First question - are you implementing a table, or a set of scalar objects? The normal approach for a table implementation would be to have 'current' and 'old' fields within the data structure used to hold a particular row of the table. (And if there's any other state information that needs to be retained, then you could have additional fields for that as well). So the SET processing might look something as follows: case RESERVE1: check the type is right, and the new value looks acceptable break; case RESERVE2: if ( row creation request) allocate a new data structure for the row break; case ACTION: myRow->old_field1 = myRow->field1; myRow->field1 = varbind->value; break; case UNDO: myRow->field1 = myRow->old_field1; myRow->old_field1 = NULL; break; case COMMIT: myRow->old_field1 = NULL; break; Things are slightly different when implementing a scalar object, but there'll only be one such value (for any given object) so you can use essentially the same approach with two global variables ('myValue' and 'old_myValue') instead of one ('myValue'). Dave ------------------------------------------------------------------------------ Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only - learn more at: http://p.sf.net/sfu/learnmore_122512 _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users