Scope
BaseController.h
1 #pragma once
2 
3 #include "helpers/helpers.h"
4 
5 // Forward declarations
6 namespace scope {
7  namespace parameters {
8  class Scope;
9  }
10  enum ControllerReturnStatus;
11 }
12 
13 namespace scope {
14 
19 template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
21 
22 public:
24  : pimpl(new Impl) {
25  }
26 
28  virtual ~BaseController() {
29  if (!STATIC_PIMPL)
30  delete pimpl;
31  }
32 
33 private:
36 
39 
40 protected:
42  class Impl;
43 
45  Impl* const pimpl;
46 
50  explicit BaseController(Impl* const _pimpl)
51  : pimpl(_pimpl) {
52  }
53 
54 public:
56  Impl* Pimpl() const {
57  return pimpl;
58  }
59 
61  void Start(const parameters::Scope& _parameters) {
62  pimpl->Start(_parameters);
63  }
64 
66  void StopAll() {
67  pimpl->StopAll();
68  }
69 
72  ControllerReturnStatus WaitForAll(const int32_t& _wait_time = -1) {
73  return pimpl->WaitForAll(_wait_time);
74  }
75 
76 };
77 
78 }
void StopAll()
Stop the controller, calls BaseController::Impl::StopAll.
The master parameters class.
Definition: Scope.h:204
Impl *const pimpl
the pointer to the implementation
ControllerReturnStatus WaitForAll(const int32_t &_wait_time=-1)
Wait until the controller threads finished, calls BaseController::Impl::WaitForAll.
Impl * Pimpl() const
virtual ~BaseController()
Deletes the pimpl unless it points to a static local variable.
void Start(const parameters::Scope &_parameters)
Start the controller, calls BaseController::Impl::Start.
BaseController operator=(const BaseController &i)
disable assignment
Various helper functions and classes for Scope.
Base class for all controllers.
BaseController(Impl *const _pimpl)
Constructor which can be used from derived classes to store their implementation class in BaseControl...
Implementation class of the BaseController, uses std::async to execute worker functions in a separate...