6#include <bond/core/config.h>
8#include <bond/protocol/compact_binary.h>
9#include <bond/stream/stream_interface.h>
16template <
typename Reader>
17auto ReadBlob(Reader& reader)
18#if defined(BOND_NO_CXX14_RETURN_TYPE_DEDUCTION)
19 ->
decltype(GetBufferRange(GetCurrentBuffer(reader.GetBuffer()), GetCurrentBuffer(reader.GetBuffer())))
25 auto before = GetCurrentBuffer(reader.GetBuffer());
26 reader.GetBuffer().Skip(size);
27 auto after = GetCurrentBuffer(reader.GetBuffer());
29 return GetBufferRange(before, after);
33template <
typename Protocols,
typename T,
typename Writer>
34void MarshalToBlob(
const T& obj, Writer& writer)
36 auto output = CreateOutputBuffer(writer.GetBuffer());
37 CompactBinaryWriter<
decltype(output)> cbw(output);
39 Marshal<Protocols>(obj, cbw);
40 auto data = std::move(output).GetBuffer();
42 writer.Write(
static_cast<uint32_t
>(data.size()));
43 writer.GetBuffer().Write(data);
namespace bond
Definition: apply.h:17