[AGENT++] C++ function within snmp++ callback
Marek Malowidzki
malowidz at wil.waw.pl
Tue Aug 8 09:29:12 CEST 2006
> Of course, one modern way would be to pass a pointer to a SnmpCallback
> object. Until now, nobody asked for such a change.
>
> class SnmpCallback
> {
> public:
> virtual void callback(int reason, Snmp *snmp, Pdu &pdu,
> SnmpTarget &target, void *cd) = 0;
> };
>
There is no need for any change, just add to this class a static member
function that does the work described in earlier posts (that is, cast the
"state" object to an SnmpCallback pointer and call its callback() function),
which would be perfectly ok to be passed as the current callback function.
Also, there should probably be a bit more C++ stuff, e.g., a virtual
destructor (with an implementation provided anyway!) and some overridden
operators but I do not remeber all the details now (anyone interested should
consult a good book on C++).
Marek
More information about the AGENTPP
mailing list