fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::ff_unbounded_queue< T > Class Template Reference

#include <ff_wrapper.hpp>

Public Types

using value_type = T
 
using reference = T &
 Reference type. More...
 
using const_reference = const T &
 Const reference type. More...
 

Public Member Functions

 ff_unbounded_queue ()
 
 ~ff_unbounded_queue ()
 
bool try_push (const T &source)
 
void push (const T &source)
 
bool try_pop (T *&target)
 
bool pop (T *&target)
 
void release (T *source) const
 

Private Attributes

ff::uMPMC_Ptr_Queue _queue
 

Detailed Description

template<typename T>
class FIX8::ff_unbounded_queue< T >

Definition at line 44 of file ff_wrapper.hpp.

Member Typedef Documentation

template<typename T >
using FIX8::ff_unbounded_queue< T >::const_reference = const T&

Const reference type.

Definition at line 56 of file ff_wrapper.hpp.

template<typename T >
using FIX8::ff_unbounded_queue< T >::reference = T&

Reference type.

Definition at line 53 of file ff_wrapper.hpp.

template<typename T >
using FIX8::ff_unbounded_queue< T >::value_type = T

Definition at line 50 of file ff_wrapper.hpp.

Constructor & Destructor Documentation

template<typename T >
FIX8::ff_unbounded_queue< T >::ff_unbounded_queue ( )
inlineexplicit

Definition at line 58 of file ff_wrapper.hpp.

58 { _queue.init(); }
ff::uMPMC_Ptr_Queue _queue
Definition: ff_wrapper.hpp:47
template<typename T >
FIX8::ff_unbounded_queue< T >::~ff_unbounded_queue ( )
inline

Definition at line 59 of file ff_wrapper.hpp.

59 {}

Member Function Documentation

template<typename T >
bool FIX8::ff_unbounded_queue< T >::pop ( T *&  target)
inline

Definition at line 65 of file ff_wrapper.hpp.

References FIX8::hypersleep< h_nanoseconds >(), and FIX8::ff_unbounded_queue< T >::try_pop().

66  {
67 #if defined FIX8_SLEEP_NO_YIELD
68  const unsigned cnt_rnd(3);
69  unsigned cnt(0);
70 #endif
71  for(;;)
72  {
73  if (try_pop(target))
74  return true;
75 #if defined FIX8_SLEEP_NO_YIELD
76  if ((++cnt %= cnt_rnd) == 0)
77  hypersleep<h_nanoseconds>(FIX8_SLEEP_NO_YIELD);
78  else
79 #endif
80  sched_yield();
81  }
82 
83  return false;
84  }
bool try_pop(T *&target)
Definition: ff_wrapper.hpp:64
int hypersleep< h_nanoseconds >(unsigned amt)
Definition: hypersleep.hpp:149
template<typename T >
void FIX8::ff_unbounded_queue< T >::push ( const T &  source)
inline

Definition at line 63 of file ff_wrapper.hpp.

References FIX8::ff_unbounded_queue< T >::try_push().

63 { try_push(source); }
bool try_push(const T &source)
Definition: ff_wrapper.hpp:61
template<typename T >
void FIX8::ff_unbounded_queue< T >::release ( T *  source) const
inline

Definition at line 85 of file ff_wrapper.hpp.

85 { ::ff::ff_free(source); }
template<typename T >
bool FIX8::ff_unbounded_queue< T >::try_pop ( T *&  target)
inline

Definition at line 64 of file ff_wrapper.hpp.

Referenced by FIX8::ff_unbounded_queue< T >::pop().

64 { return _queue.pop(reinterpret_cast<void**>(&target)); }
ff::uMPMC_Ptr_Queue _queue
Definition: ff_wrapper.hpp:47
template<typename T >
bool FIX8::ff_unbounded_queue< T >::try_push ( const T &  source)
inline

Definition at line 61 of file ff_wrapper.hpp.

Referenced by FIX8::ff_unbounded_queue< T >::push().

62  { return _queue.push(new (::ff::ff_malloc(sizeof(T))) T(source)); }
ff::uMPMC_Ptr_Queue _queue
Definition: ff_wrapper.hpp:47

Member Data Documentation

template<typename T >
ff::uMPMC_Ptr_Queue FIX8::ff_unbounded_queue< T >::_queue
private

Definition at line 47 of file ff_wrapper.hpp.


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