[
https://issues.apache.org/jira/browse/THRIFT-3480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
James E. King, III resolved THRIFT-3480.
----------------------------------------
Resolution: Won't Fix
This can be achieved with a TMemoryBuffer (I wrote a unit test to prove it..)
{noformat}
shared_ptr<TMemoryBuffer> memBuffer(new TMemoryBuffer());
shared_ptr<TBinaryProtocol> binaryProtcol(new TBinaryProtocol(memBuffer));
thrift::test::Xtruct object;
object.i32_thing = 10;
object.i64_thing = 30;
object.string_thing = "who's your daddy?";
uint32_t size = object.write(binaryProtcol.get());
BOOST_CHECK_EQUAL(47, size);
{noformat}
> offer a simple approach to compute byte size of the serialized object
> ---------------------------------------------------------------------
>
> Key: THRIFT-3480
> URL: https://issues.apache.org/jira/browse/THRIFT-3480
> Project: Thrift
> Issue Type: New Feature
> Components: C++ - Library
> Affects Versions: 0.9.3
> Reporter: Xiaoshuang LU
> Assignee: James E. King, III
> Attachments: THRIFT-3480.patch
>
>
> Hi Thrift guys, I would like to propose a transport for computing byte size
> of the serialized object. Here is a example.
> {code}
> boost::shared_ptr<TWriteOnlyTransport> transport{ new TWriteOnlyTransport
> };
> boost::shared_ptr<TBinaryProtocol> protocol{ new
> TBinaryProtocol(transport) };
> size = object.write(protocol.get());
> {code}
> A write only transport can be written but never read. It discards all data
> written to it but reports that the write operation succeeded. And the truth
> is that write function of this transport does nothing at all.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)