Boost logo

Boost :

From: Tim michals (tcmichals_at_[hidden])
Date: 2005-12-12 15:42:30

(Excuse the crude example) I'm trying to create a simple publisher/subscribe
service app, using signals, the issue I'm trying to resolve is how to
register the callbacks correctly to each signal. Callbacks will have
different parameter types. When attempting to typecast the subscriber, it
does not register correctly due to different parameters? Is there a better

Boost::signal< void (void)> simple_t;
boost::signal<int (int,int,int)> signal_a;
boost::signal<void (void)> signal_b;

typedef void (*callbackFunc) (void);
typedef callbackFunc func_t;

int Callback1(int, int,int) { ..... return 0;}
void callback2( void ) { };

        publish("signal/a", signal_a);
        publish("signal/b", signal_b);
Subscribe("signal/a", &callback1);
Subscribe("signal/b", &callback2);

void publish(stl::string uri, simple_t &)
        // add uri
        // add generic boost::signal??
void subscribe(stl::string uri, func_t func)
        //Find entry
        simple_t t= find(uri);
        t.Connect(func); //This does

Boost list run by bdawes at, gregod at, cpdaniel at, john at