CGraph
Public Member Functions | Private Attributes | List of all members
GMessage< T, capacity, > Class Template Reference

基于UAtomicRingBufferQueue队列实现,支持send/recv More...

#include <GMessage.h>

Inheritance diagram for GMessage< T, capacity, >:
Inheritance graph
[legend]
Collaboration diagram for GMessage< T, capacity, >:
Collaboration graph
[legend]

Public Member Functions

 GMessage (CUInt size=capacity)
 
 ~GMessage () override
 
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CVoid send (const TImpl &value, GMessagePushStrategy strategy)
 
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CVoid send (std::unique_ptr< TImpl > &value, GMessagePushStrategy strategy)
 
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CStatus recv (TImpl &value, CMSec timeout)
 
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CStatus recv (std::unique_ptr< TImpl > &value, CMSec timeout)
 
CUInt getCapacity () const
 
- Public Member Functions inherited from GMessageObject
CStatus run () final
 
- Public Member Functions inherited from CObject
 CObject ()=default
 
virtual CStatus init ()
 
virtual CStatus destroy ()
 
virtual ~CObject ()=default
 

Private Attributes

UAtomicRingBufferQueue< T, capacity > queue_
 

Detailed Description

template<typename T, CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
class GMessage< T, capacity, >

基于UAtomicRingBufferQueue队列实现,支持send/recv

Template Parameters
T
capacity

Constructor & Destructor Documentation

◆ GMessage()

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
GMessage< T, capacity, >::GMessage ( CUInt  size = capacity)
inlineexplicit

◆ ~GMessage()

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
GMessage< T, capacity, >::~GMessage ( )
inlineoverride

析构函数。释放前,要先释放队列中所有的信息

Member Function Documentation

◆ getCapacity()

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
CUInt GMessage< T, capacity, >::getCapacity ( ) const
inline

获取容量大小

Returns

◆ recv() [1/2]

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CStatus GMessage< T, capacity, >::recv ( std::unique_ptr< TImpl > &  value,
CMSec  timeout 
)
inline

通过智能指针的方式传递

Template Parameters
TImpl
Parameters
value
timeout
Returns

◆ recv() [2/2]

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CStatus GMessage< T, capacity, >::recv ( TImpl &  value,
CMSec  timeout 
)
inline

获取参数

Parameters
value
timeout
Returns

◆ send() [1/2]

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CVoid GMessage< T, capacity, >::send ( const TImpl &  value,
GMessagePushStrategy  strategy 
)
inline

写入参数

Template Parameters
TImpl
Parameters
value
strategy
Returns

◆ send() [2/2]

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
template<class TImpl , c_enable_if_t< std::is_base_of< T, TImpl >::value, int > = 0>
CVoid GMessage< T, capacity, >::send ( std::unique_ptr< TImpl > &  value,
GMessagePushStrategy  strategy 
)
inline

写入智能指针类型的参数

Template Parameters
TImpl
Parameters
value
strategy
Returns

Member Data Documentation

◆ queue_

template<typename T , CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE, c_enable_if_t< std::is_base_of< GMessageParam, T >::value, int > = 0>
UAtomicRingBufferQueue<T, capacity> GMessage< T, capacity, >::queue_
private

The documentation for this class was generated from the following file: