FairMQ  1.4.33
C++ Message Queuing Library and 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::mq::ofi
22 {
23 
24 class TransportFactory;
25 
32 class Poller final : public FairMQPoller
33 {
34  friend class FairMQChannel;
35  friend class TransportFactory;
36 
37  public:
38  Poller(const std::vector<FairMQChannel>& channels);
39  Poller(const std::vector<const FairMQChannel*>& channels);
40  Poller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList);
41 
42  Poller(const Poller&) = delete;
43  Poller operator=(const Poller&) = delete;
44 
45  auto SetItemEvents(zmq_pollitem_t& item, const int type) -> void;
46 
47  auto Poll(const int timeout) -> void override;
48  auto CheckInput(const int index) -> bool override;
49  auto CheckOutput(const int index) -> bool override;
50  auto CheckInput(const std::string& channelKey, const int index) -> bool override;
51  auto CheckOutput(const std::string& channelKey, const int index) -> bool override;
52 
53  ~Poller() override;
54 
55  private:
56  zmq_pollitem_t* fItems;
57  int fNumItems;
58 
59  std::unordered_map<std::string, int> fOffsetMap;
60 }; /* class Poller */
61 
62 } // namespace fair::mq::ofi
63 
64 #endif /* FAIR_MQ_OFI_POLLER_H */
fair::mq::ofi::Poller
Definition: Poller.h:39
FairMQPoller
Definition: FairMQPoller.h:16
FairMQChannel
Wrapper class for FairMQSocket and related methods.
Definition: FairMQChannel.h:35

privacy