client-cpp  0.8.1
SimpleExecutorContext.hpp
Go to the documentation of this file.
1 
17 #ifndef SIMPLEEXECUTORCONTEXT_HPP_
18 #define SIMPLEEXECUTORCONTEXT_HPP_
19 
20 #include <memory>
21 
23 
24 namespace kaa {
25 
27 public:
28  SimpleExecutorContext(std::size_t lifeCycleThreadCount = DEFAULT_THREAD_COUNT
29  , std::size_t apiThreadCount = DEFAULT_THREAD_COUNT
30  , std::size_t callbackThreadCount = DEFAULT_THREAD_COUNT);
31 
32  virtual IThreadPool& getLifeCycleExecutor() { return *lifeCycleExecutor_; }
33  virtual IThreadPool& getApiExecutor() { return *apiExecutor_; }
34  virtual IThreadPool& getCallbackExecutor() { return *callbackExecutor_; }
35 
36 public:
37  static const std::size_t DEFAULT_THREAD_COUNT = 1;
38 
39 protected:
40  virtual void doInit();
41  virtual void doStop();
42 
43 private:
44  const std::size_t apiThreadCount_;
45  const std::size_t callbackThreadCount_;
46  const std::size_t lifeCycleThreadCount_;
47 
48  IThreadPoolPtr apiExecutor_;
49  IThreadPoolPtr callbackExecutor_;
50  IThreadPoolPtr lifeCycleExecutor_;
51 };
52 
53 } /* namespace kaa */
54 
55 #endif /* SIMPLEEXECUTORCONTEXT_HPP_ */
std::shared_ptr< IThreadPool > IThreadPoolPtr
Definition: IThreadPool.hpp:40
virtual IThreadPool & getApiExecutor()
virtual IThreadPool & getCallbackExecutor()
static const std::size_t DEFAULT_THREAD_COUNT
SimpleExecutorContext(std::size_t lifeCycleThreadCount=DEFAULT_THREAD_COUNT, std::size_t apiThreadCount=DEFAULT_THREAD_COUNT, std::size_t callbackThreadCount=DEFAULT_THREAD_COUNT)
virtual IThreadPool & getLifeCycleExecutor()