template <template <typename FidlProtocol> class SyncImpl, typename FidlProtocol>
class SyncEndpointVeneer
Defined at line 238 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/sync_call.h
A veneer interface object for client/server messaging implementations that
operate on a borrowed client/server endpoint. This class exposes both
managed and caller-allocating flavors, and delegates to
|SyncEndpointManagedVeneer| and |SyncEndpointBufferVeneer| respectively.
|SyncImpl| should be the template messaging class,
e.g. |WireSyncClientImpl| (without passing template parameters).
|FidlProtocol| should be the protocol marker.
It must not outlive the borrowed endpoint.
Public Methods
void SyncEndpointVeneer<SyncImpl, FidlProtocol> (fidl::internal::AnyUnownedTransport transport)
Defined at line 244 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/sync_call.h
internal::SyncEndpointManagedVeneer<SyncImpl<FidlProtocol>> operator-> ()
Returns a veneer object for the concrete messaging implementation.
Defined at line 248 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/sync_call.h
template <typename MemoryResource>
auto buffer (MemoryResource && resource)
Returns a veneer object which exposes the caller-allocating API, using
the provided |resource| to allocate buffers necessary for each call.
The requests and responses (if applicable) will live on those buffers.
Examples of supported memory resources are:
* |fidl::BufferSpan|, referencing a range of bytes.
* |fidl::AnyArena
&
|, referencing an arena.
* Any type for which there is a |MakeAnyBufferAllocator| specialization.
See |AnyBufferAllocator|.
The returned object borrows from this object, hence must not outlive
the current object.
The returned object may be briefly persisted for use over multiple calls:
fidl::Arena my_arena;
auto buffered = fidl::WireCall(client_end).buffer(my_arena);
fidl::WireUnownedResult foo = buffered->FooMethod();
fidl::WireUnownedResult bar = buffered->BarMethod();
...
In this situation, those calls will all use the initially provided memory
resource (`my_arena`) to allocate their message buffers. The memory
resource won't be reset/overwritten across calls. This means it's possible
to access the result from |FooMethod| after making another |BarMethod|
call. Note that if a |BufferSpan| is provided as the memory resource,
sharing memory resource in this manner may eventually exhaust the capacity
of the buffer span since it represents a single fixed size buffer. To reuse
(overwrite) the underlying buffer across multiple calls, obtain a new
caller-allocating veneer object for each call:
fidl::BufferSpan span(some_large_buffer, size);
auto client = fidl::WireCall(client_end);
client.buffer(span)->FooMethod();
client.buffer(span)->BarMethod();
Defined at line 290 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/sync_call.h