/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/visitation/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/visitation/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&); void EnumMetadata<::test_cpp2::cpp_reflection::enum1>::gen(ThriftMetadata& metadata) { auto res = metadata.enums()->emplace("module.enum1", ::apache::thrift::metadata::ThriftEnum{}); if (!res.second) { return; } ::apache::thrift::metadata::ThriftEnum& enum_metadata = res.first->second; enum_metadata.name() = "module.enum1"; using EnumTraits = TEnumTraits<::test_cpp2::cpp_reflection::enum1>; for (std::size_t i = 0; i != EnumTraits::size; ++i) { enum_metadata.elements()->emplace(static_cast(EnumTraits::values[i]), EnumTraits::names[i]); } } void EnumMetadata<::test_cpp2::cpp_reflection::enum2>::gen(ThriftMetadata& metadata) { auto res = metadata.enums()->emplace("module.enum2", ::apache::thrift::metadata::ThriftEnum{}); if (!res.second) { return; } ::apache::thrift::metadata::ThriftEnum& enum_metadata = res.first->second; enum_metadata.name() = "module.enum2"; using EnumTraits = TEnumTraits<::test_cpp2::cpp_reflection::enum2>; for (std::size_t i = 0; i != EnumTraits::size; ++i) { enum_metadata.elements()->emplace(static_cast(EnumTraits::values[i]), EnumTraits::names[i]); } } void EnumMetadata<::test_cpp2::cpp_reflection::enum3>::gen(ThriftMetadata& metadata) { auto res = metadata.enums()->emplace("module.enum3", ::apache::thrift::metadata::ThriftEnum{}); if (!res.second) { return; } ::apache::thrift::metadata::ThriftEnum& enum_metadata = res.first->second; enum_metadata.name() = "module.enum3"; using EnumTraits = TEnumTraits<::test_cpp2::cpp_reflection::enum3>; for (std::size_t i = 0; i != EnumTraits::size; ++i) { enum_metadata.elements()->emplace(static_cast(EnumTraits::values[i]), EnumTraits::names[i]); } } void EnumMetadata<::test_cpp2::cpp_reflection::enum_with_special_names>::gen(ThriftMetadata& metadata) { auto res = metadata.enums()->emplace("module.enum_with_special_names", ::apache::thrift::metadata::ThriftEnum{}); if (!res.second) { return; } ::apache::thrift::metadata::ThriftEnum& enum_metadata = res.first->second; enum_metadata.name() = "module.enum_with_special_names"; using EnumTraits = TEnumTraits<::test_cpp2::cpp_reflection::enum_with_special_names>; for (std::size_t i = 0; i != EnumTraits::size; ++i) { enum_metadata.elements()->emplace(static_cast(EnumTraits::values[i]), EnumTraits::names[i]); } } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::union1>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.union1", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_union1 = res.first->second; module_union1.name() = "module.union1"; module_union1.is_union() = true; static const auto* const module_union1_fields = new std::array{ { { 1, "ui", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "ud", false, std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector{ }}, { 3, "us", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 4, "ue", false, std::make_unique>("module.enum1"), std::vector{ }}, }}; for (const auto& f : *module_union1_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_union1.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::union2>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.union2", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_union2 = res.first->second; module_union2.name() = "module.union2"; module_union2.is_union() = true; static const auto* const module_union2_fields = new std::array{ { { 1, "ui_2", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "ud_2", false, std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector{ }}, { 3, "us_2", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 4, "ue_2", false, std::make_unique>("module.enum1"), std::vector{ }}, }}; for (const auto& f : *module_union2_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_union2.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::union3>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.union3", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_union3 = res.first->second; module_union3.name() = "module.union3"; module_union3.is_union() = true; static const auto* const module_union3_fields = new std::array{ { { 1, "ui_3", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "ud_3", false, std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector{ }}, { 3, "us_3", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 4, "ue_3", false, std::make_unique>("module.enum1"), std::vector{ }}, }}; for (const auto& f : *module_union3_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_union3.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::structA>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.structA", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_structA = res.first->second; module_structA.name() = "module.structA"; module_structA.is_union() = false; static const auto* const module_structA_fields = new std::array{ { { 1, "a", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "b", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, }}; for (const auto& f : *module_structA_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_structA.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::unionA>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.unionA", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_unionA = res.first->second; module_unionA.name() = "module.unionA"; module_unionA.is_union() = true; static const auto* const module_unionA_fields = new std::array{ { { 1, "i", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "d", false, std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector{ }}, { 3, "s", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 4, "e", false, std::make_unique>("module.enum1"), std::vector{ }}, { 5, "a", false, std::make_unique>("module.structA"), std::vector{ }}, }}; for (const auto& f : *module_unionA_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_unionA.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::structB>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.structB", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_structB = res.first->second; module_structB.name() = "module.structB"; module_structB.is_union() = false; static const auto* const module_structB_fields = new std::array{ { { 1, "c", false, std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector{ }}, { 2, "d", false, std::make_unique(ThriftPrimitiveType::THRIFT_BOOL_TYPE), std::vector{ }}, }}; for (const auto& f : *module_structB_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_structB.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::structC>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.structC", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_structC = res.first->second; module_structC.name() = "module.structC"; module_structC.is_union() = false; static const auto* const module_structC_fields = new std::array{ { { 1, "a", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "b", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 3, "c", false, std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector{ }}, { 4, "d", false, std::make_unique(ThriftPrimitiveType::THRIFT_BOOL_TYPE), std::vector{ }}, { 5, "e", false, std::make_unique>("module.enum1"), std::vector{ }}, { 6, "f", false, std::make_unique>("module.enum2"), std::vector{ }}, { 7, "g", false, std::make_unique>("module.union1"), std::vector{ }}, { 8, "h", false, std::make_unique>("module.unionA"), std::vector{ }}, { 9, "i", false, std::make_unique>("module.unionA"), std::vector{ }}, { 10, "j", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 11, "j1", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 12, "j2", false, std::make_unique(std::make_unique>("module.enum1")), std::vector{ }}, { 13, "j3", false, std::make_unique(std::make_unique>("module.structA")), std::vector{ }}, { 14, "k", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 15, "k1", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 16, "k2", false, std::make_unique(std::make_unique>("module.enum2")), std::vector{ }}, { 17, "k3", false, std::make_unique(std::make_unique>("module.structB")), std::vector{ }}, { 18, "l", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 19, "l1", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 20, "l2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique>("module.enum1")), std::vector{ }}, { 21, "l3", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique>("module.structB")), std::vector{ }}, { 22, "m1", false, std::make_unique(std::make_unique>("module.enum1"), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 23, "m2", false, std::make_unique(std::make_unique>("module.enum1"), std::make_unique>("module.enum2")), std::vector{ }}, { 24, "m3", false, std::make_unique(std::make_unique>("module.enum1"), std::make_unique>("module.structB")), std::vector{ }}, { 25, "n1", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 26, "n2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique>("module.enum1")), std::vector{ }}, { 27, "n3", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique>("module.structB")), std::vector{ }}, { 28, "o1", false, std::make_unique(std::make_unique>("module.structA"), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 29, "o2", false, std::make_unique(std::make_unique>("module.structA"), std::make_unique>("module.enum1")), std::vector{ }}, { 30, "o3", false, std::make_unique(std::make_unique>("module.structA"), std::make_unique>("module.structB")), std::vector{ }}, }}; for (const auto& f : *module_structC_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_structC.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct1>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct1", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct1 = res.first->second; module_struct1.name() = "module.struct1"; module_struct1.is_union() = false; static const auto* const module_struct1_fields = new std::array{ { { 1, "field0", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "field1", true, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 3, "field2", false, std::make_unique>("module.enum1"), std::vector{ }}, { 4, "field3", false, std::make_unique>("module.enum2"), std::vector{ }}, { 5, "field4", true, std::make_unique>("module.union1"), std::vector{ }}, { 6, "field5", false, std::make_unique>("module.union2"), std::vector{ }}, }}; for (const auto& f : *module_struct1_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_struct1.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct2>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct2", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct2 = res.first->second; module_struct2.name() = "module.struct2"; module_struct2.is_union() = false; static const auto* const module_struct2_fields = new std::array{ { { 1, "fieldA", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "fieldB", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 3, "fieldC", false, std::make_unique>("module.enum1"), std::vector{ }}, { 4, "fieldD", false, std::make_unique>("module.enum2"), std::vector{ }}, { 5, "fieldE", false, std::make_unique>("module.union1"), std::vector{ }}, { 6, "fieldF", false, std::make_unique>("module.union2"), std::vector{ }}, { 7, "fieldG", false, std::make_unique>("module.struct1"), std::vector{ }}, }}; for (const auto& f : *module_struct2_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_struct2.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct3>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct3", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct3 = res.first->second; module_struct3.name() = "module.struct3"; module_struct3.is_union() = false; static const auto* const module_struct3_fields = new std::array{ { { 1, "fieldA", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "fieldB", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 3, "fieldC", false, std::make_unique>("module.enum1"), std::vector{ }}, { 4, "fieldD", false, std::make_unique>("module.enum2"), std::vector{ }}, { 5, "fieldE", false, std::make_unique>("module.union1"), std::vector{ }}, { 6, "fieldF", false, std::make_unique>("module.union2"), std::vector{ }}, { 7, "fieldG", false, std::make_unique>("module.struct1"), std::vector{ }}, { 8, "fieldH", false, std::make_unique>("module.union2"), std::vector{ }}, { 9, "fieldI", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 10, "fieldJ", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }}, { 11, "fieldK", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }}, { 12, "fieldL", false, std::make_unique(std::make_unique>("module.structA")), std::vector{ }}, { 13, "fieldM", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 14, "fieldN", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }}, { 15, "fieldO", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{ }}, { 16, "fieldP", false, std::make_unique(std::make_unique>("module.structB")), std::vector{ }}, { 17, "fieldQ", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique>("module.structA")), std::vector{ }}, { 18, "fieldR", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique>("module.structB")), std::vector{ }}, }}; for (const auto& f : *module_struct3_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_struct3.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct4>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct4", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct4 = res.first->second; module_struct4.name() = "module.struct4"; module_struct4.is_union() = false; static const auto* const module_struct4_fields = new std::array{ { { 1, "field0", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "field1", true, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 3, "field2", false, std::make_unique>("module.enum1"), std::vector{ }}, { 6, "field3", false, std::make_unique>("module.structA"), std::vector{ *cvStruct("cpp.Ref", { {"type", cvInteger(0) } }).cv_struct_ref(), }}, }}; for (const auto& f : *module_struct4_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_struct4.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct5>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct5", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct5 = res.first->second; module_struct5.name() = "module.struct5"; module_struct5.is_union() = false; static const auto* const module_struct5_fields = new std::array{ { { 1, "field0", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "field1", true, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ }}, { 3, "field2", false, std::make_unique>("module.enum1"), std::vector{ }}, { 4, "field3", false, std::make_unique>("module.structA"), std::vector{ }}, { 5, "field4", false, std::make_unique>("module.structB"), std::vector{ }}, }}; for (const auto& f : *module_struct5_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_struct5.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct_binary>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct_binary", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct_binary = res.first->second; module_struct_binary.name() = "module.struct_binary"; module_struct_binary.is_union() = false; static const auto* const module_struct_binary_fields = new std::array{ { { 1, "bi", false, std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{ }}, }}; for (const auto& f : *module_struct_binary_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_struct_binary.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::dep_A_struct>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.dep_A_struct", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_dep_A_struct = res.first->second; module_dep_A_struct.name() = "module.dep_A_struct"; module_dep_A_struct.is_union() = false; static const auto* const module_dep_A_struct_fields = new std::array{ { { 1, "b", false, std::make_unique>("reflection_dep_B.dep_B_struct"), std::vector{ }}, { 2, "c", false, std::make_unique>("reflection_dep_C.dep_C_struct"), std::vector{ }}, { 3, "i_a", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, }}; for (const auto& f : *module_dep_A_struct_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_dep_A_struct.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::dep_B_struct>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.dep_B_struct", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_dep_B_struct = res.first->second; module_dep_B_struct.name() = "module.dep_B_struct"; module_dep_B_struct.is_union() = false; static const auto* const module_dep_B_struct_fields = new std::array{ { { 1, "b", false, std::make_unique>("reflection_dep_B.dep_B_struct"), std::vector{ }}, { 2, "c", false, std::make_unique>("reflection_dep_C.dep_C_struct"), std::vector{ }}, { 3, "i_a", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, }}; for (const auto& f : *module_dep_B_struct_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_dep_B_struct.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::annotated>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.annotated", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_annotated = res.first->second; module_annotated.name() = "module.annotated"; module_annotated.is_union() = false; static const auto* const module_annotated_fields = new std::array{ { { 1, "a", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, }}; for (const auto& f : *module_annotated_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_annotated.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::union_with_special_names>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.union_with_special_names", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_union_with_special_names = res.first->second; module_union_with_special_names.name() = "module.union_with_special_names"; module_union_with_special_names.is_union() = true; static const auto* const module_union_with_special_names_fields = new std::array{ { { 1, "get", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "getter", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 3, "lists", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 4, "maps", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 5, "name", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 6, "name_to_value", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 7, "names", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 8, "prefix_tree", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 9, "sets", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 10, "setter", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 11, "str", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 12, "strings", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 13, "type", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 14, "value", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 15, "value_to_name", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 16, "values", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 17, "id", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 18, "ids", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 19, "descriptor", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 20, "descriptors", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 21, "key", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 22, "keys", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 23, "annotation", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 24, "annotations", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 25, "member", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 26, "members", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 27, "field", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 28, "fields", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, }}; for (const auto& f : *module_union_with_special_names_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_union_with_special_names.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct_with_special_names>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct_with_special_names", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct_with_special_names = res.first->second; module_struct_with_special_names.name() = "module.struct_with_special_names"; module_struct_with_special_names.is_union() = false; static const auto* const module_struct_with_special_names_fields = new std::array{ { { 1, "get", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "getter", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 3, "lists", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 4, "maps", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 5, "name", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 6, "name_to_value", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 7, "names", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 8, "prefix_tree", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 9, "sets", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 10, "setter", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 11, "str", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 12, "strings", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 13, "type", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 14, "value", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 15, "value_to_name", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 16, "values", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 17, "id", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 18, "ids", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 19, "descriptor", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 20, "descriptors", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 21, "key", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 22, "keys", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 23, "annotation", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 24, "annotations", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 25, "member", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 26, "members", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 27, "field", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 28, "fields", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, }}; for (const auto& f : *module_struct_with_special_names_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_struct_with_special_names.fields()->push_back(std::move(field)); } return res.first->second; } const ::apache::thrift::metadata::ThriftStruct& StructMetadata<::test_cpp2::cpp_reflection::struct_with_indirections>::gen(ThriftMetadata& metadata) { auto res = metadata.structs()->emplace("module.struct_with_indirections", ::apache::thrift::metadata::ThriftStruct{}); if (!res.second) { return res.first->second; } ::apache::thrift::metadata::ThriftStruct& module_struct_with_indirections = res.first->second; module_struct_with_indirections.name() = "module.struct_with_indirections"; module_struct_with_indirections.is_union() = false; static const auto* const module_struct_with_indirections_fields = new std::array{ { { 1, "real", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 2, "fake", false, std::make_unique("module.FakeI32", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ *cvStruct("cpp.Type", { {"name", cvString("CppFakeI32") } }).cv_struct_ref(), }), std::vector{ }}, { 3, "number", false, std::make_unique("module.HasANumber", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ *cvStruct("cpp.Type", { {"name", cvString("CppHasANumber") } }).cv_struct_ref(), }), std::vector{ }}, { 4, "result", false, std::make_unique("module.HasAResult", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ *cvStruct("cpp.Type", { {"name", cvString("CppHasAResult") } }).cv_struct_ref(), }), std::vector{ }}, { 5, "phrase", false, std::make_unique("module.HasAPhrase", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{ *cvStruct("cpp.Type", { {"name", cvString("CppHasAPhrase") } }).cv_struct_ref(), }), std::vector{ }}, }}; for (const auto& f : *module_struct_with_indirections_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_struct_with_indirections.fields()->push_back(std::move(field)); } return res.first->second; } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method1([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "method1"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_VOID_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method2([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "method2"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_VOID_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service1_method2_x_1; module_service1_method2_x_1.id() = 1; module_service1_method2_x_1.name() = "x"; module_service1_method2_x_1.is_optional() = false; auto module_service1_method2_x_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service1_method2_x_1_type->writeAndGenType(*module_service1_method2_x_1.type(), metadata); func.arguments()->push_back(std::move(module_service1_method2_x_1)); ::apache::thrift::metadata::ThriftField module_service1_method2_y_2; module_service1_method2_y_2.id() = 2; module_service1_method2_y_2.name() = "y"; module_service1_method2_y_2.is_optional() = false; auto module_service1_method2_y_2_type = std::make_unique>("module.struct1"); module_service1_method2_y_2_type->writeAndGenType(*module_service1_method2_y_2.type(), metadata); func.arguments()->push_back(std::move(module_service1_method2_y_2)); ::apache::thrift::metadata::ThriftField module_service1_method2_z_3; module_service1_method2_z_3.id() = 3; module_service1_method2_z_3.name() = "z"; module_service1_method2_z_3.is_optional() = false; auto module_service1_method2_z_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service1_method2_z_3_type->writeAndGenType(*module_service1_method2_z_3.type(), metadata); func.arguments()->push_back(std::move(module_service1_method2_z_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method3([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "method3"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method4([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "method4"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service1_method4_i_1; module_service1_method4_i_1.id() = 1; module_service1_method4_i_1.name() = "i"; module_service1_method4_i_1.is_optional() = false; auto module_service1_method4_i_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service1_method4_i_1_type->writeAndGenType(*module_service1_method4_i_1.type(), metadata); func.arguments()->push_back(std::move(module_service1_method4_i_1)); ::apache::thrift::metadata::ThriftField module_service1_method4_j_2; module_service1_method4_j_2.id() = 2; module_service1_method4_j_2.name() = "j"; module_service1_method4_j_2.is_optional() = false; auto module_service1_method4_j_2_type = std::make_unique>("module.struct1"); module_service1_method4_j_2_type->writeAndGenType(*module_service1_method4_j_2.type(), metadata); func.arguments()->push_back(std::move(module_service1_method4_j_2)); ::apache::thrift::metadata::ThriftField module_service1_method4_k_3; module_service1_method4_k_3.id() = 3; module_service1_method4_k_3.name() = "k"; module_service1_method4_k_3.is_optional() = false; auto module_service1_method4_k_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service1_method4_k_3_type->writeAndGenType(*module_service1_method4_k_3.type(), metadata); func.arguments()->push_back(std::move(module_service1_method4_k_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method5([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "method5"; auto func_ret_type = std::make_unique>("module.struct2"); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method6([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "method6"; auto func_ret_type = std::make_unique>("module.struct2"); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service1_method6_l_1; module_service1_method6_l_1.id() = 1; module_service1_method6_l_1.name() = "l"; module_service1_method6_l_1.is_optional() = false; auto module_service1_method6_l_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service1_method6_l_1_type->writeAndGenType(*module_service1_method6_l_1.type(), metadata); func.arguments()->push_back(std::move(module_service1_method6_l_1)); ::apache::thrift::metadata::ThriftField module_service1_method6_m_2; module_service1_method6_m_2.id() = 2; module_service1_method6_m_2.name() = "m"; module_service1_method6_m_2.is_optional() = false; auto module_service1_method6_m_2_type = std::make_unique>("module.struct1"); module_service1_method6_m_2_type->writeAndGenType(*module_service1_method6_m_2.type(), metadata); func.arguments()->push_back(std::move(module_service1_method6_m_2)); ::apache::thrift::metadata::ThriftField module_service1_method6_n_3; module_service1_method6_n_3.id() = 3; module_service1_method6_n_3.name() = "n"; module_service1_method6_n_3.is_optional() = false; auto module_service1_method6_n_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service1_method6_n_3_type->writeAndGenType(*module_service1_method6_n_3.type(), metadata); func.arguments()->push_back(std::move(module_service1_method6_n_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen(::apache::thrift::metadata::ThriftServiceMetadataResponse& response) { const ::apache::thrift::metadata::ThriftServiceContextRef* self = genRecurse(*response.metadata(), *response.services()); DCHECK(self != nullptr); // TODO(praihan): Remove ThriftServiceContext from response. But in the meantime, we need to fill the field with the result of looking up in ThriftMetadata. ::apache::thrift::metadata::ThriftServiceContext context; context.module() = *self->module(); context.service_info() = response.metadata()->services()->at(*self->service_name()); response.context() = std::move(context); } const ThriftServiceContextRef* ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::genRecurse([[maybe_unused]] ThriftMetadata& metadata, std::vector& services) { ::apache::thrift::metadata::ThriftService module_service1; module_service1.name() = "module.service1"; static const ThriftFunctionGenerator functions[] = { ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method1, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method2, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method3, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method4, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method5, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen_method6, }; for (auto& function_gen : functions) { function_gen(metadata, module_service1); } // We need to keep the index around because a reference or iterator could be invalidated. auto selfIndex = services.size(); services.emplace_back(); ThriftServiceContextRef& context = services[selfIndex]; metadata.services()->emplace("module.service1", std::move(module_service1)); context.service_name() = "module.service1"; ::apache::thrift::metadata::ThriftModuleContext module; module.name() = "module"; context.module() = std::move(module); return &context; } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodA([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodA"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_VOID_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodB([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodB"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_VOID_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service2_methodB_x_1; module_service2_methodB_x_1.id() = 1; module_service2_methodB_x_1.name() = "x"; module_service2_methodB_x_1.is_optional() = false; auto module_service2_methodB_x_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service2_methodB_x_1_type->writeAndGenType(*module_service2_methodB_x_1.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodB_x_1)); ::apache::thrift::metadata::ThriftField module_service2_methodB_y_2; module_service2_methodB_y_2.id() = 2; module_service2_methodB_y_2.name() = "y"; module_service2_methodB_y_2.is_optional() = false; auto module_service2_methodB_y_2_type = std::make_unique>("module.struct1"); module_service2_methodB_y_2_type->writeAndGenType(*module_service2_methodB_y_2.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodB_y_2)); ::apache::thrift::metadata::ThriftField module_service2_methodB_z_3; module_service2_methodB_z_3.id() = 3; module_service2_methodB_z_3.name() = "z"; module_service2_methodB_z_3.is_optional() = false; auto module_service2_methodB_z_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service2_methodB_z_3_type->writeAndGenType(*module_service2_methodB_z_3.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodB_z_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodC([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodC"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodD([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodD"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service2_methodD_i_1; module_service2_methodD_i_1.id() = 1; module_service2_methodD_i_1.name() = "i"; module_service2_methodD_i_1.is_optional() = false; auto module_service2_methodD_i_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service2_methodD_i_1_type->writeAndGenType(*module_service2_methodD_i_1.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodD_i_1)); ::apache::thrift::metadata::ThriftField module_service2_methodD_j_2; module_service2_methodD_j_2.id() = 2; module_service2_methodD_j_2.name() = "j"; module_service2_methodD_j_2.is_optional() = false; auto module_service2_methodD_j_2_type = std::make_unique>("module.struct1"); module_service2_methodD_j_2_type->writeAndGenType(*module_service2_methodD_j_2.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodD_j_2)); ::apache::thrift::metadata::ThriftField module_service2_methodD_k_3; module_service2_methodD_k_3.id() = 3; module_service2_methodD_k_3.name() = "k"; module_service2_methodD_k_3.is_optional() = false; auto module_service2_methodD_k_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service2_methodD_k_3_type->writeAndGenType(*module_service2_methodD_k_3.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodD_k_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodE([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodE"; auto func_ret_type = std::make_unique>("module.struct2"); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodF([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodF"; auto func_ret_type = std::make_unique>("module.struct2"); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service2_methodF_l_1; module_service2_methodF_l_1.id() = 1; module_service2_methodF_l_1.name() = "l"; module_service2_methodF_l_1.is_optional() = false; auto module_service2_methodF_l_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service2_methodF_l_1_type->writeAndGenType(*module_service2_methodF_l_1.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodF_l_1)); ::apache::thrift::metadata::ThriftField module_service2_methodF_m_2; module_service2_methodF_m_2.id() = 2; module_service2_methodF_m_2.name() = "m"; module_service2_methodF_m_2.is_optional() = false; auto module_service2_methodF_m_2_type = std::make_unique>("module.struct1"); module_service2_methodF_m_2_type->writeAndGenType(*module_service2_methodF_m_2.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodF_m_2)); ::apache::thrift::metadata::ThriftField module_service2_methodF_n_3; module_service2_methodF_n_3.id() = 3; module_service2_methodF_n_3.name() = "n"; module_service2_methodF_n_3.is_optional() = false; auto module_service2_methodF_n_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service2_methodF_n_3_type->writeAndGenType(*module_service2_methodF_n_3.type(), metadata); func.arguments()->push_back(std::move(module_service2_methodF_n_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen(::apache::thrift::metadata::ThriftServiceMetadataResponse& response) { const ::apache::thrift::metadata::ThriftServiceContextRef* self = genRecurse(*response.metadata(), *response.services()); DCHECK(self != nullptr); // TODO(praihan): Remove ThriftServiceContext from response. But in the meantime, we need to fill the field with the result of looking up in ThriftMetadata. ::apache::thrift::metadata::ThriftServiceContext context; context.module() = *self->module(); context.service_info() = response.metadata()->services()->at(*self->service_name()); response.context() = std::move(context); } const ThriftServiceContextRef* ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::genRecurse([[maybe_unused]] ThriftMetadata& metadata, std::vector& services) { ::apache::thrift::metadata::ThriftService module_service2; module_service2.name() = "module.service2"; static const ThriftFunctionGenerator functions[] = { ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodA, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodB, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodC, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodD, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodE, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service2>>::gen_methodF, }; for (auto& function_gen : functions) { function_gen(metadata, module_service2); } // We need to keep the index around because a reference or iterator could be invalidated. auto selfIndex = services.size(); services.emplace_back(); ThriftServiceContextRef& context = services[selfIndex]; metadata.services()->emplace("module.service2", std::move(module_service2)); context.service_name() = "module.service2"; ::apache::thrift::metadata::ThriftModuleContext module; module.name() = "module"; context.module() = std::move(module); return &context; } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodA([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodA"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_VOID_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodB([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodB"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_VOID_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service3_methodB_x_1; module_service3_methodB_x_1.id() = 1; module_service3_methodB_x_1.name() = "x"; module_service3_methodB_x_1.is_optional() = false; auto module_service3_methodB_x_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service3_methodB_x_1_type->writeAndGenType(*module_service3_methodB_x_1.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodB_x_1)); ::apache::thrift::metadata::ThriftField module_service3_methodB_y_2; module_service3_methodB_y_2.id() = 2; module_service3_methodB_y_2.name() = "y"; module_service3_methodB_y_2.is_optional() = false; auto module_service3_methodB_y_2_type = std::make_unique>("module.struct1"); module_service3_methodB_y_2_type->writeAndGenType(*module_service3_methodB_y_2.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodB_y_2)); ::apache::thrift::metadata::ThriftField module_service3_methodB_z_3; module_service3_methodB_z_3.id() = 3; module_service3_methodB_z_3.name() = "z"; module_service3_methodB_z_3.is_optional() = false; auto module_service3_methodB_z_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service3_methodB_z_3_type->writeAndGenType(*module_service3_methodB_z_3.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodB_z_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodC([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodC"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodD([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodD"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service3_methodD_i_1; module_service3_methodD_i_1.id() = 1; module_service3_methodD_i_1.name() = "i"; module_service3_methodD_i_1.is_optional() = false; auto module_service3_methodD_i_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service3_methodD_i_1_type->writeAndGenType(*module_service3_methodD_i_1.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodD_i_1)); ::apache::thrift::metadata::ThriftField module_service3_methodD_j_2; module_service3_methodD_j_2.id() = 2; module_service3_methodD_j_2.name() = "j"; module_service3_methodD_j_2.is_optional() = false; auto module_service3_methodD_j_2_type = std::make_unique>("module.struct1"); module_service3_methodD_j_2_type->writeAndGenType(*module_service3_methodD_j_2.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodD_j_2)); ::apache::thrift::metadata::ThriftField module_service3_methodD_k_3; module_service3_methodD_k_3.id() = 3; module_service3_methodD_k_3.name() = "k"; module_service3_methodD_k_3.is_optional() = false; auto module_service3_methodD_k_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service3_methodD_k_3_type->writeAndGenType(*module_service3_methodD_k_3.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodD_k_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodE([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodE"; auto func_ret_type = std::make_unique>("module.struct2"); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodF([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "methodF"; auto func_ret_type = std::make_unique>("module.struct3"); func_ret_type->writeAndGenType(*func.return_type(), metadata); ::apache::thrift::metadata::ThriftField module_service3_methodF_l_1; module_service3_methodF_l_1.id() = 1; module_service3_methodF_l_1.name() = "l"; module_service3_methodF_l_1.is_optional() = false; auto module_service3_methodF_l_1_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); module_service3_methodF_l_1_type->writeAndGenType(*module_service3_methodF_l_1.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodF_l_1)); ::apache::thrift::metadata::ThriftField module_service3_methodF_m_2; module_service3_methodF_m_2.id() = 2; module_service3_methodF_m_2.name() = "m"; module_service3_methodF_m_2.is_optional() = false; auto module_service3_methodF_m_2_type = std::make_unique>("module.struct1"); module_service3_methodF_m_2_type->writeAndGenType(*module_service3_methodF_m_2.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodF_m_2)); ::apache::thrift::metadata::ThriftField module_service3_methodF_n_3; module_service3_methodF_n_3.id() = 3; module_service3_methodF_n_3.name() = "n"; module_service3_methodF_n_3.is_optional() = false; auto module_service3_methodF_n_3_type = std::make_unique(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE); module_service3_methodF_n_3_type->writeAndGenType(*module_service3_methodF_n_3.type(), metadata); func.arguments()->push_back(std::move(module_service3_methodF_n_3)); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen(::apache::thrift::metadata::ThriftServiceMetadataResponse& response) { const ::apache::thrift::metadata::ThriftServiceContextRef* self = genRecurse(*response.metadata(), *response.services()); DCHECK(self != nullptr); // TODO(praihan): Remove ThriftServiceContext from response. But in the meantime, we need to fill the field with the result of looking up in ThriftMetadata. ::apache::thrift::metadata::ThriftServiceContext context; context.module() = *self->module(); context.service_info() = response.metadata()->services()->at(*self->service_name()); response.context() = std::move(context); } const ThriftServiceContextRef* ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::genRecurse([[maybe_unused]] ThriftMetadata& metadata, std::vector& services) { ::apache::thrift::metadata::ThriftService module_service3; module_service3.name() = "module.service3"; static const ThriftFunctionGenerator functions[] = { ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodA, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodB, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodC, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodD, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodE, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen_methodF, }; for (auto& function_gen : functions) { function_gen(metadata, module_service3); } // We need to keep the index around because a reference or iterator could be invalidated. auto selfIndex = services.size(); services.emplace_back(); ThriftServiceContextRef& context = services[selfIndex]; metadata.services()->emplace("module.service3", std::move(module_service3)); context.service_name() = "module.service3"; ::apache::thrift::metadata::ThriftModuleContext module; module.name() = "module"; context.module() = std::move(module); return &context; } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_get([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "get"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_getter([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "getter"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_lists([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "lists"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_maps([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "maps"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_name([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "name"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_name_to_value([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "name_to_value"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_names([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "names"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_prefix_tree([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "prefix_tree"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_sets([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "sets"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_setter([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "setter"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_str([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "str"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_strings([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "strings"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_type([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "type"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_value([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "value"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_value_to_name([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "value_to_name"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_values([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "values"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_id([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "id"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_ids([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "ids"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_descriptor([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "descriptor"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_descriptors([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "descriptors"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_key([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "key"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_keys([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "keys"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_annotation([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "annotation"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_annotations([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "annotations"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_member([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "member"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_members([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "members"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_field([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "field"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_fields([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) { ::apache::thrift::metadata::ThriftFunction func; func.name() = "fields"; auto func_ret_type = std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE); func_ret_type->writeAndGenType(*func.return_type(), metadata); func.is_oneway() = false; service.functions()->push_back(std::move(func)); } void ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen(::apache::thrift::metadata::ThriftServiceMetadataResponse& response) { const ::apache::thrift::metadata::ThriftServiceContextRef* self = genRecurse(*response.metadata(), *response.services()); DCHECK(self != nullptr); // TODO(praihan): Remove ThriftServiceContext from response. But in the meantime, we need to fill the field with the result of looking up in ThriftMetadata. ::apache::thrift::metadata::ThriftServiceContext context; context.module() = *self->module(); context.service_info() = response.metadata()->services()->at(*self->service_name()); response.context() = std::move(context); } const ThriftServiceContextRef* ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::genRecurse([[maybe_unused]] ThriftMetadata& metadata, std::vector& services) { ::apache::thrift::metadata::ThriftService module_service_with_special_names; module_service_with_special_names.name() = "module.service_with_special_names"; static const ThriftFunctionGenerator functions[] = { ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_get, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_getter, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_lists, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_maps, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_name, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_name_to_value, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_names, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_prefix_tree, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_sets, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_setter, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_str, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_strings, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_type, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_value, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_value_to_name, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_values, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_id, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_ids, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_descriptor, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_descriptors, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_key, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_keys, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_annotation, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_annotations, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_member, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_members, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_field, ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service_with_special_names>>::gen_fields, }; for (auto& function_gen : functions) { function_gen(metadata, module_service_with_special_names); } // We need to keep the index around because a reference or iterator could be invalidated. auto selfIndex = services.size(); services.emplace_back(); ThriftServiceContextRef& context = services[selfIndex]; metadata.services()->emplace("module.service_with_special_names", std::move(module_service_with_special_names)); context.service_name() = "module.service_with_special_names"; ::apache::thrift::metadata::ThriftModuleContext module; module.name() = "module"; context.module() = std::move(module); return &context; } } // namespace md } // namespace detail } // namespace thrift } // namespace apache