X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/5bb7eb131773abd9e642f83629528b4c4e706b2e..a5f10a497bebfc680bf418193f1fd9f1ad7cc417:/rpc/marshall.h diff --git a/rpc/marshall.h b/rpc/marshall.h index 597c0fc..69b10df 100644 --- a/rpc/marshall.h +++ b/rpc/marshall.h @@ -32,7 +32,7 @@ class marshall { // with header inline operator string() const { return buf_.substr(0,index_); } // without header - inline string content() { return buf_.substr(RPC_HEADER_SZ,index_-RPC_HEADER_SZ); } + inline string content() const { return buf_.substr(RPC_HEADER_SZ,index_-RPC_HEADER_SZ); } // letting S be a defaulted template parameter forces the compiler to // delay looking up operator<<(marshall&, rpc_sz_t) until we define it @@ -234,4 +234,17 @@ operator>>(unmarshall &u, E &e) { return u; } +// +// Recursive marshalling +// + +inline marshall & operator<<(marshall &m, marshall &n) { + return m << n.content(); +} + +inline unmarshall & operator>>(unmarshall &u, unmarshall &v) { + v = unmarshall(u._grab(), false); + return u; +} + #endif