blob: 3c39df28e4a27d2517e1c5c0b8fc4f401053b89b [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include <lib/fidl/internal.h>
#include <lib/fidl/llcpp/array.h>
#include <lib/fidl/llcpp/coding.h>
#include <lib/fidl/llcpp/envelope.h>
#include <lib/fidl/llcpp/errors.h>
#include <lib/fidl/llcpp/message.h>
#include <lib/fidl/llcpp/message_storage.h>
#include <lib/fidl/llcpp/object_view.h>
#include <lib/fidl/llcpp/string_view.h>
#include <lib/fidl/llcpp/traits.h>
#include <lib/fidl/llcpp/vector_view.h>
#include <lib/fit/function.h>
#include <lib/stdcompat/optional.h>
#include <algorithm>
#include <cstddef>
#include <variant>
#ifdef __Fuchsia__
#include <lib/fidl/llcpp/client.h>
#include <lib/fidl/llcpp/client_end.h>
#include <lib/fidl/llcpp/connect_service.h>
#include <lib/fidl/llcpp/result.h>
#include <lib/fidl/llcpp/server.h>
#include <lib/fidl/llcpp/server_end.h>
#include <lib/fidl/llcpp/service_handler_interface.h>
#include <lib/fidl/llcpp/sync_call.h>
#include <lib/fidl/llcpp/transaction.h>
#include <lib/fidl/llcpp/wire_messaging.h>
#include <lib/fidl/txn_header.h>
#include <lib/zx/channel.h>
#endif // __Fuchsia__
#include <zircon/fidl.h>
namespace fidl_test_union {
namespace wire {
class Union;
struct StructWithNullableXUnion;
class StrictUnion;
class StrictSimpleXUnion;
class StrictFoo;
class StrictBoundedXUnion;
class ReverseOrdinalUnion;
struct Pizza;
struct Pasta;
class StrictPizzaOrPasta;
class PizzaOrPasta;
class FlexiblePizzaOrPasta;
class ExplicitPizzaOrPasta;
class OlderSimpleUnion;
} // namespace wire
class TestProtocol;
namespace wire {
struct NullableUnionStruct;
class NewerSimpleUnion;
class FlexibleUnion;
class FlexibleFoo;
class FieldCollision;
class ExplicitXUnion;
class ExplicitUnion;
class ExplicitStrictFoo;
class ExplicitFoo;
struct Empty;
class XUnionContainingEmptyStruct;
extern "C" const fidl_type_t fidl_test_union_UnionTable;
class Union {
public:
Union()
: ordinal_(::fidl_test_union::wire::Union::Ordinal::Invalid),
envelope_{} {}
Union(const Union&) = default;
Union& operator=(const Union&) = default;
Union(Union&&) = default;
Union& operator=(Union&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPrimitive = 1, // 0x1
kStringNeedsConstructor = 2, // 0x2
kVectorStringAlsoNeedsConstructor = 3, // 0x3
};
bool has_invalid_tag() const {
return ordinal_ == ::fidl_test_union::wire::Union::Ordinal::Invalid;
}
bool is_Primitive() const {
return ordinal_ == ::fidl_test_union::wire::Union::Ordinal::kPrimitive;
}
static Union WithPrimitive(::fidl::ObjectView<int32_t> val) {
Union result;
result.set_Primitive(val);
return result;
}
template <typename... Args>
static Union WithPrimitive(::fidl::AnyAllocator& allocator, Args&&... args) {
Union result;
result.set_Primitive(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_Primitive(::fidl::ObjectView<int32_t> elem) {
ordinal_ = ::fidl_test_union::wire::Union::Ordinal::kPrimitive;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_Primitive(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::Union::Ordinal::kPrimitive;
set_Primitive(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_Primitive() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::Union::Ordinal::kPrimitive);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& Primitive() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::Union::Ordinal::kPrimitive);
return *static_cast<int32_t*>(envelope_.data.get());
}
bool is_StringNeedsConstructor() const {
return ordinal_ ==
::fidl_test_union::wire::Union::Ordinal::kStringNeedsConstructor;
}
static Union WithStringNeedsConstructor(
::fidl::ObjectView<::fidl::StringView> val) {
Union result;
result.set_StringNeedsConstructor(val);
return result;
}
template <typename... Args>
static Union WithStringNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
Union result;
result.set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ = ::fidl_test_union::wire::Union::Ordinal::kStringNeedsConstructor;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_StringNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ = ::fidl_test_union::wire::Union::Ordinal::kStringNeedsConstructor;
set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
}
::fidl::StringView& mutable_StringNeedsConstructor() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::Union::Ordinal::kStringNeedsConstructor);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& StringNeedsConstructor() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::Union::Ordinal::kStringNeedsConstructor);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
bool is_VectorStringAlsoNeedsConstructor() const {
return ordinal_ == ::fidl_test_union::wire::Union::Ordinal::
kVectorStringAlsoNeedsConstructor;
}
static Union WithVectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> val) {
Union result;
result.set_VectorStringAlsoNeedsConstructor(val);
return result;
}
template <typename... Args>
static Union WithVectorStringAlsoNeedsConstructor(
::fidl::AnyAllocator& allocator, Args&&... args) {
Union result;
result.set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> elem) {
ordinal_ = ::fidl_test_union::wire::Union::Ordinal::
kVectorStringAlsoNeedsConstructor;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_VectorStringAlsoNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ = ::fidl_test_union::wire::Union::Ordinal::
kVectorStringAlsoNeedsConstructor;
set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
}
::fidl::VectorView<::fidl::StringView>&
mutable_VectorStringAlsoNeedsConstructor() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::Union::Ordinal::
kVectorStringAlsoNeedsConstructor);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
const ::fidl::VectorView<::fidl::StringView>&
VectorStringAlsoNeedsConstructor() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::Union::Ordinal::
kVectorStringAlsoNeedsConstructor);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
::fidl_test_union::wire::Union::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::Union::Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &fidl_test_union_UnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPrimitive = 1, // 0x1
kStringNeedsConstructor = 2, // 0x2
kVectorStringAlsoNeedsConstructor = 3, // 0x3
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::Union::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_StrictUnionTable;
class StrictUnion {
public:
StrictUnion()
: ordinal_(::fidl_test_union::wire::StrictUnion::Ordinal::Invalid),
envelope_{} {}
StrictUnion(const StrictUnion&) = default;
StrictUnion& operator=(const StrictUnion&) = default;
StrictUnion(StrictUnion&&) = default;
StrictUnion& operator=(StrictUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPrimitive = 1, // 0x1
kStringNeedsConstructor = 2, // 0x2
kVectorStringAlsoNeedsConstructor = 3, // 0x3
};
bool has_invalid_tag() const {
return ordinal_ == ::fidl_test_union::wire::StrictUnion::Ordinal::Invalid;
}
bool is_Primitive() const {
return ordinal_ ==
::fidl_test_union::wire::StrictUnion::Ordinal::kPrimitive;
}
static StrictUnion WithPrimitive(::fidl::ObjectView<int32_t> val) {
StrictUnion result;
result.set_Primitive(val);
return result;
}
template <typename... Args>
static StrictUnion WithPrimitive(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictUnion result;
result.set_Primitive(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_Primitive(::fidl::ObjectView<int32_t> elem) {
ordinal_ = ::fidl_test_union::wire::StrictUnion::Ordinal::kPrimitive;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_Primitive(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictUnion::Ordinal::kPrimitive;
set_Primitive(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_Primitive() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictUnion::Ordinal::kPrimitive);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& Primitive() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictUnion::Ordinal::kPrimitive);
return *static_cast<int32_t*>(envelope_.data.get());
}
bool is_StringNeedsConstructor() const {
return ordinal_ == ::fidl_test_union::wire::StrictUnion::Ordinal::
kStringNeedsConstructor;
}
static StrictUnion WithStringNeedsConstructor(
::fidl::ObjectView<::fidl::StringView> val) {
StrictUnion result;
result.set_StringNeedsConstructor(val);
return result;
}
template <typename... Args>
static StrictUnion WithStringNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictUnion result;
result.set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ =
::fidl_test_union::wire::StrictUnion::Ordinal::kStringNeedsConstructor;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_StringNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ =
::fidl_test_union::wire::StrictUnion::Ordinal::kStringNeedsConstructor;
set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
}
::fidl::StringView& mutable_StringNeedsConstructor() {
ZX_ASSERT(
ordinal_ ==
::fidl_test_union::wire::StrictUnion::Ordinal::kStringNeedsConstructor);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& StringNeedsConstructor() const {
ZX_ASSERT(
ordinal_ ==
::fidl_test_union::wire::StrictUnion::Ordinal::kStringNeedsConstructor);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
bool is_VectorStringAlsoNeedsConstructor() const {
return ordinal_ == ::fidl_test_union::wire::StrictUnion::Ordinal::
kVectorStringAlsoNeedsConstructor;
}
static StrictUnion WithVectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> val) {
StrictUnion result;
result.set_VectorStringAlsoNeedsConstructor(val);
return result;
}
template <typename... Args>
static StrictUnion WithVectorStringAlsoNeedsConstructor(
::fidl::AnyAllocator& allocator, Args&&... args) {
StrictUnion result;
result.set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> elem) {
ordinal_ = ::fidl_test_union::wire::StrictUnion::Ordinal::
kVectorStringAlsoNeedsConstructor;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_VectorStringAlsoNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictUnion::Ordinal::
kVectorStringAlsoNeedsConstructor;
set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
}
::fidl::VectorView<::fidl::StringView>&
mutable_VectorStringAlsoNeedsConstructor() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::StrictUnion::Ordinal::
kVectorStringAlsoNeedsConstructor);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
const ::fidl::VectorView<::fidl::StringView>&
VectorStringAlsoNeedsConstructor() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::StrictUnion::Ordinal::
kVectorStringAlsoNeedsConstructor);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
::fidl_test_union::wire::StrictUnion::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::StrictUnion::Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &fidl_test_union_StrictUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPrimitive = 1, // 0x1
kStringNeedsConstructor = 2, // 0x2
kVectorStringAlsoNeedsConstructor = 3, // 0x3
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::StrictUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_StrictSimpleXUnionTable;
class StrictSimpleXUnion {
public:
StrictSimpleXUnion()
: ordinal_(::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::Invalid),
envelope_{} {}
StrictSimpleXUnion(const StrictSimpleXUnion&) = default;
StrictSimpleXUnion& operator=(const StrictSimpleXUnion&) = default;
StrictSimpleXUnion(StrictSimpleXUnion&&) = default;
StrictSimpleXUnion& operator=(StrictSimpleXUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kI = 1, // 0x1
kF = 2, // 0x2
kS = 3, // 0x3
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::Invalid;
}
bool is_i() const {
return ordinal_ == ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kI;
}
static StrictSimpleXUnion WithI(::fidl::ObjectView<int32_t> val) {
StrictSimpleXUnion result;
result.set_i(val);
return result;
}
template <typename... Args>
static StrictSimpleXUnion WithI(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictSimpleXUnion result;
result.set_i(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_i(::fidl::ObjectView<int32_t> elem) {
ordinal_ = ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kI;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_i(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kI;
set_i(::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_i() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kI);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& i() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kI);
return *static_cast<int32_t*>(envelope_.data.get());
}
bool is_f() const {
return ordinal_ == ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kF;
}
static StrictSimpleXUnion WithF(::fidl::ObjectView<float> val) {
StrictSimpleXUnion result;
result.set_f(val);
return result;
}
template <typename... Args>
static StrictSimpleXUnion WithF(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictSimpleXUnion result;
result.set_f(
::fidl::ObjectView<float>(allocator, std::forward<Args>(args)...));
return result;
}
void set_f(::fidl::ObjectView<float> elem) {
ordinal_ = ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kF;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_f(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kF;
set_f(::fidl::ObjectView<float>(allocator, std::forward<Args>(args)...));
}
float& mutable_f() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kF);
return *static_cast<float*>(envelope_.data.get());
}
const float& f() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kF);
return *static_cast<float*>(envelope_.data.get());
}
bool is_s() const {
return ordinal_ == ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kS;
}
static StrictSimpleXUnion WithS(::fidl::ObjectView<::fidl::StringView> val) {
StrictSimpleXUnion result;
result.set_s(val);
return result;
}
template <typename... Args>
static StrictSimpleXUnion WithS(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictSimpleXUnion result;
result.set_s(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_s(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ = ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kS;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_s(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kS;
set_s(::fidl::ObjectView<::fidl::StringView>(allocator,
std::forward<Args>(args)...));
}
::fidl::StringView& mutable_s() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& s() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
::fidl_test_union::wire::StrictSimpleXUnion::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::StrictSimpleXUnion::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_union_StrictSimpleXUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kI = 1, // 0x1
kF = 2, // 0x2
kS = 3, // 0x3
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::StrictSimpleXUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_StrictFooTable;
class StrictFoo {
public:
StrictFoo()
: ordinal_(::fidl_test_union::wire::StrictFoo::Ordinal::Invalid),
envelope_{} {}
StrictFoo(const StrictFoo&) = default;
StrictFoo& operator=(const StrictFoo&) = default;
StrictFoo(StrictFoo&&) = default;
StrictFoo& operator=(StrictFoo&&) = default;
enum class Tag : fidl_xunion_tag_t {
kS = 1, // 0x1
kI = 2, // 0x2
};
bool has_invalid_tag() const {
return ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::Invalid;
}
bool is_s() const {
return ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::kS;
}
static StrictFoo WithS(::fidl::ObjectView<::fidl::StringView> val) {
StrictFoo result;
result.set_s(val);
return result;
}
template <typename... Args>
static StrictFoo WithS(::fidl::AnyAllocator& allocator, Args&&... args) {
StrictFoo result;
result.set_s(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_s(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ = ::fidl_test_union::wire::StrictFoo::Ordinal::kS;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_s(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictFoo::Ordinal::kS;
set_s(::fidl::ObjectView<::fidl::StringView>(allocator,
std::forward<Args>(args)...));
}
::fidl::StringView& mutable_s() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& s() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
bool is_i() const {
return ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::kI;
}
static StrictFoo WithI(::fidl::ObjectView<int32_t> val) {
StrictFoo result;
result.set_i(val);
return result;
}
template <typename... Args>
static StrictFoo WithI(::fidl::AnyAllocator& allocator, Args&&... args) {
StrictFoo result;
result.set_i(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_i(::fidl::ObjectView<int32_t> elem) {
ordinal_ = ::fidl_test_union::wire::StrictFoo::Ordinal::kI;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_i(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictFoo::Ordinal::kI;
set_i(::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_i() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::kI);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& i() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::StrictFoo::Ordinal::kI);
return *static_cast<int32_t*>(envelope_.data.get());
}
::fidl_test_union::wire::StrictFoo::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::StrictFoo::Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &fidl_test_union_StrictFooTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kS = 1, // 0x1
kI = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::StrictFoo::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_StrictBoundedXUnionTable;
class StrictBoundedXUnion {
public:
StrictBoundedXUnion()
: ordinal_(
::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::Invalid),
envelope_{} {}
StrictBoundedXUnion(const StrictBoundedXUnion&) = default;
StrictBoundedXUnion& operator=(const StrictBoundedXUnion&) = default;
StrictBoundedXUnion(StrictBoundedXUnion&&) = default;
StrictBoundedXUnion& operator=(StrictBoundedXUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kV = 1, // 0x1
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::Invalid;
}
bool is_v() const {
return ordinal_ ==
::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::kV;
}
static StrictBoundedXUnion WithV(
::fidl::ObjectView<::fidl::VectorView<uint8_t>> val) {
StrictBoundedXUnion result;
result.set_v(val);
return result;
}
template <typename... Args>
static StrictBoundedXUnion WithV(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictBoundedXUnion result;
result.set_v(::fidl::ObjectView<::fidl::VectorView<uint8_t>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_v(::fidl::ObjectView<::fidl::VectorView<uint8_t>> elem) {
ordinal_ = ::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::kV;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_v(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::kV;
set_v(::fidl::ObjectView<::fidl::VectorView<uint8_t>>(
allocator, std::forward<Args>(args)...));
}
::fidl::VectorView<uint8_t>& mutable_v() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::kV);
return *static_cast<::fidl::VectorView<uint8_t>*>(envelope_.data.get());
}
const ::fidl::VectorView<uint8_t>& v() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictBoundedXUnion::Ordinal::kV);
return *static_cast<::fidl::VectorView<uint8_t>*>(envelope_.data.get());
}
::fidl_test_union::wire::StrictBoundedXUnion::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::StrictBoundedXUnion::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_union_StrictBoundedXUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 32;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kV = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::StrictBoundedXUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_ReverseOrdinalUnionTable;
class ReverseOrdinalUnion {
public:
ReverseOrdinalUnion()
: ordinal_(
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::Invalid),
envelope_{} {}
ReverseOrdinalUnion(const ReverseOrdinalUnion&) = default;
ReverseOrdinalUnion& operator=(const ReverseOrdinalUnion&) = default;
ReverseOrdinalUnion(ReverseOrdinalUnion&&) = default;
ReverseOrdinalUnion& operator=(ReverseOrdinalUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kSecond = 2, // 0x2
kFirst = 1, // 0x1
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::Invalid;
}
bool is_second() const {
return ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kSecond;
}
static ReverseOrdinalUnion WithSecond(::fidl::ObjectView<uint32_t> val) {
ReverseOrdinalUnion result;
result.set_second(val);
return result;
}
template <typename... Args>
static ReverseOrdinalUnion WithSecond(::fidl::AnyAllocator& allocator,
Args&&... args) {
ReverseOrdinalUnion result;
result.set_second(
::fidl::ObjectView<uint32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_second(::fidl::ObjectView<uint32_t> elem) {
ordinal_ = ::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kSecond;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_second(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kSecond;
set_second(
::fidl::ObjectView<uint32_t>(allocator, std::forward<Args>(args)...));
}
uint32_t& mutable_second() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kSecond);
return *static_cast<uint32_t*>(envelope_.data.get());
}
const uint32_t& second() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kSecond);
return *static_cast<uint32_t*>(envelope_.data.get());
}
bool is_first() const {
return ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kFirst;
}
static ReverseOrdinalUnion WithFirst(::fidl::ObjectView<uint32_t> val) {
ReverseOrdinalUnion result;
result.set_first(val);
return result;
}
template <typename... Args>
static ReverseOrdinalUnion WithFirst(::fidl::AnyAllocator& allocator,
Args&&... args) {
ReverseOrdinalUnion result;
result.set_first(
::fidl::ObjectView<uint32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_first(::fidl::ObjectView<uint32_t> elem) {
ordinal_ = ::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kFirst;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_first(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kFirst;
set_first(
::fidl::ObjectView<uint32_t>(allocator, std::forward<Args>(args)...));
}
uint32_t& mutable_first() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kFirst);
return *static_cast<uint32_t*>(envelope_.data.get());
}
const uint32_t& first() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal::kFirst);
return *static_cast<uint32_t*>(envelope_.data.get());
}
::fidl_test_union::wire::ReverseOrdinalUnion::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::ReverseOrdinalUnion::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_union_ReverseOrdinalUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kSecond = 2, // 0x2
kFirst = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::ReverseOrdinalUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_StrictPizzaOrPastaTable;
class StrictPizzaOrPasta {
public:
StrictPizzaOrPasta()
: ordinal_(::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::Invalid),
envelope_{} {}
StrictPizzaOrPasta(const StrictPizzaOrPasta&) = default;
StrictPizzaOrPasta& operator=(const StrictPizzaOrPasta&) = default;
StrictPizzaOrPasta(StrictPizzaOrPasta&&) = default;
StrictPizzaOrPasta& operator=(StrictPizzaOrPasta&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPizza = 1, // 0x1
kPasta = 2, // 0x2
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::Invalid;
}
bool is_pizza() const {
return ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPizza;
}
static StrictPizzaOrPasta WithPizza(
::fidl::ObjectView<::fidl_test_union::wire::Pizza> val) {
StrictPizzaOrPasta result;
result.set_pizza(val);
return result;
}
template <typename... Args>
static StrictPizzaOrPasta WithPizza(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictPizzaOrPasta result;
result.set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza> elem) {
ordinal_ = ::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPizza;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pizza(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPizza;
set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pizza& mutable_pizza() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pizza& pizza() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
bool is_pasta() const {
return ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPasta;
}
static StrictPizzaOrPasta WithPasta(
::fidl::ObjectView<::fidl_test_union::wire::Pasta> val) {
StrictPizzaOrPasta result;
result.set_pasta(val);
return result;
}
template <typename... Args>
static StrictPizzaOrPasta WithPasta(::fidl::AnyAllocator& allocator,
Args&&... args) {
StrictPizzaOrPasta result;
result.set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta> elem) {
ordinal_ = ::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPasta;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pasta(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPasta;
set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pasta& mutable_pasta() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pasta& pasta() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
::fidl_test_union::wire::StrictPizzaOrPasta::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::StrictPizzaOrPasta::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_union_StrictPizzaOrPastaTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPizza = 1, // 0x1
kPasta = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::StrictPizzaOrPasta::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_PizzaOrPastaTable;
class PizzaOrPasta {
public:
PizzaOrPasta()
: ordinal_(::fidl_test_union::wire::PizzaOrPasta::Ordinal::Invalid),
envelope_{} {}
PizzaOrPasta(const PizzaOrPasta&) = default;
PizzaOrPasta& operator=(const PizzaOrPasta&) = default;
PizzaOrPasta(PizzaOrPasta&&) = default;
PizzaOrPasta& operator=(PizzaOrPasta&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPizza = 1, // 0x1
kPasta = 2, // 0x2
};
bool has_invalid_tag() const {
return ordinal_ == ::fidl_test_union::wire::PizzaOrPasta::Ordinal::Invalid;
}
bool is_pizza() const {
return ordinal_ == ::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPizza;
}
static PizzaOrPasta WithPizza(
::fidl::ObjectView<::fidl_test_union::wire::Pizza> val) {
PizzaOrPasta result;
result.set_pizza(val);
return result;
}
template <typename... Args>
static PizzaOrPasta WithPizza(::fidl::AnyAllocator& allocator,
Args&&... args) {
PizzaOrPasta result;
result.set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza> elem) {
ordinal_ = ::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPizza;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pizza(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPizza;
set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pizza& mutable_pizza() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pizza& pizza() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
bool is_pasta() const {
return ordinal_ == ::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPasta;
}
static PizzaOrPasta WithPasta(
::fidl::ObjectView<::fidl_test_union::wire::Pasta> val) {
PizzaOrPasta result;
result.set_pasta(val);
return result;
}
template <typename... Args>
static PizzaOrPasta WithPasta(::fidl::AnyAllocator& allocator,
Args&&... args) {
PizzaOrPasta result;
result.set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta> elem) {
ordinal_ = ::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPasta;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pasta(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPasta;
set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pasta& mutable_pasta() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pasta& pasta() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::PizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
::fidl_test_union::wire::PizzaOrPasta::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::PizzaOrPasta::Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type = &fidl_test_union_PizzaOrPastaTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPizza = 1, // 0x1
kPasta = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::PizzaOrPasta::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_FlexiblePizzaOrPastaTable;
class FlexiblePizzaOrPasta {
public:
FlexiblePizzaOrPasta()
: ordinal_(
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::Invalid),
envelope_{} {}
FlexiblePizzaOrPasta(const FlexiblePizzaOrPasta&) = default;
FlexiblePizzaOrPasta& operator=(const FlexiblePizzaOrPasta&) = default;
FlexiblePizzaOrPasta(FlexiblePizzaOrPasta&&) = default;
FlexiblePizzaOrPasta& operator=(FlexiblePizzaOrPasta&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPizza = 1, // 0x1
kPasta = 2, // 0x2
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::Invalid;
}
bool is_pizza() const {
return ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPizza;
}
static FlexiblePizzaOrPasta WithPizza(
::fidl::ObjectView<::fidl_test_union::wire::Pizza> val) {
FlexiblePizzaOrPasta result;
result.set_pizza(val);
return result;
}
template <typename... Args>
static FlexiblePizzaOrPasta WithPizza(::fidl::AnyAllocator& allocator,
Args&&... args) {
FlexiblePizzaOrPasta result;
result.set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza> elem) {
ordinal_ = ::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPizza;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pizza(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPizza;
set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pizza& mutable_pizza() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pizza& pizza() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
bool is_pasta() const {
return ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPasta;
}
static FlexiblePizzaOrPasta WithPasta(
::fidl::ObjectView<::fidl_test_union::wire::Pasta> val) {
FlexiblePizzaOrPasta result;
result.set_pasta(val);
return result;
}
template <typename... Args>
static FlexiblePizzaOrPasta WithPasta(::fidl::AnyAllocator& allocator,
Args&&... args) {
FlexiblePizzaOrPasta result;
result.set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta> elem) {
ordinal_ = ::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPasta;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pasta(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPasta;
set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pasta& mutable_pasta() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pasta& pasta() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
::fidl_test_union::wire::FlexiblePizzaOrPasta::Tag which() const;
static constexpr const fidl_type_t* Type =
&fidl_test_union_FlexiblePizzaOrPastaTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPizza = 1, // 0x1
kPasta = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::FlexiblePizzaOrPasta::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_ExplicitPizzaOrPastaTable;
class ExplicitPizzaOrPasta {
public:
ExplicitPizzaOrPasta()
: ordinal_(
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::Invalid),
envelope_{} {}
ExplicitPizzaOrPasta(const ExplicitPizzaOrPasta&) = default;
ExplicitPizzaOrPasta& operator=(const ExplicitPizzaOrPasta&) = default;
ExplicitPizzaOrPasta(ExplicitPizzaOrPasta&&) = default;
ExplicitPizzaOrPasta& operator=(ExplicitPizzaOrPasta&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPizza = 1, // 0x1
kPasta = 4, // 0x4
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::Invalid;
}
bool is_pizza() const {
return ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPizza;
}
static ExplicitPizzaOrPasta WithPizza(
::fidl::ObjectView<::fidl_test_union::wire::Pizza> val) {
ExplicitPizzaOrPasta result;
result.set_pizza(val);
return result;
}
template <typename... Args>
static ExplicitPizzaOrPasta WithPizza(::fidl::AnyAllocator& allocator,
Args&&... args) {
ExplicitPizzaOrPasta result;
result.set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza> elem) {
ordinal_ = ::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPizza;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pizza(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPizza;
set_pizza(::fidl::ObjectView<::fidl_test_union::wire::Pizza>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pizza& mutable_pizza() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pizza& pizza() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPizza);
return *static_cast<::fidl_test_union::wire::Pizza*>(envelope_.data.get());
}
bool is_pasta() const {
return ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPasta;
}
static ExplicitPizzaOrPasta WithPasta(
::fidl::ObjectView<::fidl_test_union::wire::Pasta> val) {
ExplicitPizzaOrPasta result;
result.set_pasta(val);
return result;
}
template <typename... Args>
static ExplicitPizzaOrPasta WithPasta(::fidl::AnyAllocator& allocator,
Args&&... args) {
ExplicitPizzaOrPasta result;
result.set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta> elem) {
ordinal_ = ::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPasta;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_pasta(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPasta;
set_pasta(::fidl::ObjectView<::fidl_test_union::wire::Pasta>(
allocator, std::forward<Args>(args)...));
}
::fidl_test_union::wire::Pasta& mutable_pasta() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
const ::fidl_test_union::wire::Pasta& pasta() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal::kPasta);
return *static_cast<::fidl_test_union::wire::Pasta*>(envelope_.data.get());
}
::fidl_test_union::wire::ExplicitPizzaOrPasta::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::ExplicitPizzaOrPasta::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_union_ExplicitPizzaOrPastaTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPizza = 1, // 0x1
kPasta = 4, // 0x4
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::ExplicitPizzaOrPasta::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_OlderSimpleUnionTable;
class OlderSimpleUnion {
public:
OlderSimpleUnion()
: ordinal_(::fidl_test_union::wire::OlderSimpleUnion::Ordinal::Invalid),
envelope_{} {}
OlderSimpleUnion(const OlderSimpleUnion&) = default;
OlderSimpleUnion& operator=(const OlderSimpleUnion&) = default;
OlderSimpleUnion(OlderSimpleUnion&&) = default;
OlderSimpleUnion& operator=(OlderSimpleUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kI = 1, // 0x1
kF = 2, // 0x2
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::OlderSimpleUnion::Ordinal::Invalid;
}
bool is_i() const {
return ordinal_ == ::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kI;
}
static OlderSimpleUnion WithI(::fidl::ObjectView<int64_t> val) {
OlderSimpleUnion result;
result.set_i(val);
return result;
}
template <typename... Args>
static OlderSimpleUnion WithI(::fidl::AnyAllocator& allocator,
Args&&... args) {
OlderSimpleUnion result;
result.set_i(
::fidl::ObjectView<int64_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_i(::fidl::ObjectView<int64_t> elem) {
ordinal_ = ::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kI;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_i(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kI;
set_i(::fidl::ObjectView<int64_t>(allocator, std::forward<Args>(args)...));
}
int64_t& mutable_i() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kI);
return *static_cast<int64_t*>(envelope_.data.get());
}
const int64_t& i() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kI);
return *static_cast<int64_t*>(envelope_.data.get());
}
bool is_f() const {
return ordinal_ == ::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kF;
}
static OlderSimpleUnion WithF(::fidl::ObjectView<float> val) {
OlderSimpleUnion result;
result.set_f(val);
return result;
}
template <typename... Args>
static OlderSimpleUnion WithF(::fidl::AnyAllocator& allocator,
Args&&... args) {
OlderSimpleUnion result;
result.set_f(
::fidl::ObjectView<float>(allocator, std::forward<Args>(args)...));
return result;
}
void set_f(::fidl::ObjectView<float> elem) {
ordinal_ = ::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kF;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_f(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kF;
set_f(::fidl::ObjectView<float>(allocator, std::forward<Args>(args)...));
}
float& mutable_f() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kF);
return *static_cast<float*>(envelope_.data.get());
}
const float& f() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::OlderSimpleUnion::Ordinal::kF);
return *static_cast<float*>(envelope_.data.get());
}
::fidl_test_union::wire::OlderSimpleUnion::Tag which() const;
static constexpr const fidl_type_t* Type =
&fidl_test_union_OlderSimpleUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kI = 1, // 0x1
kF = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::OlderSimpleUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_NewerSimpleUnionTable;
class NewerSimpleUnion {
public:
NewerSimpleUnion()
: ordinal_(::fidl_test_union::wire::NewerSimpleUnion::Ordinal::Invalid),
envelope_{} {}
NewerSimpleUnion(const NewerSimpleUnion&) = default;
NewerSimpleUnion& operator=(const NewerSimpleUnion&) = default;
NewerSimpleUnion(NewerSimpleUnion&&) = default;
NewerSimpleUnion& operator=(NewerSimpleUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kI = 1, // 0x1
kS = 2, // 0x2
kV = 3, // 0x3
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::Invalid;
}
bool is_i() const {
return ordinal_ == ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kI;
}
static NewerSimpleUnion WithI(::fidl::ObjectView<int64_t> val) {
NewerSimpleUnion result;
result.set_i(val);
return result;
}
template <typename... Args>
static NewerSimpleUnion WithI(::fidl::AnyAllocator& allocator,
Args&&... args) {
NewerSimpleUnion result;
result.set_i(
::fidl::ObjectView<int64_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_i(::fidl::ObjectView<int64_t> elem) {
ordinal_ = ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kI;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_i(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kI;
set_i(::fidl::ObjectView<int64_t>(allocator, std::forward<Args>(args)...));
}
int64_t& mutable_i() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kI);
return *static_cast<int64_t*>(envelope_.data.get());
}
const int64_t& i() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kI);
return *static_cast<int64_t*>(envelope_.data.get());
}
bool is_s() const {
return ordinal_ == ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kS;
}
static NewerSimpleUnion WithS(::fidl::ObjectView<::fidl::StringView> val) {
NewerSimpleUnion result;
result.set_s(val);
return result;
}
template <typename... Args>
static NewerSimpleUnion WithS(::fidl::AnyAllocator& allocator,
Args&&... args) {
NewerSimpleUnion result;
result.set_s(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_s(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ = ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kS;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_s(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kS;
set_s(::fidl::ObjectView<::fidl::StringView>(allocator,
std::forward<Args>(args)...));
}
::fidl::StringView& mutable_s() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& s() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
bool is_v() const {
return ordinal_ == ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kV;
}
static NewerSimpleUnion WithV(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> val) {
NewerSimpleUnion result;
result.set_v(val);
return result;
}
template <typename... Args>
static NewerSimpleUnion WithV(::fidl::AnyAllocator& allocator,
Args&&... args) {
NewerSimpleUnion result;
result.set_v(::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_v(::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> elem) {
ordinal_ = ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kV;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_v(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kV;
set_v(::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
}
::fidl::VectorView<::fidl::StringView>& mutable_v() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kV);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
const ::fidl::VectorView<::fidl::StringView>& v() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::NewerSimpleUnion::Ordinal::kV);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
::fidl_test_union::wire::NewerSimpleUnion::Tag which() const;
static constexpr const fidl_type_t* Type =
&fidl_test_union_NewerSimpleUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kI = 1, // 0x1
kS = 2, // 0x2
kV = 3, // 0x3
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::NewerSimpleUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_FlexibleUnionTable;
class FlexibleUnion {
public:
FlexibleUnion()
: ordinal_(::fidl_test_union::wire::FlexibleUnion::Ordinal::Invalid),
envelope_{} {}
FlexibleUnion(const FlexibleUnion&) = default;
FlexibleUnion& operator=(const FlexibleUnion&) = default;
FlexibleUnion(FlexibleUnion&&) = default;
FlexibleUnion& operator=(FlexibleUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kPrimitive = 1, // 0x1
kStringNeedsConstructor = 2, // 0x2
kVectorStringAlsoNeedsConstructor = 3, // 0x3
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::Invalid;
}
bool is_Primitive() const {
return ordinal_ ==
::fidl_test_union::wire::FlexibleUnion::Ordinal::kPrimitive;
}
static FlexibleUnion WithPrimitive(::fidl::ObjectView<int32_t> val) {
FlexibleUnion result;
result.set_Primitive(val);
return result;
}
template <typename... Args>
static FlexibleUnion WithPrimitive(::fidl::AnyAllocator& allocator,
Args&&... args) {
FlexibleUnion result;
result.set_Primitive(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_Primitive(::fidl::ObjectView<int32_t> elem) {
ordinal_ = ::fidl_test_union::wire::FlexibleUnion::Ordinal::kPrimitive;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_Primitive(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexibleUnion::Ordinal::kPrimitive;
set_Primitive(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_Primitive() {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::FlexibleUnion::Ordinal::kPrimitive);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& Primitive() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_union::wire::FlexibleUnion::Ordinal::kPrimitive);
return *static_cast<int32_t*>(envelope_.data.get());
}
bool is_StringNeedsConstructor() const {
return ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kStringNeedsConstructor;
}
static FlexibleUnion WithStringNeedsConstructor(
::fidl::ObjectView<::fidl::StringView> val) {
FlexibleUnion result;
result.set_StringNeedsConstructor(val);
return result;
}
template <typename... Args>
static FlexibleUnion WithStringNeedsConstructor(
::fidl::AnyAllocator& allocator, Args&&... args) {
FlexibleUnion result;
result.set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ = ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kStringNeedsConstructor;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_StringNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kStringNeedsConstructor;
set_StringNeedsConstructor(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
}
::fidl::StringView& mutable_StringNeedsConstructor() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kStringNeedsConstructor);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& StringNeedsConstructor() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kStringNeedsConstructor);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
bool is_VectorStringAlsoNeedsConstructor() const {
return ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kVectorStringAlsoNeedsConstructor;
}
static FlexibleUnion WithVectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> val) {
FlexibleUnion result;
result.set_VectorStringAlsoNeedsConstructor(val);
return result;
}
template <typename... Args>
static FlexibleUnion WithVectorStringAlsoNeedsConstructor(
::fidl::AnyAllocator& allocator, Args&&... args) {
FlexibleUnion result;
result.set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>> elem) {
ordinal_ = ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kVectorStringAlsoNeedsConstructor;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_VectorStringAlsoNeedsConstructor(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kVectorStringAlsoNeedsConstructor;
set_VectorStringAlsoNeedsConstructor(
::fidl::ObjectView<::fidl::VectorView<::fidl::StringView>>(
allocator, std::forward<Args>(args)...));
}
::fidl::VectorView<::fidl::StringView>&
mutable_VectorStringAlsoNeedsConstructor() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kVectorStringAlsoNeedsConstructor);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
const ::fidl::VectorView<::fidl::StringView>&
VectorStringAlsoNeedsConstructor() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleUnion::Ordinal::
kVectorStringAlsoNeedsConstructor);
return *static_cast<::fidl::VectorView<::fidl::StringView>*>(
envelope_.data.get());
}
::fidl_test_union::wire::FlexibleUnion::Tag which() const;
static constexpr const fidl_type_t* Type =
&fidl_test_union_FlexibleUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kPrimitive = 1, // 0x1
kStringNeedsConstructor = 2, // 0x2
kVectorStringAlsoNeedsConstructor = 3, // 0x3
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::FlexibleUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_FlexibleFooTable;
class FlexibleFoo {
public:
FlexibleFoo()
: ordinal_(::fidl_test_union::wire::FlexibleFoo::Ordinal::Invalid),
envelope_{} {}
FlexibleFoo(const FlexibleFoo&) = default;
FlexibleFoo& operator=(const FlexibleFoo&) = default;
FlexibleFoo(FlexibleFoo&&) = default;
FlexibleFoo& operator=(FlexibleFoo&&) = default;
enum class Tag : fidl_xunion_tag_t {
kS = 1, // 0x1
kI = 2, // 0x2
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::Invalid;
}
bool is_s() const {
return ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::kS;
}
static FlexibleFoo WithS(::fidl::ObjectView<::fidl::StringView> val) {
FlexibleFoo result;
result.set_s(val);
return result;
}
template <typename... Args>
static FlexibleFoo WithS(::fidl::AnyAllocator& allocator, Args&&... args) {
FlexibleFoo result;
result.set_s(::fidl::ObjectView<::fidl::StringView>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_s(::fidl::ObjectView<::fidl::StringView> elem) {
ordinal_ = ::fidl_test_union::wire::FlexibleFoo::Ordinal::kS;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_s(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexibleFoo::Ordinal::kS;
set_s(::fidl::ObjectView<::fidl::StringView>(allocator,
std::forward<Args>(args)...));
}
::fidl::StringView& mutable_s() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
const ::fidl::StringView& s() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::kS);
return *static_cast<::fidl::StringView*>(envelope_.data.get());
}
bool is_i() const {
return ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::kI;
}
static FlexibleFoo WithI(::fidl::ObjectView<int32_t> val) {
FlexibleFoo result;
result.set_i(val);
return result;
}
template <typename... Args>
static FlexibleFoo WithI(::fidl::AnyAllocator& allocator, Args&&... args) {
FlexibleFoo result;
result.set_i(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_i(::fidl::ObjectView<int32_t> elem) {
ordinal_ = ::fidl_test_union::wire::FlexibleFoo::Ordinal::kI;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_i(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::FlexibleFoo::Ordinal::kI;
set_i(::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_i() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::kI);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& i() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::FlexibleFoo::Ordinal::kI);
return *static_cast<int32_t*>(envelope_.data.get());
}
::fidl_test_union::wire::FlexibleFoo::Tag which() const;
static constexpr const fidl_type_t* Type = &fidl_test_union_FlexibleFooTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 4294967295;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kS = 1, // 0x1
kI = 2, // 0x2
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::FlexibleFoo::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_FieldCollisionTable;
class FieldCollision {
public:
FieldCollision()
: ordinal_(::fidl_test_union::wire::FieldCollision::Ordinal::Invalid),
envelope_{} {}
FieldCollision(const FieldCollision&) = default;
FieldCollision& operator=(const FieldCollision&) = default;
FieldCollision(FieldCollision&&) = default;
FieldCollision& operator=(FieldCollision&&) = default;
enum class Tag : fidl_xunion_tag_t {
kFieldCollisionTag = 1, // 0x1
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::FieldCollision::Ordinal::Invalid;
}
bool is_field_collision_tag() const {
return ordinal_ ==
::fidl_test_union::wire::FieldCollision::Ordinal::kFieldCollisionTag;
}
static FieldCollision WithFieldCollisionTag(::fidl::ObjectView<int32_t> val) {
FieldCollision result;
result.set_field_collision_tag(val);
return result;
}
template <typename... Args>
static FieldCollision WithFieldCollisionTag(::fidl::AnyAllocator& allocator,
Args&&... args) {
FieldCollision result;
result.set_field_collision_tag(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_field_collision_tag(::fidl::ObjectView<int32_t> elem) {
ordinal_ =
::fidl_test_union::wire::FieldCollision::Ordinal::kFieldCollisionTag;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_field_collision_tag(::fidl::AnyAllocator& allocator,
Args&&... args) {
ordinal_ =
::fidl_test_union::wire::FieldCollision::Ordinal::kFieldCollisionTag;
set_field_collision_tag(
::fidl::ObjectView<int32_t>(allocator, std::forward<Args>(args)...));
}
int32_t& mutable_field_collision_tag() {
ZX_ASSERT(
ordinal_ ==
::fidl_test_union::wire::FieldCollision::Ordinal::kFieldCollisionTag);
return *static_cast<int32_t*>(envelope_.data.get());
}
const int32_t& field_collision_tag() const {
ZX_ASSERT(
ordinal_ ==
::fidl_test_union::wire::FieldCollision::Ordinal::kFieldCollisionTag);
return *static_cast<int32_t*>(envelope_.data.get());
}
::fidl_test_union::wire::FieldCollision::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_union::wire::FieldCollision::Tag>(ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_union_FieldCollisionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kFieldCollisionTag = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::FieldCollision::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_ExplicitXUnionTable;
class ExplicitXUnion {
public:
ExplicitXUnion()
: ordinal_(::fidl_test_union::wire::ExplicitXUnion::Ordinal::Invalid),
envelope_{} {}
ExplicitXUnion(const ExplicitXUnion&) = default;
ExplicitXUnion& operator=(const ExplicitXUnion&) = default;
ExplicitXUnion(ExplicitXUnion&&) = default;
ExplicitXUnion& operator=(ExplicitXUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kI = 1, // 0x1
kF = 4, // 0x4
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_union::wire::ExplicitXUnion::Ordinal::Invalid;
}
bool is_i() const {
return ordinal_ == ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kI;
}
static ExplicitXUnion WithI(::fidl::ObjectView<int64_t> val) {
ExplicitXUnion result;
result.set_i(val);
return result;
}
template <typename... Args>
static ExplicitXUnion WithI(::fidl::AnyAllocator& allocator, Args&&... args) {
ExplicitXUnion result;
result.set_i(
::fidl::ObjectView<int64_t>(allocator, std::forward<Args>(args)...));
return result;
}
void set_i(::fidl::ObjectView<int64_t> elem) {
ordinal_ = ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kI;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_i(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kI;
set_i(::fidl::ObjectView<int64_t>(allocator, std::forward<Args>(args)...));
}
int64_t& mutable_i() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kI);
return *static_cast<int64_t*>(envelope_.data.get());
}
const int64_t& i() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kI);
return *static_cast<int64_t*>(envelope_.data.get());
}
bool is_f() const {
return ordinal_ == ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kF;
}
static ExplicitXUnion WithF(::fidl::ObjectView<float> val) {
ExplicitXUnion result;
result.set_f(val);
return result;
}
template <typename... Args>
static ExplicitXUnion WithF(::fidl::AnyAllocator& allocator, Args&&... args) {
ExplicitXUnion result;
result.set_f(
::fidl::ObjectView<float>(allocator, std::forward<Args>(args)...));
return result;
}
void set_f(::fidl::ObjectView<float> elem) {
ordinal_ = ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kF;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_f(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kF;
set_f(::fidl::ObjectView<float>(allocator, std::forward<Args>(args)...));
}
float& mutable_f() {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kF);
return *static_cast<float*>(envelope_.data.get());
}
const float& f() const {
ZX_ASSERT(ordinal_ == ::fidl_test_union::wire::ExplicitXUnion::Ordinal::kF);
return *static_cast<float*>(envelope_.data.get());
}
::fidl_test_union::wire::ExplicitXUnion::Tag which() const;
static constexpr const fidl_type_t* Type =
&fidl_test_union_ExplicitXUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kI = 1, // 0x1
kF = 4, // 0x4
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_union::wire::ExplicitXUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_union_ExplicitUnionTable;