|
CGraph
|
包含一个基于std::vector的环形队列,基于mutex_实现原子的waitPopWithTimeout/push head_/tail_初始化为0,tail_及tail_之后一直到head_之前的位置记为空 举例:head_为0、tail_为3、capaci_为64的情况下,[3,63]范围内的位置都记为空 More...
#include <UAtomicRingBufferQueue.h>


Public Member Functions | |
| UAtomicRingBufferQueue () | |
| ~UAtomicRingBufferQueue () override | |
| UAtomicRingBufferQueue * | setCapacity (CUInt size) |
| CUInt | getCapacity () const |
| template<class TImpl = T> | |
| CVoid | push (const TImpl &value, URingBufferPushStrategy strategy) |
| template<class TImpl = T> | |
| CVoid | push (std::unique_ptr< TImpl > &value, URingBufferPushStrategy strategy) |
| template<class TImpl = T> | |
| CStatus | waitPopWithTimeout (TImpl &value, CMSec timeout) |
| template<class TImpl = T> | |
| CStatus | waitPopWithTimeout (std::unique_ptr< TImpl > &value, CMSec timeout) |
| CStatus | clear () |
Public Member Functions inherited from CObject | |
| CObject ()=default | |
| virtual CStatus | init () |
| virtual CStatus | destroy () |
| virtual | ~CObject ()=default |
Protected Member Functions | |
| CBool | isFull () |
| CBool | isEmpty () |
Protected Member Functions inherited from UThreadObject | |
| CStatus | run () override |
Protected Member Functions inherited from UtilsObject | |
| CStatus | run () override |
Private Attributes | |
| CUInt | head_ |
| CUInt | tail_ |
| CUInt | capacity_ |
| std::condition_variable | push_cv_ |
| std::condition_variable | pop_cv_ |
| std::vector< std::unique_ptr< T > > | ring_buffer_queue_ |
Additional Inherited Members | |
Protected Attributes inherited from UQueueObject | |
| std::mutex | mutex_ |
| std::condition_variable | cv_ |
包含一个基于std::vector的环形队列,基于mutex_实现原子的waitPopWithTimeout/push head_/tail_初始化为0,tail_及tail_之后一直到head_之前的位置记为空 举例:head_为0、tail_为3、capaci_为64的情况下,[3,63]范围内的位置都记为空
| T | |
| capacity |
|
inlineexplicit |
|
inlineoverride |

|
inline |
清空所有的数据
|
inline |
获取容量信息
|
inlineprotected |
当前队列是否为空
|
inlineprotected |
当前队列是否为满
|
inline |
写入信息
| TImpl |
| value | |
| strategy |

|
inline |
写入智能指针类型的信息
| TImpl |
| value | |
| strategy |

|
inline |
设置容量信息
| size |
|
inline |
等待弹出信息。ps:当入参为智能指针的情况
| TImpl |
| value | |
| timeout |
当传入的内容,是智能指针的时候, 这里就直接通过 move转移过去好了,跟直接传值的方式,保持区别

|
inline |
等待弹出信息
| value | |
| timeout |

|
private |
|
private |
|
private |
|
private |
|
private |
|
private |