-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.cpp
More file actions
44 lines (37 loc) · 1.33 KB
/
Copy pathclient.cpp
File metadata and controls
44 lines (37 loc) · 1.33 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
#include "HeapSort.h"
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TSocket.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <iostream>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace std;
using boost::shared_ptr;
using namespace ::myrpc::thrift;
int main(){
boost::shared_ptr<TSocket> socket(new TSocket("localhost", 9090));
boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
HeapSortClient client(protocol);
transport->open();
vector<int32_t> A;
cout << "Input the number to be sorted, terminating with #:" << endl;
char InputChar[20];
while( 1 )
{
cin >> InputChar;
if( '#' == *InputChar )
break;
A.push_back( atoi( InputChar ) );
}
vector<int32_t> returnA(A);
client.HeapSort( returnA, A, A.size() );
for( int i = A.size() - 1; i >= 0; i-- )
cout << returnA.at(i) << endl;
transport->close();
return 0;
}