Boost logo

Boost Users :

From: Hughes, James (jhughes_at_[hidden])
Date: 2007-06-14 04:24:27


Hello all,

I have a quick question that I hope some of the experts on Function and Bind can answer. I'll give a quick précis of what I would like to do.

We have an event system in our code. I would like to set this up so that any particular event can be 'attached' to arbitrary classes and functions in those classes. For example, a "Print" Event may need to call an arbitrary function in an arbitrary class (or a number of these). Therefore the event server needs to have a list of all these class/function pairs for each event type.

I am pretty sure I can achieve that with a combination of boost::function and boost::bind. I see how I can use function if I know what the class type is..I would need to store the function and a this pointer in to the event server, but the this pointer would need to be to a specific type - that specified in the boost::function defn. Is there any way to make the this pointer of an arbitrary type such that the function call can be made to any arbitrary function in any arbitrary class?

Sorry, I don't have a code snippet to help explain - that's what I'm trying to figure out!!

There may well be better ways of doing what we need - those thoughts also gratefully received (nb. Working in a multithreaded environment, so boost:signals may not be appropriate)

James

This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net