ZeroEQ  0.9.0
ZeroEQ - Zero Event Queue
client.h
1 
2 /* Copyright (c) 2017, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  */
5 
6 #pragma once
7 
8 #include <zeroeq/receiver.h> // base class
9 
10 namespace zeroeq
11 {
34 class Client : public Receiver
35 {
36 public:
48  ZEROEQ_API Client();
49 
62  ZEROEQ_API explicit Client(const std::string& session);
63 
73  ZEROEQ_API explicit Client(const URIs& uris);
74 
81  ZEROEQ_API explicit Client(Receiver& shared);
82 
92  ZEROEQ_API Client(const std::string& session, Receiver& shared);
93 
102  ZEROEQ_API Client(const URIs& uris, Receiver& shared);
103 
105  ZEROEQ_API ~Client();
106 
121  ZEROEQ_API bool request(const servus::Serializable& request,
122  const ReplyFunc& func);
123 
134  ZEROEQ_API bool request(const uint128_t& request, const void* data,
135  size_t size, const ReplyFunc& func);
136 
138  ZEROEQ_API const std::string& getSession() const;
139 
140 private:
141  class Impl;
142  std::unique_ptr<Impl> _impl;
143 
144  // Receiver API
145  void addSockets(std::vector<detail::Socket>& entries) final;
146  bool process(detail::Socket& socket) final;
147  void update() final;
148  void addConnection(const std::string& uri) final;
149 };
150 }
Client()
Create a default client.
const std::string & getSession() const
~Client()
Destroy this client.
Requests a remote procedure call on a Server.
Definition: client.h:34
std::vector< URI > URIs
A vector of URIs.
Definition: types.h:53
Base class for entities receiving data.
Definition: receiver.h:38
Publish-subscribe and request-reply.
Definition: client.h:10
std::function< void(const uint128_t &, const void *, size_t)> ReplyFunc
Callback for the reply of a Client::request() (reply ID, reply data).
Definition: types.h:62
bool request(const servus::Serializable &request, const ReplyFunc &func)
Request the execution of the given data on a connected Server.