| // 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> |
| |
| #endif // __Fuchsia__ |
| #include <zircon/fidl.h> |
| |
| namespace fidl_test_consts { |
| namespace wire { |
| |
| enum class EnumType : int32_t { |
| |
| kValue = 1u, |
| |
| kTrue = 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 kValue; |
| const static BitsType kTrue; |
| 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 |cpp17::nullopt|. |
| constexpr inline static cpp17::optional<BitsType> TryFrom(uint32_t value) { |
| if (value & ~kMask.value_) { |
| return cpp17::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 ::fidl_test_consts::wire::BitsType BitsType::kValue = |
| ::fidl_test_consts::wire::BitsType(1u); |
| constexpr const ::fidl_test_consts::wire::BitsType BitsType::kTrue = |
| ::fidl_test_consts::wire::BitsType(2u); |
| constexpr const ::fidl_test_consts::wire::BitsType BitsType::kMask = |
| ::fidl_test_consts::wire::BitsType(3u); |
| |
| constexpr inline ::fidl_test_consts::wire::BitsType BitsType::operator~() |
| const { |
| return ::fidl_test_consts::wire::BitsType( |
| static_cast<uint32_t>(~this->value_ & kMask.value_)); |
| } |
| |
| constexpr inline ::fidl_test_consts::wire::BitsType BitsType::operator|( |
| const ::fidl_test_consts::wire::BitsType& other) const { |
| return ::fidl_test_consts::wire::BitsType( |
| static_cast<uint32_t>(this->value_ | other.value_)); |
| } |
| |
| constexpr inline ::fidl_test_consts::wire::BitsType BitsType::operator&( |
| const ::fidl_test_consts::wire::BitsType& other) const { |
| return ::fidl_test_consts::wire::BitsType( |
| static_cast<uint32_t>(this->value_ & other.value_)); |
| } |
| |
| constexpr inline ::fidl_test_consts::wire::BitsType BitsType::operator^( |
| const ::fidl_test_consts::wire::BitsType& other) const { |
| return ::fidl_test_consts::wire::BitsType( |
| static_cast<uint32_t>(this->value_ ^ other.value_)); |
| } |
| |
| constexpr inline void BitsType::operator|=( |
| const ::fidl_test_consts::wire::BitsType& other) { |
| this->value_ |= other.value_; |
| } |
| |
| constexpr inline void BitsType::operator&=( |
| const ::fidl_test_consts::wire::BitsType& other) { |
| this->value_ &= other.value_; |
| } |
| |
| constexpr inline void BitsType::operator^=( |
| const ::fidl_test_consts::wire::BitsType& other) { |
| this->value_ ^= other.value_; |
| } |
| |
| extern const char* kUsername; |
| |
| constexpr uint32_t kPopulationUsa2018 = 330000000u; |
| |
| constexpr int8_t kOffset = -33; |
| |
| constexpr float kMinTemp = -273.15f; |
| |
| constexpr uint64_t kFuchsia = 4054509061583223046u; |
| |
| constexpr ::fidl_test_consts::wire::EnumType kEnumVal = |
| ::fidl_test_consts::wire::EnumType::kValue; |
| |
| constexpr ::fidl_test_consts::wire::EnumType kEnumTrue = |
| ::fidl_test_consts::wire::EnumType::kTrue; |
| |
| constexpr int32_t kEnumPrimitiveVal = |
| ::fidl_test_consts::wire::EnumType::kValue; |
| |
| constexpr int32_t kEnumPrimitiveTrue = |
| ::fidl_test_consts::wire::EnumType::kTrue; |
| |
| constexpr bool kEnabledFlag = true; |
| |
| constexpr uint64_t kDiamond = 1746410393481133080u; |
| |
| constexpr double kConversionFactor = 1.41421; |
| |
| constexpr ::fidl_test_consts::wire::BitsType kBitsVal = |
| ::fidl_test_consts::wire::BitsType::kValue; |
| |
| constexpr ::fidl_test_consts::wire::BitsType kBitsTrue = |
| ::fidl_test_consts::wire::BitsType::kTrue; |
| |
| constexpr int32_t kBitsPrimitiveVal = |
| ::fidl_test_consts::wire::BitsType::kValue; |
| |
| constexpr int32_t kBitsPrimitiveTrue = |
| ::fidl_test_consts::wire::BitsType::kTrue; |
| |
| constexpr uint16_t kAnswerInBinary = 42u; |
| |
| constexpr uint16_t kAnswer = 42u; |
| |
| } // namespace wire |
| } // namespace fidl_test_consts |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::fidl_test_consts::wire::EnumType> : public std::true_type { |
| }; |
| |
| template <> |
| struct IsFidlType<::fidl_test_consts::wire::BitsType> : public std::true_type { |
| }; |
| static_assert(std::is_standard_layout_v<::fidl_test_consts::wire::BitsType>); |
| static_assert(sizeof(::fidl_test_consts::wire::BitsType) == sizeof(uint32_t)); |
| |
| } // namespace fidl |