TEMPLATE MAGIC FOR GREAT JUSTICE
[invirt/third/libt4.git] / rpc / rpctest.cc
index c43a9da..8aed748 100644 (file)
@@ -24,10 +24,10 @@ int port;
 // from multiple classes.
 class srv {
        public:
 // from multiple classes.
 class srv {
        public:
-               int handle_22(const std::string a, const std::string b, std::string & r);
-               int handle_fast(const int a, int &r);
-               int handle_slow(const int a, int &r);
-               int handle_bigrep(const int a, std::string &r);
+               int handle_22(std::string & r, const std::string a, const std::string b);
+               int handle_fast(int &r, const int a);
+               int handle_slow(int &r, const int a);
+               int handle_bigrep(std::string &r, const int a);
 };
 
 // a handler. a and b are arguments, r is the result.
 };
 
 // a handler. a and b are arguments, r is the result.
@@ -38,21 +38,21 @@ class srv {
 // at these argument types, so this function definition
 // does what a .x file does in SunRPC.
 int
 // at these argument types, so this function definition
 // does what a .x file does in SunRPC.
 int
-srv::handle_22(const std::string a, std::string b, std::string &r)
+srv::handle_22(std::string &r, const std::string a, std::string b)
 {
        r = a + b;
        return 0;
 }
 
 int
 {
        r = a + b;
        return 0;
 }
 
 int
-srv::handle_fast(const int a, int &r)
+srv::handle_fast(int &r, const int a)
 {
        r = a + 1;
        return 0;
 }
 
 int
 {
        r = a + 1;
        return 0;
 }
 
 int
-srv::handle_slow(const int a, int &r)
+srv::handle_slow(int &r, const int a)
 {
        usleep(random() % 5000);
        r = a + 2;
 {
        usleep(random() % 5000);
        r = a + 2;
@@ -60,7 +60,7 @@ srv::handle_slow(const int a, int &r)
 }
 
 int
 }
 
 int
-srv::handle_bigrep(const int len, std::string &r)
+srv::handle_bigrep(std::string &r, const int len)
 {
        r = std::string(len, 'x');
        return 0;
 {
        r = std::string(len, 'x');
        return 0;
@@ -71,10 +71,10 @@ srv service;
 void startserver()
 {
        server = new rpcs(port);
 void startserver()
 {
        server = new rpcs(port);
-       server->reg(22, &service, &srv::handle_22);
-       server->reg(23, &service, &srv::handle_fast);
-       server->reg(24, &service, &srv::handle_slow);
-       server->reg(25, &service, &srv::handle_bigrep);
+       server->reg(22, &srv::handle_22, &service);
+       server->reg(23, &srv::handle_fast, &service);
+       server->reg(24, &srv::handle_slow, &service);
+       server->reg(25, &srv::handle_bigrep, &service);
 }
 
 void
 }
 
 void