// Generated by Cap'n Proto compiler, DO NOT EDIT
// source: persistent.capnp

#pragma once

#include <capnp/generated-header-support.h>
#include <kj/windows-sanity.h>
#if !CAPNP_LITE
#include <capnp/capability.h>
#endif  // !CAPNP_LITE

#if CAPNP_VERSION != 8000
#error "Version mismatch between generated code and library headers.  You must use the same version of the Cap'n Proto compiler and library."
#endif


namespace capnp {
namespace schemas {

CAPNP_DECLARE_SCHEMA(c8cb212fcd9f5691);
CAPNP_DECLARE_SCHEMA(f76fba59183073a5);
CAPNP_DECLARE_SCHEMA(b76848c18c40efbf);
CAPNP_DECLARE_SCHEMA(84ff286cd00a3ed4);
CAPNP_DECLARE_SCHEMA(f0c2cc1d3909574d);
CAPNP_DECLARE_SCHEMA(ecafa18b482da3aa);
CAPNP_DECLARE_SCHEMA(f622595091cafb67);

}  // namespace schemas
}  // namespace capnp

namespace capnp {

template <typename SturdyRef = ::capnp::AnyPointer, typename Owner = ::capnp::AnyPointer>
struct Persistent {
  Persistent() = delete;

#if !CAPNP_LITE
  class Client;
  class Server;
#endif  // !CAPNP_LITE

  struct SaveParams;
  struct SaveResults;

  #if !CAPNP_LITE
  struct _capnpPrivate {
    CAPNP_DECLARE_INTERFACE_HEADER(c8cb212fcd9f5691)
    static const ::capnp::_::RawBrandedSchema::Scope brandScopes[];
    static const ::capnp::_::RawBrandedSchema::Binding brandBindings[];
    static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[];
    static const ::capnp::_::RawBrandedSchema specificBrand;
    static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); }
  };
  #endif  // !CAPNP_LITE
};

template <typename SturdyRef, typename Owner>
struct Persistent<SturdyRef, Owner>::SaveParams {
  SaveParams() = delete;

  class Reader;
  class Builder;
  class Pipeline;

  struct _capnpPrivate {
    CAPNP_DECLARE_STRUCT_HEADER(f76fba59183073a5, 0, 1)
    #if !CAPNP_LITE
    static const ::capnp::_::RawBrandedSchema::Scope brandScopes[];
    static const ::capnp::_::RawBrandedSchema::Binding brandBindings[];
    static const ::capnp::_::RawBrandedSchema specificBrand;
    static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); }
    #endif  // !CAPNP_LITE
  };
};

template <typename SturdyRef, typename Owner>
struct Persistent<SturdyRef, Owner>::SaveResults {
  SaveResults() = delete;

  class Reader;
  class Builder;
  class Pipeline;

  struct _capnpPrivate {
    CAPNP_DECLARE_STRUCT_HEADER(b76848c18c40efbf, 0, 1)
    #if !CAPNP_LITE
    static const ::capnp::_::RawBrandedSchema::Scope brandScopes[];
    static const ::capnp::_::RawBrandedSchema::Binding brandBindings[];
    static const ::capnp::_::RawBrandedSchema specificBrand;
    static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); }
    #endif  // !CAPNP_LITE
  };
};

template <typename InternalRef = ::capnp::AnyPointer, typename ExternalRef = ::capnp::AnyPointer, typename InternalOwner = ::capnp::AnyPointer, typename ExternalOwner = ::capnp::AnyPointer>
struct RealmGateway {
  RealmGateway() = delete;

#if !CAPNP_LITE
  class Client;
  class Server;
#endif  // !CAPNP_LITE

  struct ImportParams;
  struct ExportParams;

  #if !CAPNP_LITE
  struct _capnpPrivate {
    CAPNP_DECLARE_INTERFACE_HEADER(84ff286cd00a3ed4)
    static const ::capnp::_::RawBrandedSchema::Scope brandScopes[];
    static const ::capnp::_::RawBrandedSchema::Binding brandBindings[];
    static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[];
    static const ::capnp::_::RawBrandedSchema specificBrand;
    static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); }
  };
  #endif  // !CAPNP_LITE
};

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
struct RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams {
  ImportParams() = delete;

  class Reader;
  class Builder;
  class Pipeline;

  struct _capnpPrivate {
    CAPNP_DECLARE_STRUCT_HEADER(f0c2cc1d3909574d, 0, 2)
    #if !CAPNP_LITE
    static const ::capnp::_::RawBrandedSchema::Scope brandScopes[];
    static const ::capnp::_::RawBrandedSchema::Binding brandBindings[];
    static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[];
    static const ::capnp::_::RawBrandedSchema specificBrand;
    static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); }
    #endif  // !CAPNP_LITE
  };
};

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
struct RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams {
  ExportParams() = delete;

  class Reader;
  class Builder;
  class Pipeline;

  struct _capnpPrivate {
    CAPNP_DECLARE_STRUCT_HEADER(ecafa18b482da3aa, 0, 2)
    #if !CAPNP_LITE
    static const ::capnp::_::RawBrandedSchema::Scope brandScopes[];
    static const ::capnp::_::RawBrandedSchema::Binding brandBindings[];
    static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[];
    static const ::capnp::_::RawBrandedSchema specificBrand;
    static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); }
    #endif  // !CAPNP_LITE
  };
};

// =======================================================================================

