helics  3.5.2
Public Member Functions | List of all members
helics::ipc::IpcBlockingPriorityQueue Class Reference

#include <IpcBlockingPriorityQueue.hpp>

Public Member Functions

 IpcBlockingPriorityQueue (void *dataBlock, size_t blockSize)
 
void clear ()
 
 IpcBlockingPriorityQueue (const IpcBlockingPriorityQueue &)=delete
 
IpcBlockingPriorityQueueoperator= (const IpcBlockingPriorityQueue &)=delete
 
void push (const unsigned char *data, size_t size)
 
void pushPriority (const unsigned char *data, size_t size)
 
bool try_push (const unsigned char *data, size_t size)
 
bool try_pushPriority (const unsigned char *data, size_t size)
 
stx::optional< std::pair< unsigned char *, int > > try_peek () const
 
bool try_pop (unsigned char *data, int maxSize)
 
int pop (unsigned char *data, int maxSize)
 
void pop (std::chrono::milliseconds timeout, unsigned char *data, int maxSize)
 
bool empty () const
 

Detailed Description

class implementing a blocking queue with a priority channel

this class uses locks one for push and pull it can exhibit longer blocking times if the internal operations require a swap, however in high usage the two locks will reduce contention in most cases.

Constructor & Destructor Documentation

◆ IpcBlockingPriorityQueue() [1/2]

helics::ipc::IpcBlockingPriorityQueue::IpcBlockingPriorityQueue ( void *  dataBlock,
size_t  blockSize 
)

default constructor

◆ IpcBlockingPriorityQueue() [2/2]

helics::ipc::IpcBlockingPriorityQueue::IpcBlockingPriorityQueue ( const IpcBlockingPriorityQueue )
delete

DISABLE_COPY_AND_ASSIGN

Member Function Documentation

◆ clear()

void helics::ipc::IpcBlockingPriorityQueue::clear ( )

clear the queue

◆ empty()

bool helics::ipc::IpcBlockingPriorityQueue::empty ( ) const

check whether there are any elements in the queue because this is meant for multi-process applications this may or may not have any meaning depending on the number of consumers

◆ pop()

void helics::ipc::IpcBlockingPriorityQueue::pop ( std::chrono::milliseconds  timeout,
unsigned char *  data,
int  maxSize 
)

blocking call to wait on an object from the stack with timeout

◆ push()

void helics::ipc::IpcBlockingPriorityQueue::push ( const unsigned char *  data,
size_t  size 
)

push a data block val the value to push on the queue

◆ pushPriority()

void helics::ipc::IpcBlockingPriorityQueue::pushPriority ( const unsigned char *  data,
size_t  size 
)

push an element onto the queue val the value to push on the queue

◆ try_peek()

stx::optional<std::pair<unsigned char*, int> > helics::ipc::IpcBlockingPriorityQueue::try_peek ( ) const

try to peek at an object without popping it from the stack

only available for copy assignable objects

Returns
an optional object with an object of type T if available

◆ try_pop()

bool helics::ipc::IpcBlockingPriorityQueue::try_pop ( unsigned char *  data,
int  maxSize 
)

try to pop an object from the queue

Returns
an optional containing the value if successful the optional will be empty if there is no element in the queue

◆ try_push()

bool helics::ipc::IpcBlockingPriorityQueue::try_push ( const unsigned char *  data,
size_t  size 
)

push a data block val the value to push on the queue

◆ try_pushPriority()

bool helics::ipc::IpcBlockingPriorityQueue::try_pushPriority ( const unsigned char *  data,
size_t  size 
)

push an element onto the queue val the value to push on the queue


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