template <typename Interface>
class InterfaceRequest
Defined at line 63 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
The server endpoint of a FIDL channel.
The remote end of the channel expects this end of the channel to speak the
protocol associated with |Interface|. This type is the dual of
|InterfaceHandle|.
An |InterfaceRequest| does not have thread affinity and can therefore be
transferred to another thread or another process. To bind an implementation
of |Interface| to this |InterfaceRequest|, use a |Binding| object.
Typically, |InterfaceRequest| objects are created by a prospective client of
|Interface|, which then sends the |InterfaceRequest| to another process to
request that the remote process implement the |Interface|. This pattern
enables *pipelined* operation, in which the client can start calling methods
on an associated |InterfacePtr| immediately, before the |InterfaceRequest|
has reached the remote process and been bound to an implementation. These
method calls are buffered by the underlying channel until they are read by
the remote process.
Example:
#include "foo.fidl.h"
class FooImpl : public Foo {
public:
explicit FooImpl(InterfaceRequest
<Foo
> request)
: binding_(this, std::move(request)) {}
// Foo implementation here.
private:
Binding
<Foo
> binding_;
};
After the |InterfaceRequest| has been bound to an implementation, the
implementation will receive method calls from the remote endpoint of the
channel on the thread to which the |InterfaceRequest| was bound.
See also:
* |InterfaceHandle|, which is the client analog of an |InterfaceRequest|.
Public Methods
void InterfaceRequest<Interface> ()
Creates an |InterfaceHandle| whose underlying channel is invalid.
Some protocols contain messages that permit such |InterfaceRequest|
objects, which indicate that the client is not interested in the server
providing an implementation of |Interface|.
Defined at line 70 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void InterfaceRequest<Interface> (zx::channel channel)
Creates an |InterfaceHandle| that wraps the given |channel|.
Defined at line 73 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void InterfaceRequest<Interface> (const InterfaceRequest<Interface> & other)
Defined at line 75 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
InterfaceRequest<Interface> & operator= (const InterfaceRequest<Interface> & other)
Defined at line 76 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void InterfaceRequest<Interface> (InterfaceRequest<Interface> && other)
Defined at line 78 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
InterfaceRequest<Interface> & operator= (InterfaceRequest<Interface> && other)
Defined at line 80 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void InterfaceRequest<Interface> (std::nullptr_t )
Implicit conversion from nullptr to an |InterfaceRequest| with an
invalid |channel|.
Defined at line 87 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
bool is_valid ()
Whether the underlying channel is valid.
Defined at line 90 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
bool operator bool ()
Defined at line 91 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
zx::channel TakeChannel ()
Transfers ownership of the underlying channel to the caller.
Defined at line 94 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
const zx::channel & channel ()
The underlying channel.
Defined at line 97 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void set_channel (zx::channel channel)
Defined at line 98 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void Encode (Encoder * encoder, size_t offset, std::optional< ::fidl::HandleInformation> maybe_handle_info)
Defined at line 100 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
void Decode (Decoder * decoder, InterfaceRequest<Interface> * value, size_t offset)
Defined at line 107 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h
zx_status_t Close (zx_status_t epitaph_value)
Sends an Epitaph over the bound channel corresponding to the error passed
as a parameter, closes the channel, and unbinds it. An Epitaph is the last
message sent over a channel before a close operation; for the purposes of
this function, it can be thought of as a return code. See the FIDL
language spec for more information about Epitaphs.
The return value can be any of the return values of zx_channel_write.
Defined at line 118 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/interface_request.h