#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::Client
    : public virtual ::capnp::Capability::Client {
public:
  typedef Persistent Calls;
  typedef Persistent Reads;

  Client(decltype(nullptr));
  explicit Client(::kj::Own< ::capnp::ClientHook>&& hook);
  template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Server*>()>>
  Client(::kj::Own<_t>&& server);
  template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Client*>()>>
  Client(::kj::Promise<_t>&& promise);
  Client(::kj::Exception&& exception);
  Client(Client&) = default;
  Client(Client&&) = default;
  Client& operator=(Client& other);
  Client& operator=(Client&& other);

  template <typename SturdyRef2 = ::capnp::AnyPointer, typename Owner2 = ::capnp::AnyPointer>
  typename Persistent<SturdyRef2, Owner2>::Client asGeneric() {
    return castAs<Persistent<SturdyRef2, Owner2>>();
  }

  CAPNP_AUTO_IF_MSVC(::capnp::Request<typename  ::capnp::Persistent<SturdyRef, Owner>::SaveParams, typename  ::capnp::Persistent<SturdyRef, Owner>::SaveResults>) saveRequest(
      ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr);

protected:
  Client() = default;
};

template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::Server
    : public virtual ::capnp::Capability::Server {
public:
  typedef Persistent Serves;

  ::capnp::Capability::Server::DispatchCallResult dispatchCall(
      uint64_t interfaceId, uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context)
      override;

protected:
  typedef ::capnp::CallContext<typename  ::capnp::Persistent<SturdyRef, Owner>::SaveParams, typename  ::capnp::Persistent<SturdyRef, Owner>::SaveResults> SaveContext;
  virtual ::kj::Promise<void> save(SaveContext context);

  inline typename  ::capnp::Persistent<SturdyRef, Owner>::Client thisCap() {
    return ::capnp::Capability::Server::thisCap()
        .template castAs< ::capnp::Persistent<SturdyRef, Owner>>();
  }

  ::capnp::Capability::Server::DispatchCallResult dispatchCallInternal(
      uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context);
};
#endif  // !CAPNP_LITE

template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::SaveParams::Reader {
public:
  typedef SaveParams Reads;

  Reader() = default;
  inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}

  inline ::capnp::MessageSize totalSize() const {
    return _reader.totalSize().asPublic();
  }

#if !CAPNP_LITE
  inline ::kj::StringTree toString() const {
    return ::capnp::_::structString(_reader, *_capnpPrivate::brand());
  }
#endif  // !CAPNP_LITE

  template <typename SturdyRef2 = ::capnp::AnyPointer, typename Owner2 = ::capnp::AnyPointer>
  typename Persistent<SturdyRef2, Owner2>::SaveParams::Reader asPersistentGeneric() {
    return typename Persistent<SturdyRef2, Owner2>::SaveParams::Reader(_reader);
  }

  inline bool hasSealFor() const;
  inline  ::capnp::ReaderFor<Owner> getSealFor() const;

private:
  ::capnp::_::StructReader _reader;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::List;
  friend class ::capnp::MessageBuilder;
  friend class ::capnp::Orphanage;
};

template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::SaveParams::Builder {
public:
  typedef SaveParams Builds;

  Builder() = delete;  // Deleted to discourage incorrect usage.
                       // You can explicitly initialize to nullptr instead.
  inline Builder(decltype(nullptr)) {}
  inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
  inline operator Reader() const { return Reader(_builder.asReader()); }
  inline Reader asReader() const { return *this; }

  inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); }
#if !CAPNP_LITE
  inline ::kj::StringTree toString() const { return asReader().toString(); }
#endif  // !CAPNP_LITE

  template <typename SturdyRef2 = ::capnp::AnyPointer, typename Owner2 = ::capnp::AnyPointer>
  typename Persistent<SturdyRef2, Owner2>::SaveParams::Builder asPersistentGeneric() {
    return typename Persistent<SturdyRef2, Owner2>::SaveParams::Builder(_builder);
  }

  inline bool hasSealFor();
  inline  ::capnp::BuilderFor<Owner> getSealFor();
  inline void setSealFor( ::capnp::ReaderFor<Owner> value);
  inline  ::capnp::BuilderFor<Owner> initSealFor();
  inline  ::capnp::BuilderFor<Owner> initSealFor(unsigned int size);
  inline void adoptSealFor(::capnp::Orphan<Owner>&& value);
  inline ::capnp::Orphan<Owner> disownSealFor();

private:
  ::capnp::_::StructBuilder _builder;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  friend class ::capnp::Orphanage;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
};

#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::SaveParams::Pipeline {
public:
  typedef SaveParams Pipelines;

  inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
  inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless)
      : _typeless(kj::mv(typeless)) {}

  inline  ::capnp::PipelineFor<Owner> getSealFor();
private:
  ::capnp::AnyPointer::Pipeline _typeless;
  friend class ::capnp::PipelineHook;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
};
#endif  // !CAPNP_LITE

template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::SaveResults::Reader {
public:
  typedef SaveResults Reads;

  Reader() = default;
  inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}

  inline ::capnp::MessageSize totalSize() const {
    return _reader.totalSize().asPublic();
  }

#if !CAPNP_LITE
  inline ::kj::StringTree toString() const {
    return ::capnp::_::structString(_reader, *_capnpPrivate::brand());
  }
#endif  // !CAPNP_LITE

  template <typename SturdyRef2 = ::capnp::AnyPointer, typename Owner2 = ::capnp::AnyPointer>
  typename Persistent<SturdyRef2, Owner2>::SaveResults::Reader asPersistentGeneric() {
    return typename Persistent<SturdyRef2, Owner2>::SaveResults::Reader(_reader);
  }

  inline bool hasSturdyRef() const;
  inline  ::capnp::ReaderFor<SturdyRef> getSturdyRef() const;

