FairMQ  1.2.0
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 : 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  Poller(const FairMQSocket& cmdSocket, const FairMQSocket& dataSocket);
61 
62  zmq_pollitem_t* fItems;
63  int fNumItems;
64 
65  std::unordered_map<std::string, int> fOffsetMap;
66 }; /* class Poller */
67 
68 } /* namespace ofi */
69 } /* namespace mq */
70 } /* namespace fair */
71 
72 #endif /* FAIR_MQ_OFI_POLLER_H */
Definition: FairMQChannel.h:24
FairMQ transport factory for the ofi transport (implemented with ZeroMQ + libfabric) ...
Definition: TransportFactory.h:29
Definition: FairMQPoller.h:15
Definition: FairMQSocket.h:18
Definition: Poller.h:36
Definition: DeviceRunner.h:23