ZeroEQ  0.6.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 {
17 
26 class Publisher
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 
142 }
143 
144 #endif
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
Definition: uri.h:20
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:26
Publisher()
Create a default publisher.