Public Member Functions | Private Attributes | Static Private Attributes | List of all members
mf::service::ThreadQueue Class Reference

#include <ThreadQueue.h>

Public Member Functions

 ThreadQueue ()
 
virtual ~ThreadQueue ()=default
 
void consume (OpCode &opcode, void *&operand)
 
void produce (OpCode opcode, void *operand)
 
 ThreadQueue (ThreadQueue const &)=delete
 
ThreadQueueoperator= (ThreadQueue const &)=delete
 

Private Attributes

SingleConsumerQ m_buf
 

Static Private Attributes

static constexpr int buf_depth {500}
 
static constexpr int buf_size {sizeof(OpCode) + sizeof(void*)}
 

Detailed Description

Definition at line 10 of file ThreadQueue.h.

Constructor & Destructor Documentation

mf::service::ThreadQueue::ThreadQueue ( )

Definition at line 7 of file ThreadQueue.cc.

static constexpr int buf_size
Definition: ThreadQueue.h:28
SingleConsumerQ m_buf
Definition: ThreadQueue.h:29
static constexpr int buf_depth
Definition: ThreadQueue.h:27
virtual mf::service::ThreadQueue::~ThreadQueue ( )
virtualdefault
mf::service::ThreadQueue::ThreadQueue ( ThreadQueue const &  )
delete

Member Function Documentation

void mf::service::ThreadQueue::consume ( OpCode opcode,
void *&  operand 
)

Definition at line 21 of file ThreadQueue.cc.

22  {
23  SingleConsumerQ::ConsumerBuffer b{m_buf}; // Look -- CONSUMER buffer
24  char* slot_p = static_cast<char*>(b.buffer());
25  std::memcpy(&opcode, slot_p + 0, sizeof(OpCode));
26  std::memcpy(&operand, slot_p + sizeof(OpCode), sizeof(void*));
27  b.commit(buf_size);
28  }
static constexpr int buf_size
Definition: ThreadQueue.h:28
SingleConsumerQ m_buf
Definition: ThreadQueue.h:29
OperateBuffer< ConsumerType > ConsumerBuffer
ThreadQueue& mf::service::ThreadQueue::operator= ( ThreadQueue const &  )
delete
void mf::service::ThreadQueue::produce ( OpCode  opcode,
void *  operand 
)

Definition at line 10 of file ThreadQueue.cc.

11  {
13  char* slot_p = static_cast<char*>(b.buffer());
14  void* v = operand;
15  std::memcpy(slot_p + 0, &o, sizeof(OpCode));
16  std::memcpy(slot_p + sizeof(OpCode), &v, sizeof(void*));
17  b.commit(buf_size);
18  } // runCommand
static constexpr int buf_size
Definition: ThreadQueue.h:28
SingleConsumerQ m_buf
Definition: ThreadQueue.h:29
OperateBuffer< ProducerType > ProducerBuffer

Member Data Documentation

constexpr int mf::service::ThreadQueue::buf_depth {500}
staticprivate

Definition at line 27 of file ThreadQueue.h.

constexpr int mf::service::ThreadQueue::buf_size {sizeof(OpCode) + sizeof(void*)}
staticprivate

Definition at line 28 of file ThreadQueue.h.

SingleConsumerQ mf::service::ThreadQueue::m_buf
private

Definition at line 29 of file ThreadQueue.h.


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