add from_wire_type()

This commit is contained in:
Michael Davidsaver
2020-02-20 22:17:07 -08:00
parent 6504466bbf
commit 1aa1b56acb
2 changed files with 13 additions and 3 deletions
+9 -3
View File
@@ -730,7 +730,7 @@ void from_wire_valid(Buffer& buf, TypeStore& ctxt, Value& val)
}
}
void from_wire_type_value(Buffer& buf, TypeStore& ctxt, Value& val)
void from_wire_type(Buffer& buf, TypeStore& ctxt, Value& val)
{
auto descs(std::make_shared<std::vector<FieldDesc>>());
@@ -743,13 +743,19 @@ void from_wire_type_value(Buffer& buf, TypeStore& ctxt, Value& val)
std::shared_ptr<const FieldDesc> stype(descs, descs->data()); // alias
val = Value::Helper::build(stype);
from_wire_full(buf, ctxt, val);
} else {
val = Value();
}
}
void from_wire_type_value(Buffer& buf, TypeStore& ctxt, Value& val)
{
from_wire_type(buf, ctxt, val);
if(buf.good() && val)
from_wire_full(buf, ctxt, val);
}
}} // namespace pvxs::impl
#endif // DATAENCODE_H
+4
View File
@@ -157,6 +157,10 @@ void to_wire_valid(Buffer& buf, const Value& val, const BitMask* mask=nullptr);
//! deserialize type description
PVXS_API
void from_wire_type(Buffer& buf, TypeStore& ctxt, Value& val);
//! deserialize full Value
PVXS_API
void from_wire_full(Buffer& buf, TypeStore& ctxt, Value& val);
//! deserialize BitMask and partial Value