class ugcs::vsm::Request_worker

Overview

Class for convenient worker thread instantiation for processing requests in a set request containers. More…

#include <request_worker.h>

class Request_worker: public ugcs::vsm::Request_context
{
public:
    // typedefs

    typedef std::shared_ptr<Request_worker> Ptr;
    typedef std::weak_ptr<Request_worker> Weak_ptr;

    // construction

    Request_worker(const std::string& name);
    Request_worker(const std::string& name, const std::initializer_list<Request_container::Ptr>& containers);
    Request_worker(const std::string& name, const std::list<Request_container::Ptr>& containers);

    // methods

    template <typename... Args>
    static Ptr Create(Args&&... args);

    virtual Type Get_type() const;
    void Enable_containers();
    void Disable_containers();
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<Request_container> Ptr;
    typedef std::weak_ptr<Request_container> Weak_ptr;
    typedef std::shared_ptr<Request_context> Ptr;
    typedef std::weak_ptr<Request_context> Weak_ptr;

    // enums

    enum Type;

    // classes

    class Request;
    class Request_waiter;

    // methods

    template <typename... Args>
    static Ptr Create(Args&&... args);

    virtual Type Get_type() const;
    bool Check_type(Type mask);
    void Submit_request(Request::Ptr request);
    void Submit_request_locked(Request::Ptr request, Request_waiter::Locker locker);
    int Process_requests(int requests_limit = 0);
    int Process_requests(std::unique_lock<std::mutex>& lock, int requests_limit = 0);
    void Set_waiter(Request_waiter::Ptr waiter);
    Request_waiter::Ptr Get_waiter() const;
    const std::string& Get_name();
    void Enable();
    void Disable();
    bool Is_enabled() const;

    template <typename... Args>
    static Ptr Create(Args&&... args);

    virtual Type Get_type() const;
    Request_container(const std::string& name, Request_waiter::Ptr waiter = Request_waiter::Create());

Detailed Documentation

Class for convenient worker thread instantiation for processing requests in a set request containers.

Typedefs

typedef std::shared_ptr<Request_worker> Ptr

Pointer type.

typedef std::weak_ptr<Request_worker> Weak_ptr

Pointer type.

Construction

Request_worker(const std::string& name)

Construct worker.

Request_worker(
    const std::string& name,
    const std::initializer_list<Request_container::Ptr>& containers
    )

Construct request worker by list of containers to work with.

Request_worker(const std::string& name, const std::list<Request_container::Ptr>& containers)

Construct request worker by list of containers to work with.

Methods

template <typename... Args>
static Ptr Create(Args&&... args)

Create an instance.

virtual Type Get_type() const

Get this container type.

void Enable_containers()

Enable all containers belonging to this worker.

void Disable_containers()

Disable all containers belonging to this worker.