[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Signals/Slots for CommonC++
From: |
Marc Boris Dürner |
Subject: |
Signals/Slots for CommonC++ |
Date: |
Tue, 13 Jan 2004 19:12:39 +0100 (MET) |
Hi,
A signal/slot implementation for CommonC++ is attached. This is a preview
and not yet
thread-safe(need help for this). It works as follows:
class MyClass {
Signal<int> signal; // a signal carrying an int
void printInt(int i) {
std::cout << i << std::endl;
}
public:
MyClass() {
signal.connect(this, &MyClass::printInt); //connect signal
signal(100); // emit signal
}
};
The template class Signal takes the type of data it carries as template
type. Currently
Signals can transport no data or one parameter. It can be
connected/disconnected to
functions matching the type of parameter. Signals can be connected to
multiple slots and
other signals.
Source is attached with a a simple test case.
regards,
Marc
--
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net
signals.h
Description: Text Data
- Signals/Slots for CommonC++,
Marc Boris Dürner <=