VSM C++ SDK
Vehicle Specific Modules SDK
request_worker.h
Go to the documentation of this file.
1 // Copyright (c) 2014, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
11 #ifndef TASK_WORKER_H_
12 #define TASK_WORKER_H_
13 
15 
16 #include <thread>
17 
18 namespace ugcs {
19 namespace vsm {
20 
26 public:
27 
29  Request_worker(const std::string& name) :
31 
34  const std::string& name,
35  const std::initializer_list<Request_container::Ptr> &containers);
36 
39  const std::string& name,
40  const std::list<Request_container::Ptr> &containers);
41 
43  virtual Type
44  Get_type() const override
45  {
46  return Type::ANY;
47  }
48 
50  void
52 
54  void
56 
57 private:
59  std::thread thread;
61  std::list<Request_container::Ptr> containers;
62 
64  virtual void
65  On_enable() override;
66 
68  virtual void
69  On_disable() override;
70 
72  virtual void
73  On_wait_and_process() override;
74 
78  virtual void
79  Process_request(Request::Ptr request) override;
80 };
81 
82 } /* namespace vsm */
83 } /* namespace ugcs */
84 
85 #endif /* TASK_WORKER_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
Request_worker(const std::string &name)
Construct worker.
Definition: request_worker.h:29
STL namespace.
std::shared_ptr< Request > Ptr
Pointer type.
Definition: request_container.h:38
Request execution context.
Container capable of handling both requests and completions.
Request execution context.
Definition: request_context.h:24
void Disable_containers()
Disable all containers belonging to this worker.
Generic container for queued requests.
Definition: request_container.h:31
void Enable_containers()
Enable all containers belonging to this worker.
Type
Container type.
Definition: request_container.h:441
virtual Type Get_type() const override
Get this container type.
Definition: request_worker.h:44
Class for convenient worker thread instantiation for processing requests in a set request containers...
Definition: request_worker.h:24
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25