ZeroEQ  0.8.0
ZeroEQ - Zero Event Queue
publisher.h
1 
2 /* Copyright (c) 2014-2016, 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/types.h>
12 
13 #include <memory>
14 
15 namespace zeroeq
16 {
25 class Publisher
26 {
27 public:
39  ZEROEQ_API Publisher();
40 
53  ZEROEQ_API explicit Publisher(const std::string& session);
54 
66  ZEROEQ_API explicit Publisher(const URI& uri);
67 
81  ZEROEQ_API Publisher(const URI& uri, const std::string& session);
82 
83  ZEROEQ_API ~Publisher();
84 
93  ZEROEQ_API bool publish(const servus::Serializable& serializable);
94 
103  ZEROEQ_API bool publish(const uint128_t& event);
104 
115  ZEROEQ_API bool publish(const uint128_t& event, const void* data,
116  size_t size);
117 
126  ZEROEQ_API const URI& getURI() const;
127 
129  ZEROEQ_API const std::string& getSession() const;
130 
131  ZEROEQ_API std::string getAddress() const;
132 
133 private:
134  class Impl;
135  std::unique_ptr<Impl> _impl;
136 
137  Publisher(const Publisher&) = delete;
138  Publisher& operator=(const Publisher&) = delete;
139 };
140 }
141 
142 #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 classes for typed events.
Definition: broker.h:12
bool publish(const servus::Serializable &serializable)
Publish the given serializable object to any subscriber.
Serves and publishes events, consumed by Subscriber.
Definition: publisher.h:25
Publisher()
Create a default publisher.