distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
BoundQueueFunctor.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_BOUNDQUEUEFUNCTOR_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_BOUNDQUEUEFUNCTOR_HPP_
14 
16 
17 #include <utility>
18 
19 namespace distortos
20 {
21 
22 namespace internal
23 {
24 
32 template<typename F>
34 {
35 public:
36 
44  constexpr explicit BoundQueueFunctor(F&& boundFunctor) :
45  boundFunctor_{std::move(boundFunctor)}
46  {
47 
48  }
49 
57  void operator()(void* const storage) const override
58  {
59  boundFunctor_(storage);
60  }
61 
62 private:
63 
66 };
67 
78 template<typename F>
79 constexpr BoundQueueFunctor<F> makeBoundQueueFunctor(F&& boundFunctor)
80 {
81  return BoundQueueFunctor<F>{std::move(boundFunctor)};
82 }
83 
84 } // namespace internal
85 
86 } // namespace distortos
87 
88 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_BOUNDQUEUEFUNCTOR_HPP_
constexpr BoundQueueFunctor< F > makeBoundQueueFunctor(F &&boundFunctor)
Helper factory function to make BoundQueueFunctor object with deduced template arguments.
Definition: BoundQueueFunctor.hpp:79
constexpr BoundQueueFunctor(F &&boundFunctor)
BoundQueueFunctor&#39;s constructor.
Definition: BoundQueueFunctor.hpp:44
Top-level namespace of distortos project.
QueueFunctor class header.
F boundFunctor_
bound functor
Definition: BoundQueueFunctor.hpp:65
BoundQueueFunctor is a type-erased QueueFunctor which calls its bound functor to execute actions on q...
Definition: BoundQueueFunctor.hpp:33
void operator()(void *const storage) const override
Calls the bound functor which will execute some action on queue&#39;s storage (like copy-constructing, swapping, destroying, emplacing, ...)
Definition: BoundQueueFunctor.hpp:57
QueueFunctor is a type-erased interface for functors which execute some action on queue&#39;s storage (li...
Definition: QueueFunctor.hpp:31