X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/4b9798f44ae94deabf87dd534337b55259272950..b86bce0900f88c530f23dd602a8f2ef9ce008f8a:/rsm_client.h diff --git a/rsm_client.h b/rsm_client.h index 039bc26..b275974 100644 --- a/rsm_client.h +++ b/rsm_client.h @@ -24,34 +24,19 @@ class rsm_client { bool init_members(); public: rsm_client(std::string dst); - rsm_protocol::status invoke(int proc, std::string req, std::string &rep); + rsm_protocol::status invoke(int proc, std::string &rep, const std::string &req); - template - int call(unsigned int proc, const A1 & a1, R &r); - - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, R &r); - - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - R &r); - - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - const A4 & a4, R &r); - - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - const A4 & a4, const A5 & a5, R &r); + template + int call(unsigned int proc, R & r, const Args & ...a1); private: - template int call_m(unsigned int proc, marshall &req, R &r); + template int call_m(unsigned int proc, R & r, const marshall & req); }; template -int rsm_client::call_m(unsigned int proc, marshall &req, R &r) { +int rsm_client::call_m(unsigned int proc, R & r, const marshall & req) { std::string rep; std::string res; - int intret = invoke(proc, req.str(), rep); + int intret = invoke(proc, rep, req.cstr()); VERIFY( intret == rsm_client_protocol::OK ); unmarshall u(rep); u >> intret; @@ -77,55 +62,9 @@ int rsm_client::call_m(unsigned int proc, marshall &req, R &r) { return intret; } -template -int rsm_client::call(unsigned int proc, const A1 & a1, R & r) { - marshall m; - m << a1; - return call_m(proc, m, r); -} - -template -int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, R & r) { - marshall m; - m << a1; - m << a2; - return call_m(proc, m, r); -} - -template -int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, R & r) { - marshall m; - std::string rep; - std::string res; - m << a1; - m << a2; - m << a3; - return call_m(proc, m, r); -} - -template -int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, const A4 & a4, R & r) { - marshall m; - std::string rep; - std::string res; - m << a1; - m << a2; - m << a3; - m << a4; - return call_m(proc, m, r); -} - -template -int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, const A4 & a4, const A5 & a5, R & r) { - marshall m; - std::string rep; - std::string res; - m << a1; - m << a2; - m << a3; - m << a4; - m << a5; - return call_m(proc, m, r); +template +int rsm_client::call(unsigned int proc, R & r, const Args & ...a1) { + return call_m(proc, r, marshall{a1...}); } #endif