-
Notifications
You must be signed in to change notification settings - Fork 0
/
NyanSync.h
304 lines (242 loc) · 9.3 KB
/
NyanSync.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/**
* Autogenerated by Thrift Compiler (1.0.0-dev)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef NyanSync_H
#define NyanSync_H
#include <thrift/TDispatchProcessor.h>
#include <thrift/async/TConcurrentClientSyncInfo.h>
#include "nyan_types.h"
namespace nyan {
#ifdef _WIN32
#pragma warning( push )
#pragma warning (disable : 4250 ) //inheriting methods via dominance
#endif
class NyanSyncIf {
public:
virtual ~NyanSyncIf() {}
virtual void sync(SyncPacket& _return) = 0;
};
class NyanSyncIfFactory {
public:
typedef NyanSyncIf Handler;
virtual ~NyanSyncIfFactory() {}
virtual NyanSyncIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
virtual void releaseHandler(NyanSyncIf* /* handler */) = 0;
};
class NyanSyncIfSingletonFactory : virtual public NyanSyncIfFactory {
public:
NyanSyncIfSingletonFactory(const boost::shared_ptr<NyanSyncIf>& iface) : iface_(iface) {}
virtual ~NyanSyncIfSingletonFactory() {}
virtual NyanSyncIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
return iface_.get();
}
virtual void releaseHandler(NyanSyncIf* /* handler */) {}
protected:
boost::shared_ptr<NyanSyncIf> iface_;
};
class NyanSyncNull : virtual public NyanSyncIf {
public:
virtual ~NyanSyncNull() {}
void sync(SyncPacket& /* _return */) {
return;
}
};
class NyanSync_sync_args {
public:
static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B";
static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
NyanSync_sync_args(const NyanSync_sync_args&);
NyanSync_sync_args& operator=(const NyanSync_sync_args&);
NyanSync_sync_args() {
}
virtual ~NyanSync_sync_args() throw();
bool operator == (const NyanSync_sync_args & /* rhs */) const
{
return true;
}
bool operator != (const NyanSync_sync_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const NyanSync_sync_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const NyanSync_sync_args& obj);
};
class NyanSync_sync_pargs {
public:
static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B";
static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
virtual ~NyanSync_sync_pargs() throw();
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const NyanSync_sync_pargs& obj);
};
typedef struct _NyanSync_sync_result__isset {
_NyanSync_sync_result__isset() : success(false) {}
bool success :1;
} _NyanSync_sync_result__isset;
class NyanSync_sync_result {
public:
static const char* ascii_fingerprint; // = "2608B2248A20695720752F369582E1E6";
static const uint8_t binary_fingerprint[16]; // = {0x26,0x08,0xB2,0x24,0x8A,0x20,0x69,0x57,0x20,0x75,0x2F,0x36,0x95,0x82,0xE1,0xE6};
NyanSync_sync_result(const NyanSync_sync_result&);
NyanSync_sync_result& operator=(const NyanSync_sync_result&);
NyanSync_sync_result() {
}
virtual ~NyanSync_sync_result() throw();
SyncPacket success;
_NyanSync_sync_result__isset __isset;
void __set_success(const SyncPacket& val);
bool operator == (const NyanSync_sync_result & rhs) const
{
if (!(success == rhs.success))
return false;
return true;
}
bool operator != (const NyanSync_sync_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const NyanSync_sync_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const NyanSync_sync_result& obj);
};
typedef struct _NyanSync_sync_presult__isset {
_NyanSync_sync_presult__isset() : success(false) {}
bool success :1;
} _NyanSync_sync_presult__isset;
class NyanSync_sync_presult {
public:
static const char* ascii_fingerprint; // = "2608B2248A20695720752F369582E1E6";
static const uint8_t binary_fingerprint[16]; // = {0x26,0x08,0xB2,0x24,0x8A,0x20,0x69,0x57,0x20,0x75,0x2F,0x36,0x95,0x82,0xE1,0xE6};
virtual ~NyanSync_sync_presult() throw();
SyncPacket* success;
_NyanSync_sync_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const NyanSync_sync_presult& obj);
};
class NyanSyncClient : virtual public NyanSyncIf {
public:
NyanSyncClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
setProtocol(prot);
}
NyanSyncClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
setProtocol(iprot,oprot);
}
private:
void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
setProtocol(prot,prot);
}
void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
piprot_=iprot;
poprot_=oprot;
iprot_ = iprot.get();
oprot_ = oprot.get();
}
public:
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
return piprot_;
}
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
return poprot_;
}
void sync(SyncPacket& _return);
void send_sync();
void recv_sync(SyncPacket& _return);
protected:
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
::apache::thrift::protocol::TProtocol* iprot_;
::apache::thrift::protocol::TProtocol* oprot_;
};
class NyanSyncProcessor : public ::apache::thrift::TDispatchProcessor {
protected:
boost::shared_ptr<NyanSyncIf> iface_;
virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
private:
typedef void (NyanSyncProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
typedef std::map<std::string, ProcessFunction> ProcessMap;
ProcessMap processMap_;
void process_sync(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
public:
NyanSyncProcessor(boost::shared_ptr<NyanSyncIf> iface) :
iface_(iface) {
processMap_["sync"] = &NyanSyncProcessor::process_sync;
}
virtual ~NyanSyncProcessor() {}
};
class NyanSyncProcessorFactory : public ::apache::thrift::TProcessorFactory {
public:
NyanSyncProcessorFactory(const ::boost::shared_ptr< NyanSyncIfFactory >& handlerFactory) :
handlerFactory_(handlerFactory) {}
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
protected:
::boost::shared_ptr< NyanSyncIfFactory > handlerFactory_;
};
class NyanSyncMultiface : virtual public NyanSyncIf {
public:
NyanSyncMultiface(std::vector<boost::shared_ptr<NyanSyncIf> >& ifaces) : ifaces_(ifaces) {
}
virtual ~NyanSyncMultiface() {}
protected:
std::vector<boost::shared_ptr<NyanSyncIf> > ifaces_;
NyanSyncMultiface() {}
void add(boost::shared_ptr<NyanSyncIf> iface) {
ifaces_.push_back(iface);
}
public:
void sync(SyncPacket& _return) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->sync(_return);
}
ifaces_[i]->sync(_return);
return;
}
};
// The 'concurrent' client is a thread safe client that correctly handles
// out of order responses. It is slower than the regular client, so should
// only be used when you need to share a connection among multiple threads
class NyanSyncConcurrentClient : virtual public NyanSyncIf {
public:
NyanSyncConcurrentClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
setProtocol(prot);
}
NyanSyncConcurrentClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
setProtocol(iprot,oprot);
}
private:
void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
setProtocol(prot,prot);
}
void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
piprot_=iprot;
poprot_=oprot;
iprot_ = iprot.get();
oprot_ = oprot.get();
}
public:
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
return piprot_;
}
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
return poprot_;
}
void sync(SyncPacket& _return);
int32_t send_sync();
void recv_sync(SyncPacket& _return, const int32_t seqid);
protected:
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
::apache::thrift::protocol::TProtocol* iprot_;
::apache::thrift::protocol::TProtocol* oprot_;
::apache::thrift::async::TConcurrentClientSyncInfo sync_;
};
#ifdef _WIN32
#pragma warning( pop )
#endif
} // namespace
#endif