template class Poco::FunctionPriorityDelegate

Overview

Wraps a freestanding function or static member function for use as a PriorityDelegate. More…

#include <FunctionPriorityDelegate.h>

template <
    class TArgs,
    bool useSender = true,
    bool senderIsConst = true
    >
class FunctionPriorityDelegate: public Poco::AbstractPriorityDelegate
{
public:
    // typedefs

    typedef void (*NotifyFunction)(
        const void *,
        TArgs &
        );

    // construction

    FunctionPriorityDelegate(
        NotifyFunction function,
        int prio
        );

    FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate);

    // methods

    FunctionPriorityDelegate&
    operator=(const FunctionPriorityDelegate& delegate);

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

    virtual
    bool
    equals(const AbstractDelegate<TArgs>& other) const;

    virtual
    AbstractDelegate<TArgs>*
    clone() const;

    virtual
    void
    disable();

protected:
    // fields

    NotifyFunction _function;
    Mutex _mutex;
};

Inherited Members

public:
    // methods

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

    virtual
    bool
    equals(const AbstractDelegate& other) const = 0;

    virtual
    AbstractDelegate*
    clone() const = 0;

    virtual
    void
    disable() = 0;

    virtual
    const AbstractDelegate*
    unwrap() const;

    int
    priority() const;

protected:
    // fields

    int _priority;

Detailed Documentation

Wraps a freestanding function or static member function for use as a PriorityDelegate.

Methods

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

Invokes the delegate’s callback function.

Returns true if successful, or false if the delegate has been disabled or has expired.

virtual
bool
equals(const AbstractDelegate<TArgs>& other) const

Compares the AbstractDelegate with the other one for equality.

virtual
AbstractDelegate<TArgs>*
clone() const

Returns a deep copy of the AbstractDelegate.

virtual
void
disable()

Disables the delegate, which is done prior to removal.