template <typename T>
struct RemoteAbiTranscriberImpl
Defined at line 184 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-transcriber.h
This partial specialization handles class / struct types by applying
separate RemoteAbiTranscriber instantiations to each of their bases and
members. For this to work, each class type without its own specialization
must instead provide some helpers in the form of inner type and template
aliases. No explicit specialization is required for a class or struct type
if it meets the following API:
* `using AbiLocal = ...;` gives the LocalAbiTraits equivalent
instantiation of the specialized type: the type FromLocal will accept
as input.
* ```
template
<template
<class
...> class Template>
using AbiBases = Template
<MyBase
, ...>;
```
This alias instantiates Template with each direct base class of the
specialized class, if any. The transcription will just instantiate
RemoteAbiTranscriber on each base class in turn and use its FromLocal on
the upcasted reference for that portion of the object. **NOTE:** This
list must be a 1:1 parallel with `AbiLocal::AbiBases
<Template
>`!
* ```
template
<template
<auto
...> class Template>
using AbiMembers = Template
<
&MyClass
::member_, ...>;
```
This alias instantiates Template with the pointer-to-member for each
member of the specialized class, if it has any. The transcription will
just instantiate RemoteAbiTranscriber on each member's type in turn and
use its FromLocal. **NOTE:** This list must be a 1:1 parallel with
`AbiLocal::AbiMembers
<Template
>`!
This ultimately just calls `RemoteAbiTranscriber
<MemberType
>::FromLocal` on
each `out.Member` and the corresponding `in.Member`. The Context object
passed to FromLocal on this transcriber for the class object must provide
this additional template method:
```
template
<auto
Member, typename MemberType, auto LocalMember, typename Local>
bool MemberFromLocal(MemberType
&
out, const Local
&
in) {
return ld::RemoteAbiTranscriber
<MemberType
>::FromLocal(
*this, out, in.*LocalMember);
}
```
This is always called with four explicit template arguments, though the
argument values are always a `MemberType
&
` and a `const Local
&
`, and could
have been deduced. The first template argument is some pointer-to-member
`MemberType Remote::*`, that is, a pointer-to-member for the remote version
of the class type. The `out` argument is a reference to the specific
member in the remote version of the class object being filled in. However,
the `in` argument is instead a reference to the whole class object whose
corresponding member is to be transcribed. The generic implementation
shown above is the default logic: Just call the member type's FromLocal
with the same context object. Explicit specializations for specific
members can use bespoke logic instead.
Context::MemberFromLocal must provide a const overload if the Context
object is passed to FromLocal as `const Context
&
`. If there is only a
non-const overload of MemberFromLocal, then a mutable (or rvalue) `Context`
object must be passed to FromLocal, since that reference (or value) is what
MemberFromLocal will be called on.
Public Methods
template <auto Member, auto LocalMember, typename Context>
bool MemberFromLocal (Context & ctx, T & out, const Local & in)
Defined at line 233 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-transcriber.h
template <auto a>
bool Same (auto a, decltype(a) b)
Defined at line 243 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-transcriber.h
template <typename A, typename B>
bool Same (A a, B b)
Defined at line 246 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-transcriber.h
template <typename Context>
bool FromLocal (Context && ctx, T & out, const Local & in)
Defined at line 293 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-transcriber.h
template <auto... M>
void AssertAbiMembers ()
This will check that the template parameter lists all the members in
T::AbiMembers.
Defined at line 303 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-transcriber.h