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

#ifndef CAPNP_INCLUDED_b8630836983feed7_
#define CAPNP_INCLUDED_b8630836983feed7_

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

#if CAPNP_VERSION != 5003
#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);

}  // namespace schemas
}  // namespace capnp

namespace capnp {

template <typename SturdyRef = ::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 = ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef>::brand;
  };
  #endif  // !CAPNP_LITE
};

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

  class Reader;
  class Builder;
  class Pipeline;

  struct _capnpPrivate {
    CAPNP_DECLARE_STRUCT_HEADER(f76fba59183073a5, 0, 0)
    #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 = ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef>::brand;
    #endif  // !CAPNP_LITE
  };
};

template <typename SturdyRef>
struct Persistent<SturdyRef>::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 = ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef>::brand;
    #endif  // !CAPNP_LITE
  };
};

template <typename InternalRef = ::capnp::AnyPointer, typename ExternalRef = ::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 = ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef>::brand;
  };
  #endif  // !CAPNP_LITE
};

template <typename InternalRef, typename ExternalRef>
struct RealmGateway<InternalRef, ExternalRef>::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 = ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef>::brand;
    #endif  // !CAPNP_LITE
  };
};

template <typename InternalRef, typename ExternalRef>
struct RealmGateway<InternalRef, ExternalRef>::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 = ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef>::brand;
    #endif  // !CAPNP_LITE
  };
};

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

#if !CAPNP_LITE
template <typename SturdyRef>
class Persistent<SturdyRef>::Client
    : public virtual ::capnp::Capability::Client {
public:
  typedef Persistent<SturdyRef> Calls;
  typedef Persistent<SturdyRef> 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);

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

protected:
  Client() = default;
};

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

  ::kj::Promise<void> dispatchCall(uint64_t interfaceId, uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context)
      override;

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

  ::kj::Promise<void> dispatchCallInternal(uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context);
};
#endif  // !CAPNP_LITE

template <typename SturdyRef>
class Persistent<SturdyRef>::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

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>
class Persistent<SturdyRef>::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

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>
class Persistent<SturdyRef>::SaveParams::Pipeline {
public:
  typedef SaveParams Pipelines;

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

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

template <typename SturdyRef>
class Persistent<SturdyRef>::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

  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>
class Persistent<SturdyRef>::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

  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>
class Persistent<SturdyRef>::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>
class RealmGateway<InternalRef, ExternalRef>::Client
    : public virtual ::capnp::Capability::Client {
public:
  typedef RealmGateway<InternalRef, ExternalRef> Calls;
  typedef RealmGateway<InternalRef, ExternalRef> 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);

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

protected:
  Client() = default;
};

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

  ::kj::Promise<void> dispatchCall(uint64_t interfaceId, uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context)
      override;

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

  ::kj::Promise<void> dispatchCallInternal(uint16_t methodId,
      ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context);
};
#endif  // !CAPNP_LITE

template <typename InternalRef, typename ExternalRef>
class RealmGateway<InternalRef, ExternalRef>::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

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

  inline bool hasParams() const;
  inline typename  ::capnp::Persistent<InternalRef>::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>
class RealmGateway<InternalRef, ExternalRef>::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

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

  inline bool hasParams();
  inline typename  ::capnp::Persistent<InternalRef>::SaveParams::Builder getParams();
  inline void setParams(typename  ::capnp::Persistent<InternalRef>::SaveParams::Reader value);
  inline typename  ::capnp::Persistent<InternalRef>::SaveParams::Builder initParams();
  inline void adoptParams(::capnp::Orphan<typename  ::capnp::Persistent<InternalRef>::SaveParams>&& value);
  inline ::capnp::Orphan<typename  ::capnp::Persistent<InternalRef>::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>
class RealmGateway<InternalRef, ExternalRef>::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>::Client getCap();
  inline typename  ::capnp::Persistent<InternalRef>::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>
class RealmGateway<InternalRef, ExternalRef>::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

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

  inline bool hasParams() const;
  inline typename  ::capnp::Persistent<ExternalRef>::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>
class RealmGateway<InternalRef, ExternalRef>::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

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

  inline bool hasParams();
  inline typename  ::capnp::Persistent<ExternalRef>::SaveParams::Builder getParams();
  inline void setParams(typename  ::capnp::Persistent<ExternalRef>::SaveParams::Reader value);
  inline typename  ::capnp::Persistent<ExternalRef>::SaveParams::Builder initParams();
  inline void adoptParams(::capnp::Orphan<typename  ::capnp::Persistent<ExternalRef>::SaveParams>&& value);
  inline ::capnp::Orphan<typename  ::capnp::Persistent<ExternalRef>::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>
class RealmGateway<InternalRef, ExternalRef>::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>::Client getCap();
  inline typename  ::capnp::Persistent<ExternalRef>::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>
inline Persistent<SturdyRef>::Client::Client(decltype(nullptr))
    : ::capnp::Capability::Client(nullptr) {}
template <typename SturdyRef>
inline Persistent<SturdyRef>::Client::Client(
    ::kj::Own< ::capnp::ClientHook>&& hook)
    : ::capnp::Capability::Client(::kj::mv(hook)) {}
