template class utils::ConcurrentBinding

Overview

Controller for binding asynchronous processes. More…

#include <ConcurrentBinding.h>

template <typename T>
class ConcurrentBinding: public utils::EventHandler {
public:
    // methods

    void Run(const std::function<T(void)>& func);
    bool IsRunning() const;
    void SetCallbackOnFinish(const std::function<void(T)>& func);
};

Inherited Members

public:
    // structs

    struct Event;

    // methods

    virtual void PollEvents();

protected:
    // typedefs

    typedef std::string EventId;

    // methods

    virtual void ProcessEvent(] const Event* e);

    template <typename T = Event, typename... Args>
    void RegisterEvent(Args... args);

Detailed Documentation

Controller for binding asynchronous processes.

Any function bound to Run function of this class will be executed asynchronously, and checked for finishing. Class can automatically notify user about finishing using PollEvents function of EventHandler super class.

Methods

void Run(const std::function<T(void)>& func)

Execute provided function asynchronously from a caller thread.

bool IsRunning() const

Check if asynchronous function is still running.

void SetCallbackOnFinish(const std::function<void(T)>& func)

Set callback which will be called via PollEvents after asynchronous function is finished.