private:
  ::capnp::_::StructReader _reader;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::List;
  friend class ::capnp::MessageBuilder;
  friend class ::capnp::Orphanage;
};

template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::SaveResults::Builder {
public:
  typedef SaveResults Builds;

  Builder() = delete;  // Deleted to discourage incorrect usage.
                       // You can explicitly initialize to nullptr instead.
  inline Builder(decltype(nullptr)) {}
  inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
  inline operator Reader() const { return Reader(_builder.asReader()); }
  inline Reader asReader() const { return *this; }

  inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); }
#if !CAPNP_LITE
  inline ::kj::StringTree toString() const { return asReader().toString(); }
#endif  // !CAPNP_LITE

  template <typename SturdyRef2 = ::capnp::AnyPointer, typename Owner2 = ::capnp::AnyPointer>
  typename Persistent<SturdyRef2, Owner2>::SaveResults::Builder asPersistentGeneric() {
    return typename Persistent<SturdyRef2, Owner2>::SaveResults::Builder(_builder);
  }

  inline bool hasSturdyRef();
  inline  ::capnp::BuilderFor<SturdyRef> getSturdyRef();
  inline void setSturdyRef( ::capnp::ReaderFor<SturdyRef> value);
  inline  ::capnp::BuilderFor<SturdyRef> initSturdyRef();
  inline  ::capnp::BuilderFor<SturdyRef> initSturdyRef(unsigned int size);
  inline void adoptSturdyRef(::capnp::Orphan<SturdyRef>&& value);
  inline ::capnp::Orphan<SturdyRef> disownSturdyRef();

private:
  ::capnp::_::StructBuilder _builder;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  friend class ::capnp::Orphanage;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
};

#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
class Persistent<SturdyRef, Owner>::SaveResults::Pipeline {
public:
  typedef SaveResults Pipelines;

  inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
  inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless)
      : _typeless(kj::mv(typeless)) {}

  inline  ::capnp::PipelineFor<SturdyRef> getSturdyRef();
private:
  ::capnp::AnyPointer::Pipeline _typeless;
  friend class ::capnp::PipelineHook;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
};
#endif  // !CAPNP_LITE

#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client
    : public virtual ::capnp::Capability::Client {
public:
  typedef RealmGateway Calls;
  typedef RealmGateway Reads;

  Client(decltype(nullptr));
  explicit Client(::kj::Own< ::capnp::ClientHook>&& hook);
  template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Server*>()>>
  Client(::kj::Own<_t>&& server);
  template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Client*>()>>
  Client(::kj::Promise<_t>&& promise);
  Client(::kj::Exception&& exception);
  Client(Client&) = default;
  Client(Client&&) = default;
  Client& operator=(Client& other);
  Client& operator=(Client&& other);

  template <typename InternalRef2 = ::capnp::AnyPointer, typename ExternalRef2 = ::capnp::AnyPointer, typename InternalOwner2 = ::capnp::AnyPointer, typename ExternalOwner2 = ::capnp::AnyPointer>
  typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::Client asGeneric() {
    return castAs<RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>>();
  }

  CAPNP_AUTO_IF_MSVC(::capnp::Request<typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams, typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveResults>) importRequest(
      ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr);
  CAPNP_AUTO_IF_MSVC(::capnp::Request<typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams, typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveResults>) exportRequest(
      ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr);

protected:
  Client() = default;
};

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Server
    : public virtual ::capnp::Capability::Server {
public:
  typedef RealmGateway Serves;

  ::capnp::Capability::Server::DispatchCallResult dispatchCall(
      uint64_t interfaceId, uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context)
      override;

protected:
  typedef typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams ImportParams;
  typedef ::capnp::CallContext<ImportParams, typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveResults> ImportContext;
  virtual ::kj::Promise<void> import(ImportContext context);
  typedef typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams ExportParams;
  typedef ::capnp::CallContext<ExportParams, typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveResults> ExportContext;
  virtual ::kj::Promise<void> export_(ExportContext context);

  inline typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client thisCap() {
    return ::capnp::Capability::Server::thisCap()
        .template castAs< ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>>();
  }

  ::capnp::Capability::Server::DispatchCallResult dispatchCallInternal(
      uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context);
};
#endif  // !CAPNP_LITE

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Reader {
public:
  typedef ImportParams Reads;

  Reader() = default;
  inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}

  inline ::capnp::MessageSize totalSize() const {
    return _reader.totalSize().asPublic();
  }

#if !CAPNP_LITE
  inline ::kj::StringTree toString() const {
    return ::capnp::_::structString(_reader, *_capnpPrivate::brand());
  }
#endif  // !CAPNP_LITE

  template <typename InternalRef2 = ::capnp::AnyPointer, typename ExternalRef2 = ::capnp::AnyPointer, typename InternalOwner2 = ::capnp::AnyPointer, typename ExternalOwner2 = ::capnp::AnyPointer>
  typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ImportParams::Reader asRealmGatewayGeneric() {
    return typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ImportParams::Reader(_reader);
  }

  inline bool hasCap() const;
#if !CAPNP_LITE
  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client getCap() const;
#endif  // !CAPNP_LITE

  inline bool hasParams() const;
  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Reader getParams() const;

private:
  ::capnp::_::StructReader _reader;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::List;
  friend class ::capnp::MessageBuilder;
  friend class ::capnp::Orphanage;
};

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder {
public:
  typedef ImportParams Builds;

  Builder() = delete;  // Deleted to discourage incorrect usage.
                       // You can explicitly initialize to nullptr instead.
  inline Builder(decltype(nullptr)) {}
  inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
  inline operator Reader() const { return Reader(_builder.asReader()); }
  inline Reader asReader() const { return *this; }

  inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); }
