blob: 9d66771b5db68c682fbaf7fad6e5dfb216b298f5 [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/buffer_allocator.h>
#include <lib/fidl/llcpp/buffer_then_heap_allocator.h>
#include <lib/fidl/llcpp/coding.h>
#include <lib/fidl/llcpp/envelope.h>
#include <lib/fidl/llcpp/errors.h>
#include <lib/fidl/llcpp/memory.h>
#include <lib/fidl/llcpp/message.h>
#include <lib/fidl/llcpp/message_storage.h>
#include <lib/fidl/llcpp/string_view.h>
#include <lib/fidl/llcpp/tracking_ptr.h>
#include <lib/fidl/llcpp/traits.h>
#include <lib/fidl/llcpp/vector_view.h>
#include <lib/fit/function.h>
#include <lib/fit/optional.h>
#include <variant>
#ifdef __Fuchsia__
#include <lib/fidl/llcpp/client.h>
#include <lib/fidl/llcpp/connect_service.h>
#include <lib/fidl/llcpp/result.h>
#include <lib/fidl/llcpp/server.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/txn_header.h>
#endif // __Fuchsia__
#include <zircon/fidl.h>
namespace llcpp {
namespace fidl {
namespace test {
namespace consts {
enum class EnumType : int32_t {
VALUE = 1u,
true_ = 2u,
};
// |BitsType| is strict, hence is guaranteed to only contain
// members defined in the FIDL schema when receiving it in a message.
// Sending unknown members will fail at runtime.
class BitsType final {
public:
constexpr BitsType() = default;
constexpr BitsType(const BitsType& other) = default;
// Constructs an instance of |BitsType| from an underlying primitive value,
// preserving any bit member not defined in the FIDL schema.
explicit constexpr BitsType(uint32_t value) : value_(value) {}
const static BitsType VALUE;
const static BitsType true_;
const static BitsType kMask;
explicit constexpr inline operator uint32_t() const { return value_; }
explicit constexpr inline operator bool() const {
return static_cast<bool>(value_);
}
constexpr inline bool operator==(const BitsType& other) const {
return value_ == other.value_;
}
constexpr inline bool operator!=(const BitsType& other) const {
return value_ != other.value_;
}
constexpr inline BitsType operator~() const;
constexpr inline BitsType operator|(const BitsType& other) const;
constexpr inline BitsType operator&(const BitsType& other) const;
constexpr inline BitsType operator^(const BitsType& other) const;
constexpr inline void operator|=(const BitsType& other);
constexpr inline void operator&=(const BitsType& other);
constexpr inline void operator^=(const BitsType& other);
// Constructs an instance of |BitsType| from an underlying primitive value
// if the primitive does not contain any unknown members not defined in the
// FIDL schema. Otherwise, returns |fit::nullopt|.
constexpr inline static fit::optional<BitsType> TryFrom(uint32_t value) {
if (value & ~kMask.value_) {
return fit::nullopt;
}
return BitsType(value & BitsType::kMask.value_);
}
// Constructs an instance of |BitsType| from an underlying primitive value,
// clearing any bit member not defined in the FIDL schema.
constexpr inline static BitsType TruncatingUnknown(uint32_t value) {
return BitsType(value & BitsType::kMask.value_);
}
private:
uint32_t value_ = 0;
};
constexpr const ::llcpp::fidl::test::consts::BitsType BitsType::VALUE =
::llcpp::fidl::test::consts::BitsType(1u);
constexpr const ::llcpp::fidl::test::consts::BitsType BitsType::true_ =
::llcpp::fidl::test::consts::BitsType(2u);
constexpr const ::llcpp::fidl::test::consts::BitsType BitsType::kMask =
::llcpp::fidl::test::consts::BitsType(3u);
constexpr inline ::llcpp::fidl::test::consts::BitsType BitsType::operator~()
const {
return ::llcpp::fidl::test::consts::BitsType(
static_cast<uint32_t>(~this->value_ & kMask.value_));
}
constexpr inline ::llcpp::fidl::test::consts::BitsType BitsType::operator|(
const ::llcpp::fidl::test::consts::BitsType& other) const {
return ::llcpp::fidl::test::consts::BitsType(
static_cast<uint32_t>(this->value_ | other.value_));
}
constexpr inline ::llcpp::fidl::test::consts::BitsType BitsType::operator&(
const ::llcpp::fidl::test::consts::BitsType& other) const {
return ::llcpp::fidl::test::consts::BitsType(
static_cast<uint32_t>(this->value_ & other.value_));
}
constexpr inline ::llcpp::fidl::test::consts::BitsType BitsType::operator^(
const ::llcpp::fidl::test::consts::BitsType& other) const {
return ::llcpp::fidl::test::consts::BitsType(
static_cast<uint32_t>(this->value_ ^ other.value_));
}
constexpr inline void BitsType::operator|=(
const ::llcpp::fidl::test::consts::BitsType& other) {
this->value_ |= other.value_;
}
constexpr inline void BitsType::operator&=(
const ::llcpp::fidl::test::consts::BitsType& other) {
this->value_ &= other.value_;
}
constexpr inline void BitsType::operator^=(
const ::llcpp::fidl::test::consts::BitsType& other) {
this->value_ ^= other.value_;
}
extern const char USERNAME[];
constexpr uint32_t POPULATION_USA_2018 = 330000000u;
constexpr int8_t OFFSET = -33;
constexpr float MIN_TEMP = -273.15f;
constexpr uint64_t FUCHSIA = 4054509061583223046u;
constexpr ::llcpp::fidl::test::consts::EnumType enumVal = EnumType::VALUE;
constexpr ::llcpp::fidl::test::consts::EnumType enumTrue = EnumType::true_;
constexpr int32_t enumPrimitiveVal = EnumType::VALUE;
constexpr int32_t enumPrimitiveTrue = EnumType::true_;
constexpr bool ENABLED_FLAG = true;
constexpr uint64_t DIAMOND = 1746410393481133080u;
constexpr double CONVERSION_FACTOR = 1.41421;
constexpr ::llcpp::fidl::test::consts::BitsType bitsVal = BitsType::VALUE;
constexpr ::llcpp::fidl::test::consts::BitsType bitsTrue = BitsType::true_;
constexpr int32_t bitsPrimitiveVal = BitsType::VALUE;
constexpr int32_t bitsPrimitiveTrue = BitsType::true_;
constexpr uint16_t ANSWER_IN_BINARY = 42u;
constexpr uint16_t ANSWER = 42u;
} // namespace consts
} // namespace test
} // namespace fidl
} // namespace llcpp
namespace fidl {
template <>
struct IsFidlType<::llcpp::fidl::test::consts::EnumType>
: public std::true_type {};
template <>
struct IsFidlType<::llcpp::fidl::test::consts::BitsType>
: public std::true_type {};
static_assert(std::is_standard_layout_v<::llcpp::fidl::test::consts::BitsType>);
static_assert(sizeof(::llcpp::fidl::test::consts::BitsType) ==
sizeof(uint32_t));
} // namespace fidl
namespace llcpp {
namespace fidl {
namespace test {
namespace consts {} // namespace consts
} // namespace test
} // namespace fidl
} // namespace llcpp