I’m using a library that has callbacks like this:
void onReceive (Lacewing::Server &Server, Lacewing::Server::Client &Client,
char * Data, int Size) {
/* callback body */
}
Server.onReceive (onReceive); /* to register the handler */
I would like to be able to wrap this in a class that can decide what to do when it receives a packet (observer pattern).
How can I do this with C style callbacks? The library does not define an interface to inherit from.
Thanks
Since you’re using liblacewing, every class has a
void * Tagmember provided for user data:then: