ZeroEQ  0.9.0
ZeroEQ - Zero Event Queue
publisher.h
1 
2 /* Copyright (c) 2014-2017, Human Brain Project
3  * Daniel Nachbaur <daniel.nachbaur@epfl.ch>
4  * Stefan.Eilemann@epfl.ch
5  */
6 
7 #ifndef ZEROEQ_PUBLISHER_H
8 #define ZEROEQ_PUBLISHER_H
9 
10 #include <zeroeq/api.h>
11 #include <zeroeq/sender.h> // base class
12 #include <zeroeq/types.h>
13 
14 #include <memory>
15 
16 namespace zeroeq
17 {
26 class Publisher : public Sender
27 {
28 public:
40  ZEROEQ_API Publisher();
41 
54  ZEROEQ_API explicit Publisher(const std::string& session);
55 
67  ZEROEQ_API explicit Publisher(const URI& uri);
68 
82  ZEROEQ_API Publisher(const URI& uri, const std::string& session);
83 
84  ZEROEQ_API ~Publisher();
85 
94  ZEROEQ_API bool publish(const servus::Serializable& serializable);
95 
104  ZEROEQ_API bool publish(const uint128_t& event);
105 
116  ZEROEQ_API bool publish(const uint128_t& event, const void* data,
117  size_t size);
118 
127  ZEROEQ_API const URI& getURI() const;
128 
130  ZEROEQ_API const std::string& getSession() const;
131 
132  ZEROEQ_API std::string getAddress() const;
133 
134 private:
135  class Impl;
136  std::unique_ptr<Impl> _impl;
137 
138  Publisher(const Publisher&) = delete;
139  Publisher& operator=(const Publisher&) = delete;
140 
141  ZEROEQ_API zmq::SocketPtr getSocket() final;
142 };
143 }
144 
145 #endif
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
Definition: uri.h:19
Defines export visibility macros for library ZeroEQ.
const URI & getURI() const
Get the publisher URI.
const std::string & getSession() const
Publish-subscribe and request-reply.
Definition: client.h:10
bool publish(const servus::Serializable &serializable)
Publish the given serializable object to any subscriber.
Serves and publishes events, consumed by Subscriber.
Definition: publisher.h:26
Publisher()
Create a default publisher.
Interface for entities sending data.
Definition: sender.h:13