[sigc] How to do selective signal propagation ?
- From: Eric NICOLAS <nicolas00 wanadoo fr>
- To: libsigc-list gnome org
- Subject: [sigc] How to do selective signal propagation ?
- Date: Tue, 9 Dec 2003 10:31:27 +0100 (CET)
Hi folks,
I'm using SigC++ v1.2.5.
I would like to do something quite odd with signals / slots. I'm not sure it's even possible within SigC++, but I know I could do it by hand if absolutely needed, but I would like to avoir throwing another signal/slot hand-written code in my application.
What I need is to filter signal propagation based on a signal's argument. I have a signal <void, double value, int kind>. Clients connects to this signal saying "I want to receive updates on value of kind 'mykind'".. Now a value of kind 'akind' changes, only those clients connected who wants values of 'akind' should be notified.
A dumb implementation would be to code an array of signals, one per kind:
Signal1<void, double value> valueChanged[NbKinds];
And clients could connect the the specific signal and thus be notified as they should. The only problem is memory space consumed by this approached. I would need roughly 500,000 such signals and that's eating about 300 Mo !!
If instead I put only one signal for all value kinds, I need "only" 9000 of them, which is much more reasonable (I have 52 different value kinds). But I need a way to "dispatch" events properly to clients, i.e. to store a little extra data in the connections and use this data during dispatching.
Any idea ?
Thanks.
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]