template class Poco::PriorityStrategy

Overview

NotificationStrategy for PriorityEvent. Moreā€¦

#include <PriorityStrategy.h>

template <
    class TArgs,
    class TDelegate
    >
class PriorityStrategy: public Poco::NotificationStrategy
{
public:
    // typedefs

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

    // construction

    PriorityStrategy();
    PriorityStrategy(const PriorityStrategy& s);

    // methods

    virtual
    void
    notify(
        const void* sender,
        TArgs& arguments
        );

    virtual
    DelegateHandle
    add(const TDelegate& delegate);

    virtual
    void
    remove(const TDelegate& delegate);

    virtual
    void
    remove(DelegateHandle delegateHandle);

    PriorityStrategy&
    operator=(const PriorityStrategy& 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,
        TArgs& arguments
        ) = 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

NotificationStrategy for PriorityEvent.

Delegates are kept in a std::vector<>, ordered by their priority.

Methods

virtual
void
notify(
    const void* sender,
    TArgs& arguments
    )

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.