예제 #1
0
 std::enable_if_t<(std::is_integral<T>::value || std::is_enum<T>::value) &&
                  !std::is_same<T, uint32_t>::value && !std::is_same<T, uint64_t>::value &&
                  !std::is_same<T, int32_t>::value && !std::is_same<T, int64_t>::value>
 operator()(T const & t, char const * /* name */ = nullptr)
 {
   WriteToSink(m_sink, t);
 }
예제 #2
0
void QuerySaver::Serialize(string & data) const
{
  vector<uint8_t> rawData;
  MemWriter<vector<uint8_t>> writer(rawData);
  TLength size = m_topQueries.size();
  WriteToSink(writer, size);
  for (auto const & query : m_topQueries)
  {
    size = query.first.size();
    WriteToSink(writer, size);
    writer.Write(query.first.c_str(), size);
    size = query.second.size();
    WriteToSink(writer, size);
    writer.Write(query.second.c_str(), size);
  }
  data = base64::Encode(string(rawData.begin(), rawData.end()));
}
예제 #3
0
// static
void Serdes::SerializeInfo(Info const & info, std::vector<int8_t> & result)
{
  result.clear();
  using Sink = MemWriter<std::vector<int8_t>>;
  Sink writer(result);

  WriteToSink(writer, static_cast<int8_t>(Info::GetVersion()));

  coding::SerializerJson<Sink> ser(writer);
  ser(info);
}
예제 #4
0
 void Serialize(TWriter & writer, TValue const & v) const
 {
   serial::SavePoint(writer, v.m_pt, m_codingParams);
   WriteToSink(writer, v.m_featureId);
   WriteToSink(writer, v.m_rank);
 }
예제 #5
0
 void Serialize(TWriter & writer, TValue const & v) const
 {
   WriteToSink(writer, v.m_featureId);
 }
예제 #6
0
void WriteRawData(FileWriter & writer, std::vector<uint8_t> const & rawData)
{
  uint64_t const size = static_cast<uint64_t>(rawData.size());
  WriteToSink(writer, size);
  writer.Write(rawData.data(), size);
}
예제 #7
0
void WriteZigZag(FileWriter & writer, int64_t duration)
{
  uint64_t const encoded = bits::ZigZagEncode(duration);
  WriteToSink(writer, encoded);
}