#if !CAPNP_LITE
  inline ::kj::StringTree toString() const { return asReader().toString(); }
#endif  // !CAPNP_LITE

  template <typename InternalRef2 = ::capnp::AnyPointer, typename ExternalRef2 = ::capnp::AnyPointer, typename InternalOwner2 = ::capnp::AnyPointer, typename ExternalOwner2 = ::capnp::AnyPointer>
  typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ImportParams::Builder asRealmGatewayGeneric() {
    return typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ImportParams::Builder(_builder);
  }

  inline bool hasCap();
#if !CAPNP_LITE
  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client getCap();
  inline void setCap(typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client&& value);
  inline void setCap(typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client& value);
  inline void adoptCap(::capnp::Orphan< ::capnp::Persistent<ExternalRef, ExternalOwner>>&& value);
  inline ::capnp::Orphan< ::capnp::Persistent<ExternalRef, ExternalOwner>> disownCap();
#endif  // !CAPNP_LITE

  inline bool hasParams();
  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Builder getParams();
  inline void setParams(typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Reader value);
  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Builder initParams();
  inline void adoptParams(::capnp::Orphan<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>&& value);
  inline ::capnp::Orphan<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams> disownParams();

private:
  ::capnp::_::StructBuilder _builder;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  friend class ::capnp::Orphanage;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
};

#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Pipeline {
public:
  typedef ImportParams Pipelines;

  inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
  inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless)
      : _typeless(kj::mv(typeless)) {}

  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client getCap();
  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Pipeline getParams();
private:
  ::capnp::AnyPointer::Pipeline _typeless;
  friend class ::capnp::PipelineHook;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
};
#endif  // !CAPNP_LITE

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Reader {
public:
  typedef ExportParams Reads;

  Reader() = default;
  inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}

  inline ::capnp::MessageSize totalSize() const {
    return _reader.totalSize().asPublic();
  }

#if !CAPNP_LITE
  inline ::kj::StringTree toString() const {
    return ::capnp::_::structString(_reader, *_capnpPrivate::brand());
  }
#endif  // !CAPNP_LITE

  template <typename InternalRef2 = ::capnp::AnyPointer, typename ExternalRef2 = ::capnp::AnyPointer, typename InternalOwner2 = ::capnp::AnyPointer, typename ExternalOwner2 = ::capnp::AnyPointer>
  typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ExportParams::Reader asRealmGatewayGeneric() {
    return typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ExportParams::Reader(_reader);
  }

  inline bool hasCap() const;
#if !CAPNP_LITE
  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client getCap() const;
#endif  // !CAPNP_LITE

  inline bool hasParams() const;
  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Reader getParams() const;

private:
  ::capnp::_::StructReader _reader;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::List;
  friend class ::capnp::MessageBuilder;
  friend class ::capnp::Orphanage;
};

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder {
public:
  typedef ExportParams Builds;

  Builder() = delete;  // Deleted to discourage incorrect usage.
                       // You can explicitly initialize to nullptr instead.
  inline Builder(decltype(nullptr)) {}
  inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
  inline operator Reader() const { return Reader(_builder.asReader()); }
  inline Reader asReader() const { return *this; }

  inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); }
#if !CAPNP_LITE
  inline ::kj::StringTree toString() const { return asReader().toString(); }
#endif  // !CAPNP_LITE

  template <typename InternalRef2 = ::capnp::AnyPointer, typename ExternalRef2 = ::capnp::AnyPointer, typename InternalOwner2 = ::capnp::AnyPointer, typename ExternalOwner2 = ::capnp::AnyPointer>
  typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ExportParams::Builder asRealmGatewayGeneric() {
    return typename RealmGateway<InternalRef2, ExternalRef2, InternalOwner2, ExternalOwner2>::ExportParams::Builder(_builder);
  }

  inline bool hasCap();
#if !CAPNP_LITE
  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client getCap();
  inline void setCap(typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client&& value);
  inline void setCap(typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client& value);
  inline void adoptCap(::capnp::Orphan< ::capnp::Persistent<InternalRef, InternalOwner>>&& value);
  inline ::capnp::Orphan< ::capnp::Persistent<InternalRef, InternalOwner>> disownCap();
#endif  // !CAPNP_LITE

  inline bool hasParams();
  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Builder getParams();
  inline void setParams(typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Reader value);
  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Builder initParams();
  inline void adoptParams(::capnp::Orphan<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>&& value);
  inline ::capnp::Orphan<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams> disownParams();

private:
  ::capnp::_::StructBuilder _builder;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
  friend class ::capnp::Orphanage;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::_::PointerHelpers;
};

#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
class RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Pipeline {
public:
  typedef ExportParams Pipelines;

  inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
  inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless)
      : _typeless(kj::mv(typeless)) {}

  inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client getCap();
  inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Pipeline getParams();
private:
  ::capnp::AnyPointer::Pipeline _typeless;
  friend class ::capnp::PipelineHook;
  template <typename, ::capnp::Kind>
  friend struct ::capnp::ToDynamic_;
};
#endif  // !CAPNP_LITE

// =======================================================================================

#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
inline Persistent<SturdyRef, Owner>::Client::Client(decltype(nullptr))
    : ::capnp::Capability::Client(nullptr) {}
