blob: 416cdcfcba8ce94f1a8af30ad855138c17636a4f [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = output_index_json
#pragma once
#include <fidl/test.consts/cpp/common_types.h>
#include <fidl/test.consts/cpp/markers.h>
#include <lib/fidl/cpp/natural_coding_traits.h>
#include <lib/fidl/cpp/natural_types.h>
#include <cinttypes>
#include <string>
#ifdef __Fuchsia__
#endif // __Fuchsia__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
namespace test_consts {
constexpr bool kEnabledFlag = true;
constexpr int8_t kOffset = -33;
constexpr uint16_t kAnswer = 42u;
constexpr uint8_t kAnswerNarrowed = ::test_consts::kAnswer;
constexpr uint16_t kAnswerInBinary = 42u;
constexpr uint32_t kPopulationUsa2018 = 330000000u;
constexpr uint64_t kDiamond = 1746410393481133080u;
constexpr uint64_t kFuchsia = 4054509061583223046u;
extern const char* kUsername;
constexpr float kMinTemp = -273.15f;
constexpr double kConversionFactor = 1.41421;
constexpr zx_obj_type_t kZxObjVal = ZX_OBJ_TYPE_CHANNEL;
constexpr zx_rights_t kZxRightsVal = ZX_RIGHT_READ;
constexpr uint64_t kZxConst = ZX_CHANNEL_MAX_MSG_BYTES;
constexpr ::test_consts::EnumType kEnumVal = ::test_consts::EnumType::kValue;
constexpr int32_t kEnumPrimitiveVal = ::test_consts::EnumType::kValue;
constexpr int8_t kEnumPrimitiveValNarrowed = ::test_consts::EnumType::kValue;
constexpr ::test_consts::EnumType kEnumTrue = ::test_consts::EnumType::kTrue;
constexpr int32_t kEnumPrimitiveTrue = ::test_consts::EnumType::kTrue;
constexpr ::test_consts::BitsType kBitsVal = ::test_consts::BitsType::kValue;
constexpr uint32_t kBitsPrimitiveVal = ::test_consts::BitsType::kValue;
constexpr uint8_t kBitsPrimitiveValNarrowed = ::test_consts::BitsType::kValue;
constexpr ::test_consts::BitsType kBitsTrue = ::test_consts::BitsType::kTrue;
constexpr uint32_t kBitsPrimitiveTrue = ::test_consts::BitsType::kTrue;
} // namespace test_consts
namespace fidl {
template <>
struct internal::NaturalCodingTraits<::test_consts::BitsType, ::fidl::internal::NaturalCodingConstraintEmpty> {
static constexpr size_t kInlineSize = sizeof(uint32_t);
static constexpr bool kIsMemcpyCompatible = false;
static void Encode(internal::NaturalEncoder* encoder, ::test_consts::BitsType* value, size_t offset, size_t recursion_depth) {
if (unlikely(static_cast<uint32_t>(*value) & ~3ull)) {
encoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue);
}
*encoder->template GetPtr<::test_consts::BitsType>(offset) = *value;
}
static void Decode(internal::NaturalDecoder* decoder, ::test_consts::BitsType* value, size_t offset, size_t recursion_depth) {
*value = *decoder->template GetPtr<::test_consts::BitsType>(offset);
if (unlikely(static_cast<uint32_t>(*value) & ~3ull)) {
decoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue);
}
}
};
template <>
struct internal::NaturalCodingTraits<::test_consts::EnumType, ::fidl::internal::NaturalCodingConstraintEmpty> {
static constexpr size_t kInlineSize = sizeof(int32_t);
static constexpr bool kIsMemcpyCompatible = false;
static void Encode(internal::NaturalEncoder* encoder, ::test_consts::EnumType* value, size_t offset, size_t recursion_depth) {
switch (*value) {
case ::test_consts::EnumType::kValue:
case ::test_consts::EnumType::kTrue:
break;
default:
encoder->SetError(::fidl::internal::kCodingErrorUnknownEnumValue);
return;
}
*encoder->template GetPtr<::test_consts::EnumType>(offset) = *value;
}
static void Decode(internal::NaturalDecoder* decoder, ::test_consts::EnumType* value, size_t offset, size_t recursion_depth) {
*value = *decoder->template GetPtr<::test_consts::EnumType>(offset);
switch (*value) {
case ::test_consts::EnumType::kValue:
case ::test_consts::EnumType::kTrue:
break;
default:
decoder->SetError(::fidl::internal::kCodingErrorUnknownEnumValue);
return;
}
}
};
#pragma clang diagnostic pop
} // namespace fidl