/** @brief serializes the object into the passed byte stream.
*/
void TableColumn::serialize(messageqcpp::ByteStream& b)
{
    if (preserialized->length() != 0)
    {
        b += *preserialized;
        preserialized->reset();
// 		cerr << "returning a preserialized column" << endl;
        return;
    }

    messageqcpp::ByteStream::octbyte rowCount;
    messageqcpp::ByteStream::octbyte oid;
    messageqcpp::ByteStream::byte nullFlag;
    messageqcpp::ByteStream::byte columnType;

    oid = fColumnOID;
    b << oid;

    columnType = fColumnType;
    b << columnType;

    if (fIsNullColumn)
        nullFlag = 1;
    else
        nullFlag = 0;

    b << nullFlag;

    if (!fIsNullColumn)
    {
        if (fColumnType == UINT64)
        {
            rowCount = fIntValues->size();
            b << rowCount;
            b.append((uint8_t*) & (*fIntValues)[0], 8 * rowCount);
        }
        else if (fColumnType == STRING)
        {
            rowCount = fStrValues->size();
            b << rowCount;

            for (uint32_t i = 0; i < rowCount; i++)
                b << (*fStrValues)[i];
        }
    }


}
Esempio n. 2
0
void TypelessData::serialize(messageqcpp::ByteStream &b) const
{
	b << len;
	b.append(data, len);
}