template <typename SturdyRef>
template <typename _t, typename>
inline Persistent<SturdyRef>::Client::Client(::kj::Own<_t>&& server)
    : ::capnp::Capability::Client(::kj::mv(server)) {}
template <typename SturdyRef>
template <typename _t, typename>
inline Persistent<SturdyRef>::Client::Client(::kj::Promise<_t>&& promise)
    : ::capnp::Capability::Client(::kj::mv(promise)) {}
template <typename SturdyRef>
inline Persistent<SturdyRef>::Client::Client(::kj::Exception&& exception)
    : ::capnp::Capability::Client(::kj::mv(exception)) {}
template <typename SturdyRef>
inline typename  ::capnp::Persistent<SturdyRef>::Client& Persistent<SturdyRef>::Client::operator=(Client& other) {
  ::capnp::Capability::Client::operator=(other);
  return *this;
}
template <typename SturdyRef>
inline typename  ::capnp::Persistent<SturdyRef>::Client& Persistent<SturdyRef>::Client::operator=(Client&& other) {
  ::capnp::Capability::Client::operator=(kj::mv(other));
  return *this;
}

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

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

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

#if !CAPNP_LITE
template <typename SturdyRef>
::capnp::Request<typename  ::capnp::Persistent<SturdyRef>::SaveParams, typename  ::capnp::Persistent<SturdyRef>::SaveResults>
Persistent<SturdyRef>::Client::saveRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
  return newCall<typename  ::capnp::Persistent<SturdyRef>::SaveParams, typename  ::capnp::Persistent<SturdyRef>::SaveResults>(
      0xc8cb212fcd9f5691ull, 0, sizeHint);
}
template <typename SturdyRef>
::kj::Promise<void> Persistent<SturdyRef>::Server::save(SaveContext) {
  return ::capnp::Capability::Server::internalUnimplemented(
      "capnp/persistent.capnp:Persistent", "save",
      0xc8cb212fcd9f5691ull, 0);
}
template <typename SturdyRef>
::kj::Promise<void> Persistent<SturdyRef>::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>
::kj::Promise<void> Persistent<SturdyRef>::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>::SaveParams, typename  ::capnp::Persistent<SturdyRef>::SaveResults>(context));
    default:
      (void)context;
      return ::capnp::Capability::Server::internalUnimplemented(
          "capnp/persistent.capnp:Persistent",
          0xc8cb212fcd9f5691ull, methodId);
  }
}
#endif  // !CAPNP_LITE

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

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

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

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

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

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

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

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

#if !CAPNP_LITE
template <typename InternalRef, typename ExternalRef>
::capnp::Request<typename  ::capnp::RealmGateway<InternalRef, ExternalRef>::ImportParams, typename  ::capnp::Persistent<InternalRef>::SaveResults>
RealmGateway<InternalRef, ExternalRef>::Client::importRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
  return newCall<typename  ::capnp::RealmGateway<InternalRef, ExternalRef>::ImportParams, typename  ::capnp::Persistent<InternalRef>::SaveResults>(
      0x84ff286cd00a3ed4ull, 0, sizeHint);
}
template <typename InternalRef, typename ExternalRef>
::kj::Promise<void> RealmGateway<InternalRef, ExternalRef>::Server::import(ImportContext) {
  return ::capnp::Capability::Server::internalUnimplemented(
      "capnp/persistent.capnp:RealmGateway", "import",
      0x84ff286cd00a3ed4ull, 0);
}
template <typename InternalRef, typename ExternalRef>
::capnp::Request<typename  ::capnp::RealmGateway<InternalRef, ExternalRef>::ExportParams, typename  ::capnp::Persistent<ExternalRef>::SaveResults>
RealmGateway<InternalRef, ExternalRef>::Client::exportRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
  return newCall<typename  ::capnp::RealmGateway<InternalRef, ExternalRef>::ExportParams, typename  ::capnp::Persistent<ExternalRef>::SaveResults>(
      0x84ff286cd00a3ed4ull, 1, sizeHint);
}
template <typename InternalRef, typename ExternalRef>
::kj::Promise<void> RealmGateway<InternalRef, ExternalRef>::Server::export_(ExportContext) {
  return ::capnp::Capability::Server::internalUnimplemented(
      "capnp/persistent.capnp:RealmGateway", "export",
      0x84ff286cd00a3ed4ull, 1);
}
template <typename InternalRef, typename ExternalRef>
::kj::Promise<void> RealmGateway<InternalRef, ExternalRef>::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>
::kj::Promise<void> RealmGateway<InternalRef, ExternalRef>::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>::ImportParams, typename  ::capnp::Persistent<InternalRef>::SaveResults>(context));
    case 1:
      return export_(::capnp::Capability::Server::internalGetTypedContext<
          typename  ::capnp::RealmGateway<InternalRef, ExternalRef>::ExportParams, typename  ::capnp::Persistent<ExternalRef>::SaveResults>(context));
    default:
      (void)context;
      return ::capnp::Capability::Server::internalUnimplemented(
          "capnp/persistent.capnp:RealmGateway",
          0x84ff286cd00a3ed4ull, methodId);
  }
}
#endif  // !CAPNP_LITE

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

}  // namespace

#endif  // CAPNP_INCLUDED_b8630836983feed7_
