[AGENT++] replace_value() problem

Blake Sorensen blake.sorensen at digitalenvoy.net
Wed Jun 2 22:01:26 CEST 2004


I'm trying to reset the value of a table entry as each get request comes 
in, but the application crashes when I try and reassign 'value' in the 
overloaded get_request. Not sure what I'm doing wrong, I've based the 
code off of the various examples. Everything works fine as long as I 
don't try and reassign the value.

The MibLeaf in question:

class dbIsLoaded: public MibLeaf
{
public:
     dbIsLoaded(const Oidx &oid, mib_access access);
     virtual MibEntryPtr clone();
     virtual ~dbIsLoaded();
     virtual void get_request(Request *req, int ind);
private:
     DB   **databases;
}

void dbIsLoaded::get_request(Request *req, int ind)
{
     int dbInd = (int)req->get_oid(ind).last();

     if (databases[dbInd]->isDBLoaded())
     {
         *((OctetStr*)value) = OctetStr("yes");
     }
     else
     {
         *((OctetStr*)value) = OctetStr("no");
     }

     MibLeaf::get_request(req,ind);
}

The leaf is added to the table with:
//...
add_col(new dbIsLoaded("3",READWRITE));
//...

And the initial value sets fine with:
// ...
MibTableRow *r = st->add_row(ind);
r->get_nth(2)->replace_value(new OctetStr("yes"));
// ...


Any suggestions would be greatly appreciated.

Blake Sorensen
Software Engineer, Digital Envoy



More information about the AGENTPP mailing list