template <typename SturdyRef, typename Owner>
inline Persistent<SturdyRef, Owner>::Client::Client(
    ::kj::Own< ::capnp::ClientHook>&& hook)
    : ::capnp::Capability::Client(::kj::mv(hook)) {}
template <typename SturdyRef, typename Owner>
template <typename _t, typename>
inline Persistent<SturdyRef, Owner>::Client::Client(::kj::Own<_t>&& server)
    : ::capnp::Capability::Client(::kj::mv(server)) {}
template <typename SturdyRef, typename Owner>
template <typename _t, typename>
inline Persistent<SturdyRef, Owner>::Client::Client(::kj::Promise<_t>&& promise)
    : ::capnp::Capability::Client(::kj::mv(promise)) {}
template <typename SturdyRef, typename Owner>
inline Persistent<SturdyRef, Owner>::Client::Client(::kj::Exception&& exception)
    : ::capnp::Capability::Client(::kj::mv(exception)) {}
template <typename SturdyRef, typename Owner>
inline typename  ::capnp::Persistent<SturdyRef, Owner>::Client& Persistent<SturdyRef, Owner>::Client::operator=(Client& other) {
  ::capnp::Capability::Client::operator=(other);
  return *this;
}
template <typename SturdyRef, typename Owner>
inline typename  ::capnp::Persistent<SturdyRef, Owner>::Client& Persistent<SturdyRef, Owner>::Client::operator=(Client&& other) {
  ::capnp::Capability::Client::operator=(kj::mv(other));
  return *this;
}

