blob: 7dd0bb33e4d407f48c1a60ba44b75843ffb673d5 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include <lib/fidl/llcpp/array.h>
#include <lib/fidl/llcpp/coding.h>
#include <lib/fidl/llcpp/envelope.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/wire_types.h>
#include <lib/stdcompat/optional.h>
#include <cinttypes>
#ifdef __Fuchsia__
#include <lib/zx/channel.h>
#endif // __Fuchsia__
#include <fidl/test.exampleusing/cpp/wire_types.h>
#include <fidl/test.placementofattributes/cpp/common_types.h>
#include <fidl/test.placementofattributes/cpp/markers.h>
namespace test_placementofattributes {
namespace wire {
using ExampleBits = ::test_placementofattributes::ExampleBits;
using ExampleEnum = ::test_placementofattributes::ExampleEnum;
struct ExampleStruct;
struct ExampleProtocolMethodRequest;
class ExampleTable;
class ExampleXUnion;
class ExampleUnion;
extern "C" const fidl_type_t test_placementofattributes_ExampleStructTable;
struct ExampleStruct {
uint32_t member = {};
};
extern "C" const fidl_type_t
test_placementofattributes_ExampleProtocolMethodRequestTable;
struct ExampleProtocolMethodRequest {
::test_exampleusing::wire::Empty arg = {};
};
} // namespace wire
} // namespace test_placementofattributes
template <>
class ::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>;
template <>
class ::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>;
template <>
struct ::fidl::WireTableFrame<::test_placementofattributes::wire::ExampleTable>
final {
public:
WireTableFrame() = default;
// In its intended usage, WireTableFrame will be referenced by an ObjectView.
// If the ObjectView is assigned before a move or copy, then it will reference
// the old invalid object. Because this is unsafe, copies are disallowed and
// moves are only allowed by friend classes that operate safely.
WireTableFrame(const WireTableFrame&) = delete;
WireTableFrame& operator=(const WireTableFrame&) = delete;
private:
WireTableFrame(WireTableFrame&&) noexcept = default;
WireTableFrame& operator=(WireTableFrame&&) noexcept = default;
bool HasUnknownData() const;
::fidl::Envelope<uint32_t> member_;
friend class ::test_placementofattributes::wire::ExampleTable;
friend ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>>;
friend ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>>;
};
namespace test_placementofattributes {
namespace wire {
extern "C" const fidl_type_t test_placementofattributes_ExampleTableTable;
class ExampleTable {
public:
ExampleTable() = default;
ExampleTable(const ExampleTable& other) noexcept = default;
ExampleTable& operator=(const ExampleTable& other) noexcept = default;
ExampleTable(ExampleTable&& other) noexcept = default;
ExampleTable& operator=(ExampleTable&& other) noexcept = default;
~ExampleTable() = default;
// Returns whether no field is set.
bool IsEmpty() const { return max_ordinal_ == 0; }
// Returns whether the table references unknown fields.
bool HasUnknownData() const;
// Return a builder that by defaults allocates of an arena.
static ::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>
Builder(::fidl::AnyArena& arena);
// Return a builder that relies on explicitly allocating |fidl::ObjectView|s.
static ::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>
ExternalBuilder(::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>
frame);
const uint32_t& member() const {
ZX_ASSERT(has_member());
return frame_ptr_->member_.get_data();
}
uint32_t& member() {
ZX_ASSERT(has_member());
return frame_ptr_->member_.get_data();
}
bool has_member() const {
return max_ordinal_ >= 1 && frame_ptr_->member_.has_data();
}
#if defined(FIDL_WIRE_ALLOW_DEPRECATED_MUTABLE_TABLES) || false
public:
#else // !defined(FIDL_WIRE_ALLOW_DEPRECATED_MUTABLE_TABLES)
private:
#endif // FIDL_WIRE_ALLOW_DEPRECATED_MUTABLE_TABLES
ExampleTable& set_member(uint32_t elem) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->member_.set_data(std::move(elem));
max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1));
return *this;
}
ExampleTable& clear_member() {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->member_.clear_data();
return *this;
}
explicit ExampleTable(::fidl::AnyArena& allocator)
: frame_ptr_(
::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>(allocator)) {
}
// This constructor allows a user controlled allocation (not using a Arena).
// It should only be used when performance is key.
// As soon as the frame is given to the table, it must not be used directly or
// for another table.
explicit ExampleTable(
::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>&& frame)
: frame_ptr_(std::move(frame)) {}
void Allocate(::fidl::AnyArena& allocator) {
max_ordinal_ = 0;
frame_ptr_ = ::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>(allocator);
}
void Init(
::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>&& frame_ptr) {
max_ordinal_ = 0;
frame_ptr_ = std::move(frame_ptr);
}
private:
friend ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>>;
friend ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>>;
uint64_t max_ordinal_ = 0;
::fidl::ObjectView<
::fidl::WireTableFrame<::test_placementofattributes::wire::ExampleTable>>
frame_ptr_;
};
} // namespace wire
} // namespace test_placementofattributes
template <typename BuilderImpl>
class ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable, BuilderImpl> {
public:
// Build and return the table. The builder should not be used after this.
::test_placementofattributes::wire::ExampleTable Build() {
ZX_DEBUG_ASSERT(table_.frame_ptr_ != nullptr);
::test_placementofattributes::wire::ExampleTable t = std::move(table_);
// Poison this builder to prevent accidental reuse.
table_.frame_ptr_ = nullptr;
return t;
}
BuilderImpl& member(uint32_t elem) {
ZX_DEBUG_ASSERT(table_.frame_ptr_ != nullptr);
table_.frame_ptr_->member_.set_data(std::move(elem));
table_.max_ordinal_ =
std::max(table_.max_ordinal_, static_cast<uint64_t>(1));
return *static_cast<BuilderImpl*>(this);
}
protected:
WireTableBaseBuilder(
::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>&& frame)
: table_(std::move(frame)) {}
private:
::test_placementofattributes::wire::ExampleTable table_;
};
template <>
class ::fidl::WireTableBuilder<::test_placementofattributes::wire::ExampleTable>
final : public ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>> {
using Base = ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>>;
public:
private:
friend class ::test_placementofattributes::wire::ExampleTable;
WireTableBuilder(::fidl::AnyArena& arena)
: Base(::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>(arena)),
arena_(arena) {}
[[maybe_unused]] std::reference_wrapper<::fidl::AnyArena> arena_;
};
template <>
class ::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>
final : public ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>> {
using Base = ::fidl::internal::WireTableBaseBuilder<
::test_placementofattributes::wire::ExampleTable,
::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>>;
private:
friend class ::test_placementofattributes::wire::ExampleTable;
using Base::Base;
WireTableExternalBuilder(
::fidl::WireTableFrame<::test_placementofattributes::wire::ExampleTable>*
frame)
: Base(::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>::
FromExternal(frame)) {}
};
namespace test_placementofattributes {
namespace wire {
inline ::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>
ExampleTable::Builder(::fidl::AnyArena& arena) {
return ::fidl::WireTableBuilder<
::test_placementofattributes::wire::ExampleTable>(arena);
}
inline ::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>
ExampleTable::ExternalBuilder(
::fidl::ObjectView<::fidl::WireTableFrame<
::test_placementofattributes::wire::ExampleTable>>
frame) {
return ::fidl::WireTableExternalBuilder<
::test_placementofattributes::wire::ExampleTable>(std::move(frame));
}
extern "C" const fidl_type_t test_placementofattributes_ExampleXUnionTable;
class ExampleXUnion {
public:
ExampleXUnion()
: ordinal_(::test_placementofattributes::wire::ExampleXUnion::Ordinal::
Invalid),
envelope_{} {}
ExampleXUnion(const ExampleXUnion&) = default;
ExampleXUnion& operator=(const ExampleXUnion&) = default;
ExampleXUnion(ExampleXUnion&&) = default;
ExampleXUnion& operator=(ExampleXUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kVariant = 1, // 0x1
kUnknown = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const {
return ordinal_ ==
::test_placementofattributes::wire::ExampleXUnion::Ordinal::Invalid;
}
bool is_variant() const {
return ordinal_ ==
::test_placementofattributes::wire::ExampleXUnion::Ordinal::kVariant;
}
static ExampleXUnion WithVariant(uint32_t val) {
ExampleXUnion result;
result.ordinal_ =
::test_placementofattributes::wire::ExampleXUnion::Ordinal::kVariant;
result.envelope_.As<uint32_t>().set_data(std::move(val));
return result;
}
uint32_t& variant() {
ZX_ASSERT(
ordinal_ ==
::test_placementofattributes::wire::ExampleXUnion::Ordinal::kVariant);
return envelope_.As<uint32_t>().get_data();
}
const uint32_t& variant() const {
ZX_ASSERT(
ordinal_ ==
::test_placementofattributes::wire::ExampleXUnion::Ordinal::kVariant);
return envelope_.As<uint32_t>().get_data();
}
::test_placementofattributes::wire::ExampleXUnion::Tag Which() const;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kVariant = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::test_placementofattributes::wire::ExampleXUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::UntypedEnvelope envelope_;
};
extern "C" const fidl_type_t test_placementofattributes_ExampleUnionTable;
class ExampleUnion {
public:
ExampleUnion()
: ordinal_(
::test_placementofattributes::wire::ExampleUnion::Ordinal::Invalid),
envelope_{} {}
ExampleUnion(const ExampleUnion&) = default;
ExampleUnion& operator=(const ExampleUnion&) = default;
ExampleUnion(ExampleUnion&&) = default;
ExampleUnion& operator=(ExampleUnion&&) = default;
enum class Tag : fidl_xunion_tag_t {
kVariant = 1, // 0x1
};
bool has_invalid_tag() const {
return ordinal_ ==
::test_placementofattributes::wire::ExampleUnion::Ordinal::Invalid;
}
bool is_variant() const {
return ordinal_ ==
::test_placementofattributes::wire::ExampleUnion::Ordinal::kVariant;
}
static ExampleUnion WithVariant(uint32_t val) {
ExampleUnion result;
result.ordinal_ =
::test_placementofattributes::wire::ExampleUnion::Ordinal::kVariant;
result.envelope_.As<uint32_t>().set_data(std::move(val));
return result;
}
uint32_t& variant() {
ZX_ASSERT(
ordinal_ ==
::test_placementofattributes::wire::ExampleUnion::Ordinal::kVariant);
return envelope_.As<uint32_t>().get_data();
}
const uint32_t& variant() const {
ZX_ASSERT(
ordinal_ ==
::test_placementofattributes::wire::ExampleUnion::Ordinal::kVariant);
return envelope_.As<uint32_t>().get_data();
}
::test_placementofattributes::wire::ExampleUnion::Tag Which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::test_placementofattributes::wire::ExampleUnion::Tag>(
ordinal_);
}
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kVariant = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::test_placementofattributes::wire::ExampleUnion::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::UntypedEnvelope envelope_;
};
constexpr uint32_t kExampleConst = 0u;
} // namespace wire
} // namespace test_placementofattributes
namespace fidl {
template <>
struct TypeTraits<::test_placementofattributes::wire::ExampleStruct> {
static constexpr const fidl_type_t* kType =
&::test_placementofattributes::wire::
test_placementofattributes_ExampleStructTable;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize = 4;
static constexpr uint32_t kPrimarySizeV1 = 4;
[[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr uint32_t kMaxOutOfLineV1 = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsFidlType<::test_placementofattributes::wire::ExampleStruct>
: public std::true_type {};
template <>
struct IsStruct<::test_placementofattributes::wire::ExampleStruct>
: public std::true_type {};
static_assert(std::is_standard_layout_v<
::test_placementofattributes::wire::ExampleStruct>);
static_assert(offsetof(::test_placementofattributes::wire::ExampleStruct,
member) == 0);
static_assert(sizeof(::test_placementofattributes::wire::ExampleStruct) ==
TypeTraits<::test_placementofattributes::wire::ExampleStruct>::
kPrimarySize);
template <>
struct TypeTraits<
::test_placementofattributes::wire::ExampleProtocolMethodRequest> {
static constexpr const fidl_type_t* kType =
&::test_placementofattributes::wire::
test_placementofattributes_ExampleProtocolMethodRequestTable;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize = 1;
static constexpr uint32_t kPrimarySizeV1 = 1;
[[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr uint32_t kMaxOutOfLineV1 = 0;
static constexpr bool kHasPointer = false;
};
template <>
struct IsFidlType<
::test_placementofattributes::wire::ExampleProtocolMethodRequest>
: public std::true_type {};
template <>
struct IsStruct<
::test_placementofattributes::wire::ExampleProtocolMethodRequest>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<
::test_placementofattributes::wire::ExampleProtocolMethodRequest>);
static_assert(
offsetof(::test_placementofattributes::wire::ExampleProtocolMethodRequest,
arg) == 0);
static_assert(
sizeof(::test_placementofattributes::wire::ExampleProtocolMethodRequest) ==
TypeTraits<::test_placementofattributes::wire::
ExampleProtocolMethodRequest>::kPrimarySize);
template <>
struct TypeTraits<::test_placementofattributes::wire::ExampleTable> {
static constexpr const fidl_type_t* kType =
&::test_placementofattributes::wire::
test_placementofattributes_ExampleTableTable;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kPrimarySizeV1 = 16;
[[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 8;
static constexpr uint32_t kMaxOutOfLineV1 = 24;
static constexpr bool kHasPointer = true;
};
template <>
struct IsFidlType<::test_placementofattributes::wire::ExampleTable>
: public std::true_type {};
template <>
struct IsTable<::test_placementofattributes::wire::ExampleTable>
: public std::true_type {};
static_assert(std::is_standard_layout_v<
::test_placementofattributes::wire::ExampleTable>);
template <>
struct TypeTraits<::test_placementofattributes::wire::ExampleXUnion> {
static constexpr const fidl_type_t* kType =
&::test_placementofattributes::wire::
test_placementofattributes_ExampleXUnionTable;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kPrimarySizeV1 = 24;
[[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr uint32_t kMaxOutOfLineV1 = 8;
static constexpr bool kHasPointer = true;
};
template <>
struct IsFidlType<::test_placementofattributes::wire::ExampleXUnion>
: public std::true_type {};
template <>
struct IsUnion<::test_placementofattributes::wire::ExampleXUnion>
: public std::true_type {};
static_assert(std::is_standard_layout_v<
::test_placementofattributes::wire::ExampleXUnion>);
template <>
struct TypeTraits<::test_placementofattributes::wire::ExampleUnion> {
static constexpr const fidl_type_t* kType =
&::test_placementofattributes::wire::
test_placementofattributes_ExampleUnionTable;
static constexpr uint32_t kMaxNumHandles = 0;
static constexpr uint32_t kPrimarySize = 16;
static constexpr uint32_t kPrimarySizeV1 = 24;
[[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0;
static constexpr uint32_t kMaxOutOfLineV1 = 8;
static constexpr bool kHasPointer = true;
};
template <>
struct IsFidlType<::test_placementofattributes::wire::ExampleUnion>
: public std::true_type {};
template <>
struct IsUnion<::test_placementofattributes::wire::ExampleUnion>
: public std::true_type {};
static_assert(std::is_standard_layout_v<
::test_placementofattributes::wire::ExampleUnion>);
} // namespace fidl