ZeroEQ  0.7.0
ZeroEQ - Zero Event Queue
receiver.h
1 
2 /* Copyright (c) 2014-2015, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  */
5 
6 #ifndef ZEROEQ_RECEIVER_H
7 #define ZEROEQ_RECEIVER_H
8 
9 #include <zeroeq/api.h>
10 #include <zeroeq/types.h>
11 
12 #include <memory>
13 
14 #include <vector>
15 #include <string>
16 
17 namespace zeroeq
18 {
19 namespace detail { class Receiver; }
20 namespace connection { namespace detail{ class Broker; }}
21 
33 class Receiver
34 {
35 public:
37  ZEROEQ_API Receiver();
38 
47  ZEROEQ_API explicit Receiver( Receiver& shared );
48 
50  ZEROEQ_API virtual ~Receiver();
51 
62  ZEROEQ_API bool receive( const uint32_t timeout = TIMEOUT_INDEFINITE );
63 
64 protected:
65  friend class detail::Receiver;
66 
68  virtual void addSockets( std::vector< detail::Socket >& entries ) = 0;
69 
76  virtual void process( detail::Socket& socket, uint32_t timeout ) = 0;
77 
84  virtual void update() {}
85 
91  virtual void addConnection( const std::string& uri ) = 0;
92  friend class connection::detail::Broker;
93 
94  void* getZMQContext();
95 
96 private:
97  Receiver& operator=( const Receiver& ) = delete;
98 
99  std::shared_ptr< detail::Receiver > const _impl;
100 };
101 
102 }
103 
104 #endif
Defines export visibility macros for library ZeroEQ.
static const uint32_t TIMEOUT_INDEFINITE
Constant defining &#39;wait forever&#39; in methods with wait parameters.
Definition: types.h:68
Base class for entities receiving data.
Definition: receiver.h:33
Publish-subscribe classes for typed events.
Definition: broker.h:12
virtual void update()
Update the internal connection list.
Definition: receiver.h:84