blob: 65e438f7ef59f4cf671d8c1b57840db1e039237b [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = output_index_json
#pragma once
#include <fidl/test.nullable/cpp/common_types.h>
#include <fidl/test.nullable/cpp/markers.h>
#include <lib/fidl/cpp/natural_coding_traits.h>
#include <lib/fidl/cpp/natural_types.h>
#include <cinttypes>
#include <string>
#ifdef __Fuchsia__
#include <lib/zx/channel.h>
#include <lib/zx/vmo.h>
#endif // __Fuchsia__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
namespace test_nullable {
class StructWithNullableString;
class StructWithNullableVector;
class StructWithNullableHandle;
class SimpleProtocolAddRequest;
class SimpleProtocolAddResponse;
class StructWithNullableProtocol;
class StructWithNullableRequest;
class Int32Wrapper;
class StructWithNullableStruct;
class StructWithNullableUnion;
class SimpleUnion;
class StructWithNullableString {
private:
struct Storage_;
public:
StructWithNullableString(Storage_ storage) noexcept;
StructWithNullableString(::std::optional<::std::string> val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableString| only if all of its members are default constructible.
StructWithNullableString() = default;
#pragma clang diagnostic pop
StructWithNullableString(StructWithNullableString&&) noexcept = default;
StructWithNullableString& operator=(StructWithNullableString&&) noexcept = default;
StructWithNullableString(const StructWithNullableString& other) noexcept;
StructWithNullableString& operator=(const StructWithNullableString& other) noexcept;
bool operator==(const StructWithNullableString& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableString, 16>::Equal(this, &other);
}
bool operator!=(const StructWithNullableString& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableString, 16>::Equal(this, &other);
}
const ::std::optional<::std::string>&
val() const {
return storage_.val;
}
::std::optional<::std::string>& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableString& val(::std::optional<::std::string> value);
StructWithNullableString(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::std::optional<::std::string> val;
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableString, 16>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableString>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::std::optional<::std::string>, fidl::internal::NaturalCodingConstraintString<>>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
class StructWithNullableVector {
private:
struct Storage_;
public:
StructWithNullableVector(Storage_ storage) noexcept;
StructWithNullableVector(::std::optional<::std::vector<int32_t>> val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableVector| only if all of its members are default constructible.
StructWithNullableVector() = default;
#pragma clang diagnostic pop
StructWithNullableVector(StructWithNullableVector&&) noexcept = default;
StructWithNullableVector& operator=(StructWithNullableVector&&) noexcept = default;
StructWithNullableVector(const StructWithNullableVector& other) noexcept;
StructWithNullableVector& operator=(const StructWithNullableVector& other) noexcept;
bool operator==(const StructWithNullableVector& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableVector, 16>::Equal(this, &other);
}
bool operator!=(const StructWithNullableVector& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableVector, 16>::Equal(this, &other);
}
const ::std::optional<::std::vector<int32_t>>&
val() const {
return storage_.val;
}
::std::optional<::std::vector<int32_t>>& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableVector& val(::std::optional<::std::vector<int32_t>> value);
StructWithNullableVector(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::std::optional<::std::vector<int32_t>> val;
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableVector, 16>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableVector>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::std::optional<::std::vector<int32_t>>, fidl::internal::NaturalCodingConstraintVector<fidl::internal::NaturalCodingConstraintEmpty>>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
#ifdef __Fuchsia__
class StructWithNullableHandle {
private:
struct Storage_;
public:
StructWithNullableHandle(Storage_ storage) noexcept;
StructWithNullableHandle(::zx::vmo val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableHandle| only if all of its members are default constructible.
StructWithNullableHandle() = default;
#pragma clang diagnostic pop
StructWithNullableHandle(StructWithNullableHandle&&) noexcept = default;
StructWithNullableHandle& operator=(StructWithNullableHandle&&) noexcept = default;
const ::zx::vmo&
val() const {
return storage_.val;
}
::zx::vmo& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableHandle& val(::zx::vmo value);
StructWithNullableHandle(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::zx::vmo val;
};
Storage_ storage_;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableHandle, 4>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableHandle>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::zx::vmo, fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, true>>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
#endif // __Fuchsia__
class SimpleProtocolAddRequest {
private:
struct Storage_;
public:
SimpleProtocolAddRequest(Storage_ storage) noexcept;
SimpleProtocolAddRequest(int32_t a, int32_t b) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |SimpleProtocolAddRequest| only if all of its members are default constructible.
SimpleProtocolAddRequest() = default;
#pragma clang diagnostic pop
SimpleProtocolAddRequest(SimpleProtocolAddRequest&&) noexcept = default;
SimpleProtocolAddRequest& operator=(SimpleProtocolAddRequest&&) noexcept = default;
SimpleProtocolAddRequest(const SimpleProtocolAddRequest& other) noexcept;
SimpleProtocolAddRequest& operator=(const SimpleProtocolAddRequest& other) noexcept;
bool operator==(const SimpleProtocolAddRequest& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddRequest, 8>::Equal(this, &other);
}
bool operator!=(const SimpleProtocolAddRequest& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddRequest, 8>::Equal(this, &other);
}
int32_t
a() const {
return storage_.a;
}
int32_t& a() {
return storage_.a;
}
// Setter for a.
//
SimpleProtocolAddRequest& a(int32_t value);
int32_t
b() const {
return storage_.b;
}
int32_t& b() {
return storage_.b;
}
// Setter for b.
//
SimpleProtocolAddRequest& b(int32_t value);
SimpleProtocolAddRequest(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
int32_t a = {};
int32_t b = {};
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddRequest, 8>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::SimpleProtocolAddRequest>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, int32_t, fidl::internal::NaturalCodingConstraintEmpty>{
&Storage_::a, 0},
::fidl::internal::NaturalStructMember<Storage_, int32_t, fidl::internal::NaturalCodingConstraintEmpty>{&Storage_::b, 4});
static constexpr auto kPadding = std::make_tuple();
};
class SimpleProtocolAddResponse {
private:
struct Storage_;
public:
SimpleProtocolAddResponse(Storage_ storage) noexcept;
SimpleProtocolAddResponse(int32_t sum) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |SimpleProtocolAddResponse| only if all of its members are default constructible.
SimpleProtocolAddResponse() = default;
#pragma clang diagnostic pop
SimpleProtocolAddResponse(SimpleProtocolAddResponse&&) noexcept = default;
SimpleProtocolAddResponse& operator=(SimpleProtocolAddResponse&&) noexcept = default;
SimpleProtocolAddResponse(const SimpleProtocolAddResponse& other) noexcept;
SimpleProtocolAddResponse& operator=(const SimpleProtocolAddResponse& other) noexcept;
bool operator==(const SimpleProtocolAddResponse& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddResponse, 4>::Equal(this, &other);
}
bool operator!=(const SimpleProtocolAddResponse& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddResponse, 4>::Equal(this, &other);
}
int32_t
sum() const {
return storage_.sum;
}
int32_t& sum() {
return storage_.sum;
}
// Setter for sum.
//
SimpleProtocolAddResponse& sum(int32_t value);
SimpleProtocolAddResponse(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
int32_t sum = {};
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddResponse, 4>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::SimpleProtocolAddResponse>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, int32_t, fidl::internal::NaturalCodingConstraintEmpty>{
&Storage_::sum, 0});
static constexpr auto kPadding = std::make_tuple();
};
#ifdef __Fuchsia__
class StructWithNullableProtocol {
private:
struct Storage_;
public:
StructWithNullableProtocol(Storage_ storage) noexcept;
StructWithNullableProtocol(::fidl::ClientEnd<::test_nullable::SimpleProtocol> val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableProtocol| only if all of its members are default constructible.
StructWithNullableProtocol() = default;
#pragma clang diagnostic pop
StructWithNullableProtocol(StructWithNullableProtocol&&) noexcept = default;
StructWithNullableProtocol& operator=(StructWithNullableProtocol&&) noexcept = default;
const ::fidl::ClientEnd<::test_nullable::SimpleProtocol>&
val() const {
return storage_.val;
}
::fidl::ClientEnd<::test_nullable::SimpleProtocol>& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableProtocol& val(::fidl::ClientEnd<::test_nullable::SimpleProtocol> value);
StructWithNullableProtocol(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::fidl::ClientEnd<::test_nullable::SimpleProtocol> val;
};
Storage_ storage_;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableProtocol, 4>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableProtocol>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::fidl::ClientEnd<::test_nullable::SimpleProtocol>, fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_CHANNEL, ZX_DEFAULT_CHANNEL_RIGHTS, true>>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
class StructWithNullableRequest {
private:
struct Storage_;
public:
StructWithNullableRequest(Storage_ storage) noexcept;
StructWithNullableRequest(::fidl::ServerEnd<::test_nullable::SimpleProtocol> val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableRequest| only if all of its members are default constructible.
StructWithNullableRequest() = default;
#pragma clang diagnostic pop
StructWithNullableRequest(StructWithNullableRequest&&) noexcept = default;
StructWithNullableRequest& operator=(StructWithNullableRequest&&) noexcept = default;
const ::fidl::ServerEnd<::test_nullable::SimpleProtocol>&
val() const {
return storage_.val;
}
::fidl::ServerEnd<::test_nullable::SimpleProtocol>& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableRequest& val(::fidl::ServerEnd<::test_nullable::SimpleProtocol> value);
StructWithNullableRequest(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::fidl::ServerEnd<::test_nullable::SimpleProtocol> val;
};
Storage_ storage_;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableRequest, 4>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableRequest>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::fidl::ServerEnd<::test_nullable::SimpleProtocol>, fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_CHANNEL, ZX_DEFAULT_CHANNEL_RIGHTS, true>>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
#endif // __Fuchsia__
class Int32Wrapper {
private:
struct Storage_;
public:
Int32Wrapper(Storage_ storage) noexcept;
Int32Wrapper(int32_t val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |Int32Wrapper| only if all of its members are default constructible.
Int32Wrapper() = default;
#pragma clang diagnostic pop
Int32Wrapper(Int32Wrapper&&) noexcept = default;
Int32Wrapper& operator=(Int32Wrapper&&) noexcept = default;
Int32Wrapper(const Int32Wrapper& other) noexcept;
Int32Wrapper& operator=(const Int32Wrapper& other) noexcept;
bool operator==(const Int32Wrapper& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::Int32Wrapper, 4>::Equal(this, &other);
}
bool operator!=(const Int32Wrapper& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::Int32Wrapper, 4>::Equal(this, &other);
}
int32_t
val() const {
return storage_.val;
}
int32_t& val() {
return storage_.val;
}
// Setter for val.
//
Int32Wrapper& val(int32_t value);
Int32Wrapper(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
int32_t val = {};
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::Int32Wrapper, 4>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::Int32Wrapper>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, int32_t, fidl::internal::NaturalCodingConstraintEmpty>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
class StructWithNullableStruct {
private:
struct Storage_;
public:
StructWithNullableStruct(Storage_ storage) noexcept;
StructWithNullableStruct(::fidl::Box<::test_nullable::Int32Wrapper> val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableStruct| only if all of its members are default constructible.
StructWithNullableStruct() = default;
#pragma clang diagnostic pop
StructWithNullableStruct(StructWithNullableStruct&&) noexcept = default;
StructWithNullableStruct& operator=(StructWithNullableStruct&&) noexcept = default;
StructWithNullableStruct(const StructWithNullableStruct& other) noexcept;
StructWithNullableStruct& operator=(const StructWithNullableStruct& other) noexcept;
bool operator==(const StructWithNullableStruct& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableStruct, 8>::Equal(this, &other);
}
bool operator!=(const StructWithNullableStruct& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableStruct, 8>::Equal(this, &other);
}
const ::fidl::Box<::test_nullable::Int32Wrapper>&
val() const {
return storage_.val;
}
::fidl::Box<::test_nullable::Int32Wrapper>& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableStruct& val(::fidl::Box<::test_nullable::Int32Wrapper> value);
StructWithNullableStruct(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::fidl::Box<::test_nullable::Int32Wrapper> val;
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableStruct, 8>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableStruct>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::fidl::Box<::test_nullable::Int32Wrapper>, fidl::internal::NaturalCodingConstraintEmpty>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
class SimpleUnion {
private:
using Storage_ =
std::variant<
std::monostate, int32_t, float>;
public:
// TODO: share union tag types between wire & natural.
enum class Tag : fidl_xunion_tag_t {
kA = 1, // 0x1
kB = 2, // 0x2
};
SimpleUnion(SimpleUnion&& other) noexcept
: SimpleUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}) {
*storage_ = std::move(*other.storage_);
}
SimpleUnion& operator=(SimpleUnion&& other) noexcept {
if (this != &other) {
*storage_ = std::move(*other.storage_);
}
return *this;
}
SimpleUnion(const SimpleUnion& other) noexcept : SimpleUnion(other.CloneStorage_()) {}
SimpleUnion& operator=(const SimpleUnion& other) noexcept {
if (this != &other) {
storage_ = other.CloneStorage_();
}
return *this;
}
bool operator==(const SimpleUnion& other) const noexcept {
return *storage_ == *other.storage_;
}
bool operator!=(const SimpleUnion& other) const noexcept {
return *storage_ != *other.storage_;
}
constexpr ::test_nullable::SimpleUnion::Tag Which() const {
return SimpleUnion::IndexToTag(storage_->index()).value();
}
static SimpleUnion WithA(int32_t val) {
return SimpleUnion(std::make_shared<Storage_>(
std::in_place_index_t<1>{},
std::move(val)));
}
const ::fidl::internal::UnionMemberView<1, Storage_> a() const {
return ::fidl::internal::UnionMemberView<1, Storage_>(storage_);
}
::fidl::internal::UnionMemberView<1, Storage_> a() {
return ::fidl::internal::UnionMemberView<1, Storage_>(storage_);
}
// Sets the union to hold the a member.
//
SimpleUnion& a(int32_t value) {
storage_->emplace<1>(std::move(value));
return *this;
}
static SimpleUnion WithB(float val) {
return SimpleUnion(std::make_shared<Storage_>(
std::in_place_index_t<2>{},
std::move(val)));
}
const ::fidl::internal::UnionMemberView<2, Storage_> b() const {
return ::fidl::internal::UnionMemberView<2, Storage_>(storage_);
}
::fidl::internal::UnionMemberView<2, Storage_> b() {
return ::fidl::internal::UnionMemberView<2, Storage_>(storage_);
}
// Sets the union to hold the b member.
//
SimpleUnion& b(float value) {
storage_->emplace<2>(std::move(value));
return *this;
}
SimpleUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag)
: storage_(std::make_shared<Storage_>()) {}
private:
std::shared_ptr<Storage_> storage_;
std::shared_ptr<Storage_> CloneStorage_() const;
friend struct ::fidl::internal::NaturalUnionCodingTraits<::test_nullable::SimpleUnion>;
static constexpr auto kMembers = std::make_tuple(
::fidl::internal::NaturalUnionMember<::fidl::internal::NaturalCodingConstraintEmpty>(), ::fidl::internal::NaturalUnionMember<fidl::internal::NaturalCodingConstraintEmpty>(), ::fidl::internal::NaturalUnionMember<fidl::internal::NaturalCodingConstraintEmpty>());
explicit SimpleUnion(std::shared_ptr<Storage_> storage) : storage_(std::move(storage)) {}
static constexpr size_t TagToIndex(::fidl::internal::NaturalDecoder* decoder, ::test_nullable::SimpleUnion::Tag tag) {
switch (tag) {
case ::test_nullable::SimpleUnion::Tag::kA:
return 1;
case ::test_nullable::SimpleUnion::Tag::kB:
return 2;
default: {
decoder->SetError(::fidl::internal::kCodingErrorUnknownUnionTag);
return 0;
}
}
}
static constexpr std::optional<::test_nullable::SimpleUnion::Tag> IndexToTag(size_t index) {
switch (index) {
case 1:
return ::test_nullable::SimpleUnion::Tag::kA;
case 2:
return ::test_nullable::SimpleUnion::Tag::kB;
default:
return std::nullopt;
}
}
};
class StructWithNullableUnion {
private:
struct Storage_;
public:
StructWithNullableUnion(Storage_ storage) noexcept;
StructWithNullableUnion(::fidl::Box<::test_nullable::SimpleUnion> val) noexcept;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdefaulted-function-deleted"
// Default constructs a |StructWithNullableUnion| only if all of its members are default constructible.
StructWithNullableUnion() = default;
#pragma clang diagnostic pop
StructWithNullableUnion(StructWithNullableUnion&&) noexcept = default;
StructWithNullableUnion& operator=(StructWithNullableUnion&&) noexcept = default;
StructWithNullableUnion(const StructWithNullableUnion& other) noexcept;
StructWithNullableUnion& operator=(const StructWithNullableUnion& other) noexcept;
bool operator==(const StructWithNullableUnion& other) const noexcept {
return ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableUnion, 16>::Equal(this, &other);
}
bool operator!=(const StructWithNullableUnion& other) const noexcept {
return !::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableUnion, 16>::Equal(this, &other);
}
const ::fidl::Box<::test_nullable::SimpleUnion>&
val() const {
return storage_.val;
}
::fidl::Box<::test_nullable::SimpleUnion>& val() {
return storage_.val;
}
// Setter for val.
//
StructWithNullableUnion& val(::fidl::Box<::test_nullable::SimpleUnion> value);
StructWithNullableUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag);
private:
struct Storage_ final {
::fidl::Box<::test_nullable::SimpleUnion> val;
};
Storage_ storage_;
Storage_ CloneStorage_() const;
friend struct ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableUnion, 16>;
friend struct ::fidl::internal::MemberVisitor<::test_nullable::StructWithNullableUnion>;
static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::fidl::Box<::test_nullable::SimpleUnion>, fidl::internal::NaturalCodingConstraintEmpty>{
&Storage_::val, 0});
static constexpr auto kPadding = std::make_tuple();
};
inline StructWithNullableString::StructWithNullableString(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableString::StructWithNullableString(::std::optional<::std::string> val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableString::StructWithNullableString(const ::test_nullable::StructWithNullableString& other) noexcept : ::test_nullable::StructWithNullableString(other.CloneStorage_()) {}
inline StructWithNullableString& ::test_nullable::StructWithNullableString::operator=(const ::test_nullable::StructWithNullableString & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline StructWithNullableString::StructWithNullableString(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableString(Storage_{
.val = {},
}) {}
inline StructWithNullableString& StructWithNullableString::val(::std::optional<::std::string> value) {
storage_.val = std::move(value);
return *this;
}
inline StructWithNullableVector::StructWithNullableVector(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableVector::StructWithNullableVector(::std::optional<::std::vector<int32_t>> val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableVector::StructWithNullableVector(const ::test_nullable::StructWithNullableVector& other) noexcept : ::test_nullable::StructWithNullableVector(other.CloneStorage_()) {}
inline StructWithNullableVector& ::test_nullable::StructWithNullableVector::operator=(const ::test_nullable::StructWithNullableVector & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline StructWithNullableVector::StructWithNullableVector(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableVector(Storage_{
.val = {},
}) {}
inline StructWithNullableVector& StructWithNullableVector::val(::std::optional<::std::vector<int32_t>> value) {
storage_.val = std::move(value);
return *this;
}
#ifdef __Fuchsia__
inline StructWithNullableHandle::StructWithNullableHandle(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableHandle::StructWithNullableHandle(::zx::vmo val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableHandle::StructWithNullableHandle(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableHandle(Storage_{
.val = {},
}) {}
inline StructWithNullableHandle& StructWithNullableHandle::val(::zx::vmo value) {
storage_.val = std::move(value);
return *this;
}
#endif // __Fuchsia__
inline SimpleProtocolAddRequest::SimpleProtocolAddRequest(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline SimpleProtocolAddRequest::SimpleProtocolAddRequest(int32_t a, int32_t b) noexcept
: storage_({.a = std::move(a),
.b = std::move(b)}) {}
inline SimpleProtocolAddRequest::SimpleProtocolAddRequest(const ::test_nullable::SimpleProtocolAddRequest& other) noexcept : ::test_nullable::SimpleProtocolAddRequest(other.CloneStorage_()) {}
inline SimpleProtocolAddRequest& ::test_nullable::SimpleProtocolAddRequest::operator=(const ::test_nullable::SimpleProtocolAddRequest & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline SimpleProtocolAddRequest::SimpleProtocolAddRequest(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : SimpleProtocolAddRequest(Storage_{
.a = {},
.b = {},
}) {}
inline SimpleProtocolAddRequest& SimpleProtocolAddRequest::a(int32_t value) {
storage_.a = std::move(value);
return *this;
}
inline SimpleProtocolAddRequest& SimpleProtocolAddRequest::b(int32_t value) {
storage_.b = std::move(value);
return *this;
}
inline SimpleProtocolAddResponse::SimpleProtocolAddResponse(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline SimpleProtocolAddResponse::SimpleProtocolAddResponse(int32_t sum) noexcept
: storage_({.sum = std::move(sum)}) {}
inline SimpleProtocolAddResponse::SimpleProtocolAddResponse(const ::test_nullable::SimpleProtocolAddResponse& other) noexcept : ::test_nullable::SimpleProtocolAddResponse(other.CloneStorage_()) {}
inline SimpleProtocolAddResponse& ::test_nullable::SimpleProtocolAddResponse::operator=(const ::test_nullable::SimpleProtocolAddResponse & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline SimpleProtocolAddResponse::SimpleProtocolAddResponse(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : SimpleProtocolAddResponse(Storage_{
.sum = {},
}) {}
inline SimpleProtocolAddResponse& SimpleProtocolAddResponse::sum(int32_t value) {
storage_.sum = std::move(value);
return *this;
}
#ifdef __Fuchsia__
inline StructWithNullableProtocol::StructWithNullableProtocol(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableProtocol::StructWithNullableProtocol(::fidl::ClientEnd<::test_nullable::SimpleProtocol> val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableProtocol::StructWithNullableProtocol(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableProtocol(Storage_{
.val = {},
}) {}
inline StructWithNullableProtocol& StructWithNullableProtocol::val(::fidl::ClientEnd<::test_nullable::SimpleProtocol> value) {
storage_.val = std::move(value);
return *this;
}
#endif // __Fuchsia__
#ifdef __Fuchsia__
inline StructWithNullableRequest::StructWithNullableRequest(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableRequest::StructWithNullableRequest(::fidl::ServerEnd<::test_nullable::SimpleProtocol> val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableRequest::StructWithNullableRequest(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableRequest(Storage_{
.val = {},
}) {}
inline StructWithNullableRequest& StructWithNullableRequest::val(::fidl::ServerEnd<::test_nullable::SimpleProtocol> value) {
storage_.val = std::move(value);
return *this;
}
#endif // __Fuchsia__
inline Int32Wrapper::Int32Wrapper(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline Int32Wrapper::Int32Wrapper(int32_t val) noexcept
: storage_({.val = std::move(val)}) {}
inline Int32Wrapper::Int32Wrapper(const ::test_nullable::Int32Wrapper& other) noexcept : ::test_nullable::Int32Wrapper(other.CloneStorage_()) {}
inline Int32Wrapper& ::test_nullable::Int32Wrapper::operator=(const ::test_nullable::Int32Wrapper & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline Int32Wrapper::Int32Wrapper(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : Int32Wrapper(Storage_{
.val = {},
}) {}
inline Int32Wrapper& Int32Wrapper::val(int32_t value) {
storage_.val = std::move(value);
return *this;
}
inline StructWithNullableStruct::StructWithNullableStruct(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableStruct::StructWithNullableStruct(::fidl::Box<::test_nullable::Int32Wrapper> val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableStruct::StructWithNullableStruct(const ::test_nullable::StructWithNullableStruct& other) noexcept : ::test_nullable::StructWithNullableStruct(other.CloneStorage_()) {}
inline StructWithNullableStruct& ::test_nullable::StructWithNullableStruct::operator=(const ::test_nullable::StructWithNullableStruct & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline StructWithNullableStruct::StructWithNullableStruct(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableStruct(Storage_{
.val = {},
}) {}
inline StructWithNullableStruct& StructWithNullableStruct::val(::fidl::Box<::test_nullable::Int32Wrapper> value) {
storage_.val = std::move(value);
return *this;
}
inline StructWithNullableUnion::StructWithNullableUnion(Storage_ storage) noexcept : storage_(std::move(storage)) {}
inline StructWithNullableUnion::StructWithNullableUnion(::fidl::Box<::test_nullable::SimpleUnion> val) noexcept
: storage_({.val = std::move(val)}) {}
inline StructWithNullableUnion::StructWithNullableUnion(const ::test_nullable::StructWithNullableUnion& other) noexcept : ::test_nullable::StructWithNullableUnion(other.CloneStorage_()) {}
inline StructWithNullableUnion& ::test_nullable::StructWithNullableUnion::operator=(const ::test_nullable::StructWithNullableUnion & other) noexcept {
storage_ = other.CloneStorage_();
return *this;
}
inline StructWithNullableUnion::StructWithNullableUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : StructWithNullableUnion(Storage_{
.val = {},
}) {}
inline StructWithNullableUnion& StructWithNullableUnion::val(::fidl::Box<::test_nullable::SimpleUnion> value) {
storage_.val = std::move(value);
return *this;
}
} // namespace test_nullable
namespace fidl {
template <>
struct IsFidlType<::test_nullable::StructWithNullableString> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableString> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 1;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kMaxOutOfLine = 4294967295;
static constexpr bool kHasPointer = true;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableString> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableString, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableString, 16> {};
template <>
struct IsFidlType<::test_nullable::StructWithNullableVector> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableVector> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 1;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kMaxOutOfLine = 4294967295;
static constexpr bool kHasPointer = true;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableVector> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableVector, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableVector, 16> {};
#ifdef __Fuchsia__
template <>
struct IsResource<::test_nullable::StructWithNullableHandle> : public std::true_type {};
template <>
struct IsFidlType<::test_nullable::StructWithNullableHandle> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableHandle> {
static constexpr uint32_t kMaxNumHandles = 1;
static constexpr uint32_t kMaxDepth = 0;
static constexpr uint32_t kPrimarySize = 4;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableHandle> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableHandle, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableHandle, 4> {};
#endif // __Fuchsia__
template <>
struct IsFidlType<::test_nullable::SimpleProtocolAddRequest> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::SimpleProtocolAddRequest> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 0;
static constexpr uint32_t kPrimarySize = 8;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsStruct<::test_nullable::SimpleProtocolAddRequest> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::SimpleProtocolAddRequest, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddRequest, 8> {};
template <>
struct IsFidlType<::test_nullable::SimpleProtocolAddResponse> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::SimpleProtocolAddResponse> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 0;
static constexpr uint32_t kPrimarySize = 4;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsStruct<::test_nullable::SimpleProtocolAddResponse> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::SimpleProtocolAddResponse, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::SimpleProtocolAddResponse, 4> {};
#ifdef __Fuchsia__
template <>
struct IsResource<::test_nullable::StructWithNullableProtocol> : public std::true_type {};
template <>
struct IsFidlType<::test_nullable::StructWithNullableProtocol> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableProtocol> {
static constexpr uint32_t kMaxNumHandles = 1;
static constexpr uint32_t kMaxDepth = 0;
static constexpr uint32_t kPrimarySize = 4;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableProtocol> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableProtocol, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableProtocol, 4> {};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
struct IsResource<::test_nullable::StructWithNullableRequest> : public std::true_type {};
template <>
struct IsFidlType<::test_nullable::StructWithNullableRequest> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableRequest> {
static constexpr uint32_t kMaxNumHandles = 1;
static constexpr uint32_t kMaxDepth = 0;
static constexpr uint32_t kPrimarySize = 4;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableRequest> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableRequest, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableRequest, 4> {};
#endif // __Fuchsia__
template <>
struct IsFidlType<::test_nullable::Int32Wrapper> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::Int32Wrapper> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 0;
static constexpr uint32_t kPrimarySize = 4;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsStruct<::test_nullable::Int32Wrapper> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::Int32Wrapper, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::Int32Wrapper, 4> {};
template <>
struct IsFidlType<::test_nullable::StructWithNullableStruct> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableStruct> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 1;
static constexpr uint32_t kPrimarySize = 8;
static constexpr uint32_t kMaxOutOfLine = 8;
static constexpr bool kHasPointer = true;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableStruct> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableStruct, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableStruct, 8> {};
template <>
struct IsFidlType<::test_nullable::StructWithNullableUnion> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::StructWithNullableUnion> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 1;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = true;
};
template <>
struct IsStruct<::test_nullable::StructWithNullableUnion> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::StructWithNullableUnion, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalStructCodingTraits<::test_nullable::StructWithNullableUnion, 16> {};
template <>
struct IsFidlType<::test_nullable::SimpleUnion> : public std::true_type {};
template <>
struct TypeTraits<::test_nullable::SimpleUnion> {
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kMaxDepth = 1;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr bool kHasPointer = true;
};
template <>
struct IsUnion<::test_nullable::SimpleUnion> : public std::true_type {};
template <>
struct internal::NaturalCodingTraits<::test_nullable::SimpleUnion, ::fidl::internal::NaturalCodingConstraintEmpty> final
: public ::fidl::internal::NaturalUnionCodingTraits<::test_nullable::SimpleUnion> {};
#pragma clang diagnostic pop
} // namespace fidl