ZeroEQ  0.6.0
ZeroEQ - Zero Event Queue
types.h
1 
2 /* Copyright (c) 2014-2016, Human Brain Project
3  * Daniel Nachbaur <daniel.nachbaur@epfl.ch>
4  * Juan Hernando <jhernando@fi.upm.es>
5  */
6 
7 #ifndef ZEROEQ_TYPES_H
8 #define ZEROEQ_TYPES_H
9 
10 #include <zeroeq/defines.h>
11 #include <servus/types.h>
12 #include <servus/uint128_t.h>
13 #include <functional>
14 #include <memory>
15 
16 #ifdef _WIN32
17 # define NOMINMAX
18 # include <winsock2.h> // SOCKET
19 #endif
20 
37 namespace zeroeq
38 {
39 
40 using servus::uint128_t;
41 class Publisher;
42 class Subscriber;
43 class URI;
44 
46 typedef std::function< void() > EventFunc;
47 
49 typedef std::function< void( const void*, size_t ) > EventPayloadFunc;
50 
52 typedef std::function< bool() > PUTFunc;
53 
55 typedef std::function< bool( const std::string& ) > PUTPayloadFunc;
56 
58 typedef std::function< std::string() > GETFunc;
59 
60 #ifdef WIN32
61 typedef SOCKET SocketDescriptor;
62 #else
63 typedef int SocketDescriptor;
64 #endif
65 
67 // Attn: identical to Win32 INFINITE!
68 static const uint32_t TIMEOUT_INDEFINITE = 0xffffffffu;
69 
70 using servus::make_uint128;
71 
72 static const std::string DEFAULT_SESSION = "__zeroeq";
73 static const std::string NULL_SESSION = "__null_session";
74 
75 namespace detail { struct Socket; }
76 
77 }
78 
79 #endif
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
Definition: uri.h:20
std::function< bool() > PUTFunc
HTTP PUT callback w/o payload, return reply success.
Definition: types.h:52
static const uint32_t TIMEOUT_INDEFINITE
Constant defining 'wait forever' in methods with wait parameters.
Definition: types.h:68
std::function< void() > EventFunc
Callback for receival of subscribed event w/o payload.
Definition: types.h:43
std::function< std::string() > GETFunc
HTTP GET callback to return JSON reply.
Definition: types.h:58
std::function< bool(const std::string &) > PUTPayloadFunc
HTTP PUT callback w/ JSON payload, return reply success.
Definition: types.h:55
std::function< void(const void *, size_t) > EventPayloadFunc
Callback for receival of subscribed event w/ payload.
Definition: types.h:49
Publish-subscribe classes for typed events.
Definition: broker.h:12