FairMQ  1.3.9
C++ Message Passing Framework
Poller.h
1 /********************************************************************************
2  * Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef FAIR_MQ_OFI_POLLER_H
10 #define FAIR_MQ_OFI_POLLER_H
11 
12 #include <FairMQChannel.h>
13 #include <FairMQPoller.h>
14 #include <FairMQSocket.h>
15 
16 #include <vector>
17 #include <unordered_map>
18 
19 #include <zmq.h>
20 
21 namespace fair
22 {
23 namespace mq
24 {
25 namespace ofi
26 {
27 
28 class TransportFactory;
29 
36 class Poller final : public FairMQPoller
37 {
38  friend class FairMQChannel;
39  friend class TransportFactory;
40 
41  public:
42  Poller(const std::vector<FairMQChannel>& channels);
43  Poller(const std::vector<const FairMQChannel*>& channels);
44  Poller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList);
45 
46  Poller(const Poller&) = delete;
47  Poller operator=(const Poller&) = delete;
48 
49  auto SetItemEvents(zmq_pollitem_t& item, const int type) -> void;
50 
51  auto Poll(const int timeout) -> void override;
52  auto CheckInput(const int index) -> bool override;
53  auto CheckOutput(const int index) -> bool override;
54  auto CheckInput(const std::string channelKey, const int index) -> bool override;
55  auto CheckOutput(const std::string channelKey, const int index) -> bool override;
56 
57  ~Poller() override;
58 
59  private:
60  zmq_pollitem_t* fItems;
61  int fNumItems;
62 
63  std::unordered_map<std::string, int> fOffsetMap;
64 }; /* class Poller */
65 
66 } /* namespace ofi */
67 } /* namespace mq */
68 } /* namespace fair */
69 
70 #endif /* FAIR_MQ_OFI_POLLER_H */
Definition: FairMQChannel.h:27
FairMQ transport factory for the ofi transport (implemented with ZeroMQ + libfabric)
Definition: TransportFactory.h:29
Definition: FairMQPoller.h:15
Definition: Poller.h:36
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23

privacy