| helics 3.6.1

IpcBlockingPriorityQueue.hpp
1 /*
2 Copyright (c) 2017-2018,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC All rights reserved. See LICENSE file and DISCLAIMER for more details.
5 */
6 #pragma once
7
8 #include "helics/external/optional.hpp"
9
10 #include <boost/interprocess/mapped_region.hpp>
11 #include <boost/interprocess/shared_memory_object.hpp>
12 #include <boost/interprocess/sync/interprocess_condition.hpp>
13 #include <boost/interprocess/sync/interprocess_mutex.hpp>
14 #include <boost/interprocess/sync/scoped_lock.hpp>
15 #include <chrono>
16 #include <utility>
17
18 namespace helics {
19 namespace ipc {
20
26 class IpcBlockingPriorityQueue {
27 private:
28 public:
30 IpcBlockingPriorityQueue(void* dataBlock, size_t blockSize);
31
33 void clear();
34
36 IpcBlockingPriorityQueue(const IpcBlockingPriorityQueue&) = delete;
37 IpcBlockingPriorityQueue& operator=(const IpcBlockingPriorityQueue&) = delete;
38
42 void push(const unsigned char* data, size_t size);
46 void pushPriority(const unsigned char* data, size_t size);
50 bool try_push(const unsigned char* data, size_t size);
51
55 bool try_pushPriority(const unsigned char* data, size_t size);
56
61 stx::optional<std::pair<unsigned char*, int>> try_peek() const;
62
67 bool try_pop(unsigned char* data, int maxSize);
68
69 int pop(unsigned char* data, int maxSize);
70
72 void pop(std::chrono::milliseconds timeout, unsigned char* data, int maxSize);
73
78 bool empty() const;
79 };
80
81 } // namespace ipc
82 } // namespace helics
helics::ipc::IpcBlockingPriorityQueue
Definition: IpcBlockingPriorityQueue.hpp:26
helics::ipc::IpcBlockingPriorityQueue::try_pushPriority
bool try_pushPriority(const unsigned char *data, size_t size)
helics::ipc::IpcBlockingPriorityQueue::clear
void clear()
helics::ipc::IpcBlockingPriorityQueue::IpcBlockingPriorityQueue
IpcBlockingPriorityQueue(const IpcBlockingPriorityQueue &)=delete
helics::ipc::IpcBlockingPriorityQueue::try_peek
stx::optional< std::pair< unsigned char *, int > > try_peek() const
helics::ipc::IpcBlockingPriorityQueue::pop
void pop(std::chrono::milliseconds timeout, unsigned char *data, int maxSize)
helics::ipc::IpcBlockingPriorityQueue::pushPriority
void pushPriority(const unsigned char *data, size_t size)
helics::ipc::IpcBlockingPriorityQueue::empty
bool empty() const
helics::ipc::IpcBlockingPriorityQueue::try_pop
bool try_pop(unsigned char *data, int maxSize)
helics::ipc::IpcBlockingPriorityQueue::push
void push(const unsigned char *data, size_t size)
helics::ipc::IpcBlockingPriorityQueue::IpcBlockingPriorityQueue
IpcBlockingPriorityQueue(void *dataBlock, size_t blockSize)
helics::ipc::IpcBlockingPriorityQueue::try_push
bool try_push(const unsigned char *data, size_t size)
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14