#endif  // !CAPNP_LITE
template <typename SturdyRef, typename Owner>
inline bool Persistent<SturdyRef, Owner>::SaveParams::Reader::hasSealFor() const {
  return !_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
template <typename SturdyRef, typename Owner>
inline bool Persistent<SturdyRef, Owner>::SaveParams::Builder::hasSealFor() {
  return !_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::ReaderFor<Owner> Persistent<SturdyRef, Owner>::SaveParams::Reader::getSealFor() const {
  return ::capnp::_::PointerHelpers<Owner>::get(_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::BuilderFor<Owner> Persistent<SturdyRef, Owner>::SaveParams::Builder::getSealFor() {
  return ::capnp::_::PointerHelpers<Owner>::get(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
inline  ::capnp::PipelineFor<Owner> Persistent<SturdyRef, Owner>::SaveParams::Pipeline::getSealFor() {
  return  ::capnp::PipelineFor<Owner>(_typeless.getPointerField(0));
}
#endif  // !CAPNP_LITE
template <typename SturdyRef, typename Owner>
inline void Persistent<SturdyRef, Owner>::SaveParams::Builder::setSealFor( ::capnp::ReaderFor<Owner> value) {
  ::capnp::_::PointerHelpers<Owner>::set(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), value);
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::BuilderFor<Owner> Persistent<SturdyRef, Owner>::SaveParams::Builder::initSealFor() {
  return ::capnp::_::PointerHelpers<Owner>::init(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::BuilderFor<Owner> Persistent<SturdyRef, Owner>::SaveParams::Builder::initSealFor(unsigned int size) {
  return ::capnp::_::PointerHelpers<Owner>::init(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), size);
}
template <typename SturdyRef, typename Owner>
inline void Persistent<SturdyRef, Owner>::SaveParams::Builder::adoptSealFor(
    ::capnp::Orphan<Owner>&& value) {
  ::capnp::_::PointerHelpers<Owner>::adopt(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value));
}
template <typename SturdyRef, typename Owner>
inline ::capnp::Orphan<Owner> Persistent<SturdyRef, Owner>::SaveParams::Builder::disownSealFor() {
  return ::capnp::_::PointerHelpers<Owner>::disown(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}

// Persistent<SturdyRef, Owner>::SaveParams
template <typename SturdyRef, typename Owner>
constexpr uint16_t Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::dataWordSize;
template <typename SturdyRef, typename Owner>
constexpr uint16_t Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::pointerCount;
#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
constexpr ::capnp::Kind Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::kind;
template <typename SturdyRef, typename Owner>
constexpr ::capnp::_::RawSchema const* Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::schema;
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Scope Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::brandScopes[] = {
  { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false},
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Binding Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::brandBindings[] = {
  ::capnp::_::brandBindingFor<SturdyRef>(),
  ::capnp::_::brandBindingFor<Owner>(),
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::specificBrand = {
  &::capnp::schemas::s_f76fba59183073a5, brandScopes, nullptr,
  1, 0, nullptr
};
#endif  // !CAPNP_LITE

template <typename SturdyRef, typename Owner>
inline bool Persistent<SturdyRef, Owner>::SaveResults::Reader::hasSturdyRef() const {
  return !_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
template <typename SturdyRef, typename Owner>
inline bool Persistent<SturdyRef, Owner>::SaveResults::Builder::hasSturdyRef() {
  return !_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::ReaderFor<SturdyRef> Persistent<SturdyRef, Owner>::SaveResults::Reader::getSturdyRef() const {
  return ::capnp::_::PointerHelpers<SturdyRef>::get(_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::BuilderFor<SturdyRef> Persistent<SturdyRef, Owner>::SaveResults::Builder::getSturdyRef() {
  return ::capnp::_::PointerHelpers<SturdyRef>::get(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
inline  ::capnp::PipelineFor<SturdyRef> Persistent<SturdyRef, Owner>::SaveResults::Pipeline::getSturdyRef() {
  return  ::capnp::PipelineFor<SturdyRef>(_typeless.getPointerField(0));
}
#endif  // !CAPNP_LITE
template <typename SturdyRef, typename Owner>
inline void Persistent<SturdyRef, Owner>::SaveResults::Builder::setSturdyRef( ::capnp::ReaderFor<SturdyRef> value) {
  ::capnp::_::PointerHelpers<SturdyRef>::set(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), value);
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::BuilderFor<SturdyRef> Persistent<SturdyRef, Owner>::SaveResults::Builder::initSturdyRef() {
  return ::capnp::_::PointerHelpers<SturdyRef>::init(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename SturdyRef, typename Owner>
inline  ::capnp::BuilderFor<SturdyRef> Persistent<SturdyRef, Owner>::SaveResults::Builder::initSturdyRef(unsigned int size) {
  return ::capnp::_::PointerHelpers<SturdyRef>::init(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), size);
}
template <typename SturdyRef, typename Owner>
inline void Persistent<SturdyRef, Owner>::SaveResults::Builder::adoptSturdyRef(
    ::capnp::Orphan<SturdyRef>&& value) {
  ::capnp::_::PointerHelpers<SturdyRef>::adopt(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value));
}
template <typename SturdyRef, typename Owner>
inline ::capnp::Orphan<SturdyRef> Persistent<SturdyRef, Owner>::SaveResults::Builder::disownSturdyRef() {
  return ::capnp::_::PointerHelpers<SturdyRef>::disown(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}

// Persistent<SturdyRef, Owner>::SaveResults
template <typename SturdyRef, typename Owner>
constexpr uint16_t Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::dataWordSize;
template <typename SturdyRef, typename Owner>
constexpr uint16_t Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::pointerCount;
#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
constexpr ::capnp::Kind Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::kind;
template <typename SturdyRef, typename Owner>
constexpr ::capnp::_::RawSchema const* Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::schema;
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Scope Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::brandScopes[] = {
  { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false},
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Binding Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::brandBindings[] = {
  ::capnp::_::brandBindingFor<SturdyRef>(),
  ::capnp::_::brandBindingFor<Owner>(),
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::specificBrand = {
  &::capnp::schemas::s_b76848c18c40efbf, brandScopes, nullptr,
  1, 0, nullptr
};
#endif  // !CAPNP_LITE

#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
CAPNP_AUTO_IF_MSVC(::capnp::Request<typename  ::capnp::Persistent<SturdyRef, Owner>::SaveParams, typename  ::capnp::Persistent<SturdyRef, Owner>::SaveResults>)
Persistent<SturdyRef, Owner>::Client::saveRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
  return newCall<typename  ::capnp::Persistent<SturdyRef, Owner>::SaveParams, typename  ::capnp::Persistent<SturdyRef, Owner>::SaveResults>(
      0xc8cb212fcd9f5691ull, 0, sizeHint);
}
template <typename SturdyRef, typename Owner>
::kj::Promise<void> Persistent<SturdyRef, Owner>::Server::save(SaveContext) {
  return ::capnp::Capability::Server::internalUnimplemented(
      "capnp/persistent.capnp:Persistent", "save",
      0xc8cb212fcd9f5691ull, 0);
}
template <typename SturdyRef, typename Owner>
::capnp::Capability::Server::DispatchCallResult Persistent<SturdyRef, Owner>::Server::dispatchCall(
    uint64_t interfaceId, uint16_t methodId,
    ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
  switch (interfaceId) {
    case 0xc8cb212fcd9f5691ull:
      return dispatchCallInternal(methodId, context);
    default:
      return internalUnimplemented("capnp/persistent.capnp:Persistent", interfaceId);
  }
}
template <typename SturdyRef, typename Owner>
::capnp::Capability::Server::DispatchCallResult Persistent<SturdyRef, Owner>::Server::dispatchCallInternal(
    uint16_t methodId,
    ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
  switch (methodId) {
    case 0:
      return {
        save(::capnp::Capability::Server::internalGetTypedContext<
            typename  ::capnp::Persistent<SturdyRef, Owner>::SaveParams, typename  ::capnp::Persistent<SturdyRef, Owner>::SaveResults>(context)),
        false
      };
    default:
      (void)context;
      return ::capnp::Capability::Server::internalUnimplemented(
          "capnp/persistent.capnp:Persistent",
          0xc8cb212fcd9f5691ull, methodId);
  }
}
#endif  // !CAPNP_LITE

// Persistent<SturdyRef, Owner>
#if !CAPNP_LITE
template <typename SturdyRef, typename Owner>
constexpr ::capnp::Kind Persistent<SturdyRef, Owner>::_capnpPrivate::kind;
template <typename SturdyRef, typename Owner>
constexpr ::capnp::_::RawSchema const* Persistent<SturdyRef, Owner>::_capnpPrivate::schema;
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Scope Persistent<SturdyRef, Owner>::_capnpPrivate::brandScopes[] = {
  { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false},
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Binding Persistent<SturdyRef, Owner>::_capnpPrivate::brandBindings[] = {
  ::capnp::_::brandBindingFor<SturdyRef>(),
  ::capnp::_::brandBindingFor<Owner>(),
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema::Dependency Persistent<SturdyRef, Owner>::_capnpPrivate::brandDependencies[] = {
  { 33554432,  ::capnp::Persistent<SturdyRef, Owner>::SaveParams::_capnpPrivate::brand() },
  { 50331648,  ::capnp::Persistent<SturdyRef, Owner>::SaveResults::_capnpPrivate::brand() },
};
template <typename SturdyRef, typename Owner>
const ::capnp::_::RawBrandedSchema Persistent<SturdyRef, Owner>::_capnpPrivate::specificBrand = {
  &::capnp::schemas::s_c8cb212fcd9f5691, brandScopes, brandDependencies,
  1, 2, nullptr
};
#endif  // !CAPNP_LITE

#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::Client(decltype(nullptr))
    : ::capnp::Capability::Client(nullptr) {}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::Client(
    ::kj::Own< ::capnp::ClientHook>&& hook)
    : ::capnp::Capability::Client(::kj::mv(hook)) {}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
template <typename _t, typename>
inline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::Client(::kj::Own<_t>&& server)
    : ::capnp::Capability::Client(::kj::mv(server)) {}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
template <typename _t, typename>
inline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::Client(::kj::Promise<_t>&& promise)
    : ::capnp::Capability::Client(::kj::mv(promise)) {}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::Client(::kj::Exception&& exception)
    : ::capnp::Capability::Client(::kj::mv(exception)) {}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client& RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::operator=(Client& other) {
  ::capnp::Capability::Client::operator=(other);
  return *this;
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client& RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::operator=(Client&& other) {
  ::capnp::Capability::Client::operator=(kj::mv(other));
  return *this;
}

#endif  // !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Reader::hasCap() const {
  return !_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::hasCap() {
  return !_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Reader::getCap() const {
  return ::capnp::_::PointerHelpers< ::capnp::Persistent<ExternalRef, ExternalOwner>>::get(_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::getCap() {
  return ::capnp::_::PointerHelpers< ::capnp::Persistent<ExternalRef, ExternalOwner>>::get(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Pipeline::getCap() {
  return typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client(_typeless.getPointerField(0).asCap());
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::setCap(typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client&& cap) {
  ::capnp::_::PointerHelpers< ::capnp::Persistent<ExternalRef, ExternalOwner>>::set(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::setCap(typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::Client& cap) {
  ::capnp::_::PointerHelpers< ::capnp::Persistent<ExternalRef, ExternalOwner>>::set(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), cap);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::adoptCap(
    ::capnp::Orphan< ::capnp::Persistent<ExternalRef, ExternalOwner>>&& value) {
  ::capnp::_::PointerHelpers< ::capnp::Persistent<ExternalRef, ExternalOwner>>::adopt(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline ::capnp::Orphan< ::capnp::Persistent<ExternalRef, ExternalOwner>> RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::disownCap() {
  return ::capnp::_::PointerHelpers< ::capnp::Persistent<ExternalRef, ExternalOwner>>::disown(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
#endif  // !CAPNP_LITE

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Reader::hasParams() const {
  return !_reader.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS).isNull();
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::hasParams() {
  return !_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS).isNull();
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Reader RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Reader::getParams() const {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>::get(_reader.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Builder RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::getParams() {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>::get(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Pipeline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Pipeline::getParams() {
  return typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Pipeline(_typeless.getPointerField(1));
}
#endif  // !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::setParams(typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Reader value) {
  ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>::set(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS), value);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::Builder RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::initParams() {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>::init(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::adoptParams(
    ::capnp::Orphan<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>&& value) {
  ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>::adopt(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline ::capnp::Orphan<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams> RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::Builder::disownParams() {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams>::disown(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}

// RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr uint16_t RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::dataWordSize;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr uint16_t RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::pointerCount;
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr ::capnp::Kind RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::kind;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr ::capnp::_::RawSchema const* RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::schema;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Scope RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::brandScopes[] = {
  { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false},
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Binding RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::brandBindings[] = {
  ::capnp::_::brandBindingFor<InternalRef>(),
  ::capnp::_::brandBindingFor<ExternalRef>(),
  ::capnp::_::brandBindingFor<InternalOwner>(),
  ::capnp::_::brandBindingFor<ExternalOwner>(),
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Dependency RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::brandDependencies[] = {
  { 16777216,  ::capnp::Persistent<ExternalRef, ExternalOwner>::_capnpPrivate::brand() },
  { 16777217,  ::capnp::Persistent<InternalRef, InternalOwner>::SaveParams::_capnpPrivate::brand() },
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::specificBrand = {
  &::capnp::schemas::s_f0c2cc1d3909574d, brandScopes, brandDependencies,
  1, 2, nullptr
};
#endif  // !CAPNP_LITE

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Reader::hasCap() const {
  return !_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::hasCap() {
  return !_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Reader::getCap() const {
  return ::capnp::_::PointerHelpers< ::capnp::Persistent<InternalRef, InternalOwner>>::get(_reader.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::getCap() {
  return ::capnp::_::PointerHelpers< ::capnp::Persistent<InternalRef, InternalOwner>>::get(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Pipeline::getCap() {
  return typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client(_typeless.getPointerField(0).asCap());
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::setCap(typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client&& cap) {
  ::capnp::_::PointerHelpers< ::capnp::Persistent<InternalRef, InternalOwner>>::set(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::setCap(typename  ::capnp::Persistent<InternalRef, InternalOwner>::Client& cap) {
  ::capnp::_::PointerHelpers< ::capnp::Persistent<InternalRef, InternalOwner>>::set(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), cap);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::adoptCap(
    ::capnp::Orphan< ::capnp::Persistent<InternalRef, InternalOwner>>&& value) {
  ::capnp::_::PointerHelpers< ::capnp::Persistent<InternalRef, InternalOwner>>::adopt(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline ::capnp::Orphan< ::capnp::Persistent<InternalRef, InternalOwner>> RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::disownCap() {
  return ::capnp::_::PointerHelpers< ::capnp::Persistent<InternalRef, InternalOwner>>::disown(_builder.getPointerField(
      ::capnp::bounded<0>() * ::capnp::POINTERS));
}
#endif  // !CAPNP_LITE

template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Reader::hasParams() const {
  return !_reader.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS).isNull();
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline bool RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::hasParams() {
  return !_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS).isNull();
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Reader RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Reader::getParams() const {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>::get(_reader.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Builder RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::getParams() {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>::get(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Pipeline RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Pipeline::getParams() {
  return typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Pipeline(_typeless.getPointerField(1));
}
#endif  // !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::setParams(typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Reader value) {
  ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>::set(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS), value);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::Builder RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::initParams() {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>::init(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline void RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::adoptParams(
    ::capnp::Orphan<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>&& value) {
  ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>::adopt(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value));
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
inline ::capnp::Orphan<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams> RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::Builder::disownParams() {
  return ::capnp::_::PointerHelpers<typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams>::disown(_builder.getPointerField(
      ::capnp::bounded<1>() * ::capnp::POINTERS));
}

// RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr uint16_t RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::dataWordSize;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr uint16_t RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::pointerCount;
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr ::capnp::Kind RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::kind;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr ::capnp::_::RawSchema const* RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::schema;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Scope RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::brandScopes[] = {
  { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false},
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Binding RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::brandBindings[] = {
  ::capnp::_::brandBindingFor<InternalRef>(),
  ::capnp::_::brandBindingFor<ExternalRef>(),
  ::capnp::_::brandBindingFor<InternalOwner>(),
  ::capnp::_::brandBindingFor<ExternalOwner>(),
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Dependency RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::brandDependencies[] = {
  { 16777216,  ::capnp::Persistent<InternalRef, InternalOwner>::_capnpPrivate::brand() },
  { 16777217,  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveParams::_capnpPrivate::brand() },
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::specificBrand = {
  &::capnp::schemas::s_ecafa18b482da3aa, brandScopes, brandDependencies,
  1, 2, nullptr
};
#endif  // !CAPNP_LITE

#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
CAPNP_AUTO_IF_MSVC(::capnp::Request<typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams, typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveResults>)
RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::importRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
  return newCall<typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams, typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveResults>(
      0x84ff286cd00a3ed4ull, 0, sizeHint);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
::kj::Promise<void> RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Server::import(ImportContext) {
  return ::capnp::Capability::Server::internalUnimplemented(
      "capnp/persistent.capnp:RealmGateway", "import",
      0x84ff286cd00a3ed4ull, 0);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
CAPNP_AUTO_IF_MSVC(::capnp::Request<typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams, typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveResults>)
RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Client::exportRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
  return newCall<typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams, typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveResults>(
      0x84ff286cd00a3ed4ull, 1, sizeHint);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
::kj::Promise<void> RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Server::export_(ExportContext) {
  return ::capnp::Capability::Server::internalUnimplemented(
      "capnp/persistent.capnp:RealmGateway", "export",
      0x84ff286cd00a3ed4ull, 1);
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
::capnp::Capability::Server::DispatchCallResult RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Server::dispatchCall(
    uint64_t interfaceId, uint16_t methodId,
    ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
  switch (interfaceId) {
    case 0x84ff286cd00a3ed4ull:
      return dispatchCallInternal(methodId, context);
    default:
      return internalUnimplemented("capnp/persistent.capnp:RealmGateway", interfaceId);
  }
}
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
::capnp::Capability::Server::DispatchCallResult RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::Server::dispatchCallInternal(
    uint16_t methodId,
    ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
  switch (methodId) {
    case 0:
      return {
        import(::capnp::Capability::Server::internalGetTypedContext<
            typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams, typename  ::capnp::Persistent<InternalRef, InternalOwner>::SaveResults>(context)),
        false
      };
    case 1:
      return {
        export_(::capnp::Capability::Server::internalGetTypedContext<
            typename  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams, typename  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveResults>(context)),
        false
      };
    default:
      (void)context;
      return ::capnp::Capability::Server::internalUnimplemented(
          "capnp/persistent.capnp:RealmGateway",
          0x84ff286cd00a3ed4ull, methodId);
  }
}
#endif  // !CAPNP_LITE

// RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>
#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr ::capnp::Kind RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::_capnpPrivate::kind;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
constexpr ::capnp::_::RawSchema const* RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::_capnpPrivate::schema;
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Scope RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::_capnpPrivate::brandScopes[] = {
  { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false},
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Binding RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::_capnpPrivate::brandBindings[] = {
  ::capnp::_::brandBindingFor<InternalRef>(),
  ::capnp::_::brandBindingFor<ExternalRef>(),
  ::capnp::_::brandBindingFor<InternalOwner>(),
  ::capnp::_::brandBindingFor<ExternalOwner>(),
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema::Dependency RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::_capnpPrivate::brandDependencies[] = {
  { 33554432,  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ImportParams::_capnpPrivate::brand() },
  { 33554433,  ::capnp::RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::ExportParams::_capnpPrivate::brand() },
  { 50331648,  ::capnp::Persistent<InternalRef, InternalOwner>::SaveResults::_capnpPrivate::brand() },
  { 50331649,  ::capnp::Persistent<ExternalRef, ExternalOwner>::SaveResults::_capnpPrivate::brand() },
};
template <typename InternalRef, typename ExternalRef, typename InternalOwner, typename ExternalOwner>
const ::capnp::_::RawBrandedSchema RealmGateway<InternalRef, ExternalRef, InternalOwner, ExternalOwner>::_capnpPrivate::specificBrand = {
  &::capnp::schemas::s_84ff286cd00a3ed4, brandScopes, brandDependencies,
  1, 4, nullptr
};
#endif  // !CAPNP_LITE

}  // namespace

