distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
MemcpyPopQueueFunctor.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MEMCPYPOPQUEUEFUNCTOR_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MEMCPYPOPQUEUEFUNCTOR_HPP_
14 
16 
17 #include <cstddef>
18 
19 namespace distortos
20 {
21 
22 namespace internal
23 {
24 
27 {
28 public:
29 
37  constexpr MemcpyPopQueueFunctor(void* const buffer, const size_t size) :
38  buffer_{buffer},
39  size_{size}
40  {
41 
42  }
43 
50  void operator()(void* storage) const override;
51 
52 private:
53 
55  void* const buffer_;
56 
58  const size_t size_;
59 };
60 
61 } // namespace internal
62 
63 } // namespace distortos
64 
65 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MEMCPYPOPQUEUEFUNCTOR_HPP_
MemcpyPopQueueFunctor is a functor used for popping of data from the raw queue with memcpy()
Definition: MemcpyPopQueueFunctor.hpp:26
Top-level namespace of distortos project.
Definition: buttons.hpp:33
void operator()(void *storage) const override
Copies the data from raw queue's storage (with memcpy()).
Definition: MemcpyPopQueueFunctor.cpp:26
QueueFunctor class header.
void *const buffer_
pointer to buffer for popped element
Definition: MemcpyPopQueueFunctor.hpp:55
constexpr MemcpyPopQueueFunctor(void *const buffer, const size_t size)
MemcpyPopQueueFunctor's constructor.
Definition: MemcpyPopQueueFunctor.hpp:37
QueueFunctor is a type-erased interface for functors which execute some action on queue's storage (li...
Definition: QueueFunctor.hpp:31
const size_t size_
size of buffer_, bytes
Definition: MemcpyPopQueueFunctor.hpp:58