FairMQ  1.4.14
C++ Message Queuing Library and Framework
FairMQPollerZMQ.h
1 /********************************************************************************
2  * Copyright (C) 2014 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  ********************************************************************************/
15 #ifndef FAIRMQPOLLERZMQ_H_
16 #define FAIRMQPOLLERZMQ_H_
17 
18 #include <vector>
19 #include <unordered_map>
20 
21 #include <zmq.h>
22 
23 #include "FairMQPoller.h"
24 #include "FairMQChannel.h"
25 #include "FairMQTransportFactoryZMQ.h"
26 
27 class FairMQChannel;
28 
29 class FairMQPollerZMQ final : public FairMQPoller
30 {
31  friend class FairMQChannel;
32  friend class FairMQTransportFactoryZMQ;
33 
34  public:
35  FairMQPollerZMQ(const std::vector<FairMQChannel>& channels);
36  FairMQPollerZMQ(const std::vector<FairMQChannel*>& channels);
37  FairMQPollerZMQ(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList);
38 
39  FairMQPollerZMQ(const FairMQPollerZMQ&) = delete;
40  FairMQPollerZMQ operator=(const FairMQPollerZMQ&) = delete;
41 
42  void SetItemEvents(zmq_pollitem_t& item, const int type);
43 
44  void Poll(const int timeout) override;
45  bool CheckInput(const int index) override;
46  bool CheckOutput(const int index) override;
47  bool CheckInput(const std::string& channelKey, const int index) override;
48  bool CheckOutput(const std::string& channelKey, const int index) override;
49 
50  ~FairMQPollerZMQ() override;
51 
52  private:
53  zmq_pollitem_t* fItems;
54  int fNumItems;
55 
56  std::unordered_map<std::string, int> fOffsetMap;
57 };
58 
59 #endif /* FAIRMQPOLLERZMQ_H_ */
Definition: FairMQTransportFactoryZMQ.h:28
Definition: FairMQPollerZMQ.h:29
Definition: FairMQChannel.h:30
Definition: FairMQPoller.h:15

privacy