template class Poco::DefaultStrategy<void, TDelegate>

Overview

Default notification strategy. Moreā€¦

#include <DefaultStrategy.h>

template <class TDelegate>
class DefaultStrategy<void, TDelegate>: public Poco::NotificationStrategy<void, TDelegate>
{
public:
    // typedefs

    typedef TDelegate* DelegateHandle;
    typedef SharedPtr<TDelegate> DelegatePtr;
    typedef std::vector<DelegatePtr> Delegates;
    typedef Delegates::iterator Iterator;

    // construction

    DefaultStrategy();
    DefaultStrategy(const DefaultStrategy& s);

    // methods

    virtual
    void
    notify(const void* sender);

    virtual
    DelegateHandle
    add(const TDelegate& delegate);

    virtual
    void
    remove(const TDelegate& delegate);

    virtual
    void
    remove(DelegateHandle delegateHandle);

    DefaultStrategy&
    operator=(const DefaultStrategy& s);

    virtual
    void
    clear();

    virtual
    bool
    empty() const;

protected:
    // fields

    Delegates _delegates;
};

Inherited Members

public:
    // typedefs

    typedef TDelegate* DelegateHandle;

    // methods

    virtual
    void
    notify(const void* sender) = 0;

    virtual
    DelegateHandle
    add(const TDelegate& delegate) = 0;

    virtual
    void
    remove(const TDelegate& delegate) = 0;

    virtual
    void
    remove(DelegateHandle delegateHandle) = 0;

    virtual
    void
    clear() = 0;

    virtual
    bool
    empty() const = 0;

Detailed Documentation

Default notification strategy.

Internally, a std::vector<> is used to store delegate objects. Delegates are invoked in the order in which they have been registered.

Methods

virtual
void
notify(const void* sender)

Sends a notification to all registered delegates.

virtual
DelegateHandle
add(const TDelegate& delegate)

Adds a delegate to the strategy.

virtual
void
remove(const TDelegate& delegate)

Removes a delegate from the strategy, if found.

Does nothing if the delegate has not been added.

virtual
void
remove(DelegateHandle delegateHandle)

Removes a delegate from the strategy, if found.

Does nothing if the delegate has not been added.

virtual
void
clear()

Removes all delegates from the strategy.

virtual
bool
empty() const

Returns false if the strategy contains at least one delegate.