-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUber_server.skeleton.cpp
More file actions
69 lines (54 loc) · 1.95 KB
/
Uber_server.skeleton.cpp
File metadata and controls
69 lines (54 loc) · 1.95 KB
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
// This autogenerated skeleton file illustrates how to build a server.
// You should copy it to another filename to avoid overwriting it.
#include "Uber.h"
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
using namespace ::Uber;
class UberHandler : virtual public UberIf {
public:
UberHandler() {
// Your initialization goes here
}
void BeginTrip(const TripPoint& trip_point) {
// Your implementation goes here
printf("BeginTrip\n");
}
void UpdateTrip(const TripPoint& trip_point) {
// Your implementation goes here
printf("UpdateTrip\n");
}
void EndTrip(const TripPointAmount& trip_point_amount) {
// Your implementation goes here
printf("EndTrip\n");
}
int32_t NumTripsPassed(const GeoRect& rectangle) {
// Your implementation goes here
printf("NumTripsPassed\n");
}
void NumTripsStartedOrStoppedAndFare(NumFare& _return, const GeoRect& rectangle) {
// Your implementation goes here
printf("NumTripsStartedOrStoppedAndFare\n");
}
int32_t NumOccurringTrips(const int64_t timestamp) {
// Your implementation goes here
printf("NumOccurringTrips\n");
}
};
int main(int argc, char **argv) {
int port = 9090;
shared_ptr<UberHandler> handler(new UberHandler());
shared_ptr<TProcessor> processor(new UberProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
server.serve();
return 0;
}