libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
queue_typed_base.hpp
1#pragma once
2
3#include "libxr_def.hpp"
4
5namespace LibXR
6{
21template <typename Derived, typename Data>
23{
24 public:
25 using ValueType = Data;
26
32 ErrorCode Push(const Data& item)
33 {
34 return static_cast<Derived*>(this)->PushBytes(&item);
35 }
36
42 ErrorCode Pop(Data& item) { return static_cast<Derived*>(this)->PopBytes(&item); }
43
48 ErrorCode Pop() { return static_cast<Derived*>(this)->PopBytes(nullptr); }
49};
50} // namespace LibXR
强类型队列的公共薄包装 / Common thin wrapper for typed queues.
ErrorCode Pop()
丢弃一个队头元素 / Discard one front element.
ErrorCode Push(const Data &item)
推入一个强类型元素 / Push one typed element.
ErrorCode Pop(Data &item)
弹出一个强类型元素 / Pop one typed element.
Data ValueType
队列元素类型 / Queue element type.
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes