#define DEFAULT_RPC_SZ 1024
#define RPC_HEADER_SZ (std::max(sizeof(req_header), sizeof(reply_header)) + sizeof(rpc_sz_t))
+struct pass {
+ template<typename... Args> inline pass(Args&&...) {}
+};
+
class marshall {
private:
char *_buf; // Base of the raw bytes buffer (dynamically readjusted)
_ind = RPC_HEADER_SZ;
}
+ template <typename... Args> marshall(const Args&... args) : marshall() {
+ (void)pass{(*this << args)...};
+ }
+
~marshall() {
if (_buf)
free(_buf);
unpack(&h->ret);
_ind = RPC_HEADER_SZ;
}
+
+ template <class OutputIterator>
+ void iterate(OutputIterator i, int n) {
+ while (n--) {
+ typename OutputIterator::value_type t;
+ *this >> t;
+ *i++ = t;
+ }
+ }
};
unmarshall& operator>>(unmarshall &, bool &);