MCPcopy Create free account
hub / github.com/bytedance/bolt / registerSerializationTypeErased

Method registerSerializationTypeErased

bolt/type/Type.cpp:708–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706}
707
708void OpaqueType::registerSerializationTypeErased(
709 const std::shared_ptr<const OpaqueType>& type,
710 const std::string& persistentName,
711 SerializeFunc<void> serialize,
712 DeserializeFunc<void> deserialize) {
713 auto& registry = OpaqueSerdeRegistry::get();
714 BOLT_CHECK(
715 !registry.mapping.count(type->typeIndex_),
716 "Trying to register duplicated serialization information for type {}",
717 type->toString());
718 BOLT_CHECK(
719 !registry.reverse.count(persistentName),
720 "Trying to register duplicated persistent type name '{}' for type {}, "
721 "it's already taken by type {}",
722 persistentName,
723 type->toString(),
724 registry.reverse.at(persistentName)->toString());
725 registry.mapping[type->typeIndex_] = {
726 .persistentName = persistentName,
727 .serialize = serialize,
728 .deserialize = deserialize};
729 registry.reverse[persistentName] = type;
730}
731
732std::shared_ptr<const ArrayType> ARRAY(TypePtr elementType) {
733 return std::make_shared<const ArrayType>(std::move(elementType));

Callers

nothing calls this directly

Calls 4

getFunction · 0.50
countMethod · 0.45
toStringMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected