/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/complex-union/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include #include "thrift/compiler/test/fixtures/complex-union/gen-cpp2/module_metadata.h" // some of these functions can be so large that the compiler gives up optimizing // them - and issues a warning which may be treated as an error! // // these functions are so rarely called that it is probably okay for them not to // be optimized in practice FOLLY_CLANG_DISABLE_WARNING("-Wignored-optimization-argument") namespace apache { namespace thrift { namespace detail { namespace md { using ThriftMetadata = ::apache::thrift::metadata::ThriftMetadata; using ThriftPrimitiveType = ::apache::thrift::metadata::ThriftPrimitiveType; using ThriftType = ::apache::thrift::metadata::ThriftType; using ThriftService = ::apache::thrift::metadata::ThriftService; using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext; using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&); const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::ComplexUnion>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.ComplexUnion", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_ComplexUnion = res.first->second; module_ComplexUnion.name() = "module.ComplexUnion"; module_ComplexUnion.is_union() = true; static const auto* const module_ComplexUnion_fields = new std::array{ { { 1, "intValue", false, std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{ }}, { 5, "stringValue", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 2, "intListValue", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{ }}, { 3, "stringListValue", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }}, { 9, "typedefValue", false, std::make_unique("module.containerTypedef", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I16_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }), std::vector{ }}, { 14, "stringRef", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ *cvStruct("cpp.Ref", { {"type", cvInteger(0) } }).cv_struct_ref(), }}, }}; for (const auto& f : *module_ComplexUnion_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_ComplexUnion.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::ListUnion>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.ListUnion", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_ListUnion = res.first->second; module_ListUnion.name() = "module.ListUnion"; module_ListUnion.is_union() = true; static const auto* const module_ListUnion_fields = new std::array{ { { 2, "intListValue", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{ }}, { 3, "stringListValue", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }}, }}; for (const auto& f : *module_ListUnion_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_ListUnion.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::DataUnion>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.DataUnion", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_DataUnion = res.first->second; module_DataUnion.name() = "module.DataUnion"; module_DataUnion.is_union() = true; static const auto* const module_DataUnion_fields = new std::array{ { { 1, "binaryData", false, std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{ }}, { 2, "stringData", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, }}; for (const auto& f : *module_DataUnion_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_DataUnion.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::Val>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.Val", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_Val = res.first->second; module_Val.name() = "module.Val"; module_Val.is_union() = false; static const auto* const module_Val_fields = new std::array{ { { 1, "strVal", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 2, "intVal", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 9, "typedefValue", false, std::make_unique("module.containerTypedef", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I16_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }), std::vector{ }}, }}; for (const auto& f : *module_Val_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_Val.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::ValUnion>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.ValUnion", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_ValUnion = res.first->second; module_ValUnion.name() = "module.ValUnion"; module_ValUnion.is_union() = true; static const auto* const module_ValUnion_fields = new std::array{ { { 1, "v1", false, std::make_unique>("module.Val"), std::vector{ }}, { 2, "v2", false, std::make_unique>("module.Val"), std::vector{ }}, }}; for (const auto& f : *module_ValUnion_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_ValUnion.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::VirtualComplexUnion>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.VirtualComplexUnion", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_VirtualComplexUnion = res.first->second; module_VirtualComplexUnion.name() = "module.VirtualComplexUnion"; module_VirtualComplexUnion.is_union() = true; static const auto* const module_VirtualComplexUnion_fields = new std::array{ { { 1, "thingOne", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 2, "thingTwo", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, }}; for (const auto& f : *module_VirtualComplexUnion_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_VirtualComplexUnion.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::NonCopyableStruct>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.NonCopyableStruct", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_NonCopyableStruct = res.first->second; module_NonCopyableStruct.name() = "module.NonCopyableStruct"; module_NonCopyableStruct.is_union() = false; static const auto* const module_NonCopyableStruct_fields = new std::array{ { { 1, "num", false, std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{ }}, }}; for (const auto& f : *module_NonCopyableStruct_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_NonCopyableStruct.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::cpp2::NonCopyableUnion>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.NonCopyableUnion", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_NonCopyableUnion = res.first->second; module_NonCopyableUnion.name() = "module.NonCopyableUnion"; module_NonCopyableUnion.is_union() = true; static const auto* const module_NonCopyableUnion_fields = new std::array{ { { 1, "s", false, std::make_unique>("module.NonCopyableStruct"), std::vector{ }}, }}; for (const auto& f : *module_NonCopyableUnion_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; field.name() = f.name; field.is_optional() = f.is_optional; f.metadata_type_interface->writeAndGenType(*field.type(), metadata); field.structured_annotations() = f.structured_annotations; module_NonCopyableUnion.fields()->push_back(std::move(field)); } return res.first->second; } } // namespace md } // namespace detail } // namespace thrift } // namespace apache