CppCallback -- an open source library for C++ callback, signal, slot, delegate, observer patten, event system

Note: Though you can still download the callback library here, it should be out of date.
Now CppCallback is released as part of cpgf library, please go to cgpf library main page to download the cpgf library. It's guaranteed up to date.
CppCallback won't be maintained as an independent library.

Download source code

Benchmark

Online document

Tutorial (a sample code with detailed comment)

Update on 2011, Jul. 3, changes:

CppCallback is a callback system for C++. It's written using heavily C++ templates and preprocess macros.

With this library, C++ programmers can easily do:

Features:

 

Here is a piece of code that the callback looks like,
 

GCallback<void (int)> cb = someObj;
cb.invoke(66);

TestObject test;

GCallbackList<int (const string &)> cbList;

cbList.add(SampleFunctor()); // functor object
cbList.add(&test, &TestObject::objectFunction); // a member function
cbList.add(&TestObject::staticFunction); // static class function
cbList.add(&globalFunction); // global function

cbList.dispatch("dispatch"); // call all callbacks


How may the callback library help your development?


This library is not to compete with boost::Signals and libsigc++.

The latter two libraries are quite sophisticated and well tested, while CppCallback is new and may have bugs.
And CppCallback can work together with boost and libsigc++ too. You can use boost bind or libsigc++ adaptors as functor object in CppCallback.


License:

Apache License 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

It's open source freeware.
However, if you need a different license, just contact the original author, with the information that: who are you, how do you want to use of the code, what license would you like, and then I will decide to or not to give you a suitable license.
 

Changes log:

Update on 2011, May. 4, changes:

Update on 2011, Apr. 9, changes:

Update on 2011, Apr. 4, changes:

Update on 2011, Mar. 12, changes:

Update on 2011, Mar. 6, changes:

Qi
Posts: 1
Comment
Re: bound
Reply #4 on : Sun July 31, 2011, 01:47:54
Hi Tatsujin,

Thank you so much.
I've just fixed it. :-)
Tatsujin
Posts: 3
Comment
bound
Reply #3 on : Sat July 30, 2011, 17:29:17
Hi, great page and useful stuff!
You mentioned you wanted comments about your language and since I'm a grammar-nitpicking bastard I'll do just that:

"no function is binded" should be "no function is bound".
:)
Qi
Posts: 3
Comment
Re: new code?
Reply #2 on : Tue July 12, 2011, 05:48:19
What new code do you want?
chan
Posts: 3
Comment
new code?
Reply #1 on : Tue July 12, 2011, 05:22:32
have new code?

Write a comment

  • Required fields are marked with *
  • Security Code is case sensitive, 'A' is different with 'a'.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: