const Dialer &aDialer): AsyncCall(aDebugSection, aDebugLevel, aName),
dialer(aDialer) {}
+ AsyncCallT(const RefCount<AsyncCallT<Dialer> > &o):
+ AsyncCall(o->debugSection, o->debugLevel, o->name),
+ dialer(o->dialer) {}
+
CallDialer *getDialer() { return &dialer; }
protected:
/**
* API for classes needing to emit multiple event-driven AsyncCalls.
- * A receiver class uses this API to subscribe interest in the
- * events being handled or watched for by the API child.
*
- * The API child then uses this to create and emit a call as needed.
+ * The emitter class needs to accept and store a Subscription::Pointer.
+ * The callback() function will spawn AsyncCalls to be filled out and
+ * scheduled wth every event happening.
*/
-class Subscription: public RefCountable {
+class Subscription: public RefCountable
+{
public:
typedef RefCount<Subscription> Pointer;
// virtual AsyncCall::Pointer callback() const = 0;
};
-/// implements Subscription API using Call's copy constructor
+/**
+ * Implements Subscription API using Call's copy constructor.
+ *
+ * A receiver class allocates one of these templated from the Call type
+ * to be received (usually AsyncCallT) and passes it to the emitter class
+ * which will use it to spawn event calls.
+ *
+ * To be a subscriber the AsyncCall child must implement a copy constructor.
+ */
template<class Call_>
class CallSubscription: public Subscription
{
public:
- // cant be const because CommCbFunPtrCallT cant provide a const overload.
+ CallSubscription(const RefCount<Call_> &aCall) : call(aCall) {};
+
+ // cant be const sometimes because CommCbFunPtrCallT cant provide a const overload.
// CommCbFunPtrCallT lists why. boils down to Comm IO syncWithComm() existence
+ // NP: we still treat it as const though.
CallSubscription(RefCount<Call_> &aCall) : call(aCall) {};
virtual AsyncCall::Pointer callback() { return new Call_(call); };
// virtual AsyncCall::Pointer callback() const { return new Call_(call); };