helics  3.5.2
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 
27  private:
28  public:
30  IpcBlockingPriorityQueue(void* dataBlock, size_t blockSize);
31 
33  void clear();
34 
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
Definition: IpcBlockingPriorityQueue.hpp:26
bool try_pushPriority(const unsigned char *data, size_t size)
IpcBlockingPriorityQueue(const IpcBlockingPriorityQueue &)=delete
stx::optional< std::pair< unsigned char *, int > > try_peek() const
void pop(std::chrono::milliseconds timeout, unsigned char *data, int maxSize)
void pushPriority(const unsigned char *data, size_t size)
bool try_pop(unsigned char *data, int maxSize)
void push(const unsigned char *data, size_t size)
IpcBlockingPriorityQueue(void *dataBlock, size_t blockSize)
bool try_push(const unsigned char *data, size_t size)
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14