Example #1
0
void message::serialize(serializer& sink) const {
  // ttn can be nullptr even if tuple is not empty (in case of object_array)
  std::string tname = empty() ? "@<>" : tuple_type_names();
  auto uti_map = detail::singletons::get_uniform_type_info_map();
  auto uti = uti_map->by_uniform_name(tname);
  if (uti == nullptr) {
    std::string err = "could not get uniform type info for \"";
    err += tname;
    err += "\"";
    CAF_LOGF_ERROR(err);
    throw std::runtime_error(err);
  }
  sink.begin_object(uti);
  for (size_t i = 0; i < size(); ++i) {
    uniform_type_info::from(uniform_name_at(i))->serialize(at(i), &sink);
  }
  sink.end_object();
}