Walking the rows in a table...

Frank Fock Frank.Fock____t-online.de
Thu Aug 22 03:15:54 CEST 2002


Hi Michael,

Comments inline:

Michael Grimes wrote:
> Hi,
> I have a requirement to walk all rows in a table, taking
> action on any rows that meet certain criteria.  I was thinking
> of using the MibTable method get_rows to retrieve all table
> rows and then subsequently the List methods to go through each
> table row.  However, there is a note in the documentation on
> MibTable::get_rows that says the following:
> 
>   Note:
>           Don't use this method for tables where rows are deleted,
>           because you only get references, that then may point to nowhere.
>           Call List::clear() method before its constructor to avoid
>           deletion of the rows of this table.
> 
> What does this mean?  Will I have a problem with this?

OK, it seems that may comment was too short and incorrect
("constructor" in the above text should read "destructor").
Here is the long version:

When using the get_rows method in a multi-threaded environment,
you will have to make sure that no other thread is deleting any
rows while you are using the List.

In addition, when you have finished browsing the rows and you
want to delete the pointer to a List returned by MibTable::get_rows,
you will have to call List::clear() before to avoid dangling
pointers in the MibTable itself.

> 
> Also, what is the preferred method of locating a row in a table for
> a specific index.
> 
MibTableRow* MibTable::find_index(const Oidx& ind) const

Best regards,
Frank Fock






More information about the AGENTPP mailing list