| 244 | |
| 245 | private: |
| 246 | uint32_t GetSize() { |
| 247 | // one byte for column count |
| 248 | uint32_t size = 1; |
| 249 | if (datas_.size() >= 128) { |
| 250 | size++; |
| 251 | } |
| 252 | std::vector<Column>::iterator it = datas_.begin(); |
| 253 | for (; it != datas_.end(); ++it) { |
| 254 | Column& col = *it; |
| 255 | size += (col.buffer.size() + 1 + 1); |
| 256 | if (col.buffer.size() >= 128) { |
| 257 | size++; |
| 258 | } |
| 259 | } |
| 260 | return size; |
| 261 | } |
| 262 | |
| 263 | // encode data to buffer |
| 264 | void Encode(const ColType& type, const void* data, uint16_t size) { |