VSM C++ SDK
Vehicle Specific Modules SDK
ugcs::vsm::Request_worker Class Reference

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

#include <request_worker.h>

Inheritance diagram for ugcs::vsm::Request_worker:
ugcs::vsm::Request_context< is_processor > ugcs::vsm::Request_container

Public Types

typedef std::shared_ptr< Request_workerPtr
 Pointer type.
 
typedef std::weak_ptr< Request_workerWeak_ptr
 Pointer type.
 
- Public Types inherited from ugcs::vsm::Request_context< is_processor >
typedef std::shared_ptr< Request_contextPtr
 Pointer type.
 
typedef std::weak_ptr< Request_contextWeak_ptr
 Pointer type.
 
- Public Types inherited from ugcs::vsm::Request_container
enum  Type {
  Type::NONE = 0x0, Type::PROCESSOR = 0x1, Type::COMPLETION_CONTEXT = 0x2, Type::ANY = PROCESSOR | COMPLETION_CONTEXT,
  Type::TEMPORAL = 0x4, Type::TEMP_COMPLETION_CONTEXT = COMPLETION_CONTEXT | TEMPORAL
}
 Container type. More...
 
typedef std::shared_ptr< Request_containerPtr
 Pointer type.
 
typedef std::weak_ptr< Request_containerWeak_ptr
 Pointer type.
 

Public Member Functions

 Request_worker (const std::string &name)
 Construct worker. More...
 
 Request_worker (const std::string &name, const std::initializer_list< Request_container::Ptr > &containers)
 Construct request worker by list of containers to work with. More...
 
 Request_worker (const std::string &name, const std::list< Request_container::Ptr > &containers)
 Construct request worker by list of containers to work with. More...
 
virtual Type Get_type () const override
 Get this container type. More...
 
void Enable_containers ()
 Enable all containers belonging to this worker. More...
 
void Disable_containers ()
 Disable all containers belonging to this worker. More...
 
- Public Member Functions inherited from ugcs::vsm::Request_container
 Request_container (const std::string &name, Request_waiter::Ptr waiter=Request_waiter::Create())
 Create container with default associated waiter. More...
 
bool Check_type (Type mask)
 Check if the container type conforms the specified characteristic mask. More...
 
void Submit_request (Request::Ptr request)
 Submit request to this container for further processing or notification handlers invocation. More...
 
void Submit_request_locked (Request::Ptr request, Request_waiter::Locker locker)
 The same as Submit_request, but with previously acquired lock of the associated waiter. More...
 
int Process_requests (int requests_limit=0)
 Process all currently queued requests. More...
 
int Process_requests (std::unique_lock< std::mutex > &lock, int requests_limit=0)
 Process all currently queued requests. More...
 
void Set_waiter (Request_waiter::Ptr waiter)
 Set request waiter associated with this container. More...
 
Request_waiter::Ptr Get_waiter () const
 Get request waiter associated with this container. More...
 
const std::string & Get_name ()
 Get the name of the container. More...
 
void Enable ()
 Enable the container. More...
 
void Disable ()
 Disable the container. More...
 
bool Is_enabled () const
 Check if the container is currently enabled. More...
 

Static Public Member Functions

template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance. More...
 
- Static Public Member Functions inherited from ugcs::vsm::Request_context< is_processor >
template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance. More...
 
- Static Public Member Functions inherited from ugcs::vsm::Request_container
template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ugcs::vsm::Request_container
void Processing_loop ()
 Request processing loop implementation. More...
 
void Set_disabled ()
 Disable the container and notify its waiter. More...
 
- Protected Attributes inherited from ugcs::vsm::Request_container
Request_waiter::Ptr waiter
 Waiter associated with this container. More...
 
std::list< Request::Ptrrequest_queue
 Queue of pending requests, i.e. More...
 

Detailed Description

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

Constructor & Destructor Documentation

ugcs::vsm::Request_worker::Request_worker ( const std::string &  name)
inline

Construct worker.

ugcs::vsm::Request_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.

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

Construct request worker by list of containers to work with.

Member Function Documentation

template<typename... Args>
static Ptr ugcs::vsm::Request_worker::Create ( Args &&...  args)
inlinestatic

Create an instance.

Examples:
async_workflow.cpp.
void ugcs::vsm::Request_worker::Disable_containers ( )

Disable all containers belonging to this worker.

void ugcs::vsm::Request_worker::Enable_containers ( )

Enable all containers belonging to this worker.

virtual Type ugcs::vsm::Request_worker::Get_type ( ) const
inlineoverridevirtual

Get this container type.

Reimplemented from ugcs::vsm::Request_context< is_processor >.


The documentation for this class was generated from the following file: