ztsdb
|
#include <encode.hpp>
Public Member Functions | |
Encode (net::NetHandler &c, Global::conn_id_t peerid_p, Global::reqid_t reqid_p, Global::reqid_t sourceid_p, Global::MsgType msgt_p) | |
Encode & | operator<< (const val::Value &v) |
Encode & | operator<< (const E *e) |
template<typename T > | |
Encode & | operator<< (const T &t) |
template<typename T > | |
Encode & | operator<< (const arr::Array< T > &t) |
Encode & | operator<< (const val::VI &t) |
Encode & | operator<< (const string &t) |
Encode & | operator<< (const arr::zstring &t) |
Encode & | operator<< (const tz::interval &t) |
Encode & | operator<< (const tz::period &t) |
Encode & | operator<< (const arr::zts &t) |
Encode & | operator<< (const bool t) |
ssize_t | flush () |
ssize_t | flush_end () |
Public Attributes | |
net::NetHandler & | com |
const Global::conn_id_t | peerid |
const Global::reqid_t | reqid |
const Global::reqid_t | sourceid |
const Global::MsgType | msgt |
char | buf [Global::CHUNKSZ] |
size_t | offset |
size_t | bytes |
This class handles the encoding/decoding of a message. A 'message' is a layer of abstraction above the chunk, itself a layer above the TCP segment (the reassembly of which is handled by NetHandler). An encode object is created each time a message of a given type (e.g. REQ, RSP) is sent. It handles the encoding of the contents and their (outgoing) segmentation in chunks. It also handles the reassembly of code buffers and the ongoing construction of a transmitted value. The main implementation goal is to avoid any copy of incoming and outgoing objects. Outgoing objects are sent in chunks straight from the object and incoming objects are reconstructed in place from chunks.