• Advertisement
Sign in to follow this  

Event System in C++

This topic is 1896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

I was wondering if anyone can recommend a good library that allows me to pass events from object to object. I am used to using the one in Objective C or as3 so I am not sure if there is something similar to that is c++ already available.

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
What will this event system be used for? I'm not familiar with either Objective-C or AS3 so I don't know which event systems they provide out of the box.

You might want to take a look at the [url="http://en.wikipedia.org/wiki/Observer_pattern"]Observer Pattern[/url] which is a robust and popular way of handling events. This pattern is used in [url="http://en.wikipedia.org/wiki/Model-view-controller"]Model-View-Controller[/url] systems, which are often used for user interfaces, but they are applicable in other fields as well.

Share this post


Link to post
Share on other sites
I'd take a look at [url="http://www.boost.org/doc/libs/1_52_0/doc/html/signals.html"]boost::signals[/url] - it's sort of the standard for signal/slots event setups in C++. There are a couple of other similar libraries if boost is too heavyweight for your tastes.

However, Objective-C has a messaging system that is very different from C++ function calls. You may have to describe in more detail what you are trying to achieve, and we can suggest other alternatives.

Share this post


Link to post
Share on other sites
If you are looking for libraries that implement signals and slots you have many options. You have a whole range of options from heavy, feature rich boost::signals its thread safe sibling boost::signals2, libsigc++, sigslot, cpp-events, and ting. I've actually released an extremely lightweight implementation that uses c++11 called nano-signal-slot. It all boils down to what you estimate you will need. I would not recommend an old or dead implementation as maintainability could become an issue. I would suggest boost::signals2 as that is the thread safe version of boost::signals, and performance between the two is similar. http://www.boost.org/doc/libs/1_52_0/doc/html/signals2.html Edited by ApEk

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement