|
| 1 | +/** |
| 2 | + * Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift |
| 3 | + * |
| 4 | + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| 5 | + * @generated @nocommit |
| 6 | + */ |
| 7 | +#include <thrift/lib/cpp2/gen/module_metadata_cpp.h> |
| 8 | +#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_metadata.h" |
| 9 | + |
| 10 | +// some of these functions can be so large that the compiler gives up optimizing |
| 11 | +// them - and issues a warning which may be treated as an error! |
| 12 | +// |
| 13 | +// these functions are so rarely called that it is probably okay for them not to |
| 14 | +// be optimized in practice |
| 15 | +FOLLY_CLANG_DISABLE_WARNING("-Wignored-optimization-argument") |
| 16 | + |
| 17 | +namespace apache { |
| 18 | +namespace thrift { |
| 19 | +namespace detail { |
| 20 | +namespace md { |
| 21 | +using ThriftMetadata = ::apache::thrift::metadata::ThriftMetadata; |
| 22 | +using ThriftPrimitiveType = ::apache::thrift::metadata::ThriftPrimitiveType; |
| 23 | +using ThriftType = ::apache::thrift::metadata::ThriftType; |
| 24 | +using ThriftService = ::apache::thrift::metadata::ThriftService; |
| 25 | +using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext; |
| 26 | +using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&); |
| 27 | + |
| 28 | + |
| 29 | +const ::apache::thrift::metadata::ThriftStruct& |
| 30 | +StructMetadata<::facebook::thrift::compiler::test::MyStruct>::gen(ThriftMetadata& metadata) { |
| 31 | + auto res = metadata.structs()->emplace("module.MyStruct", ::apache::thrift::metadata::ThriftStruct{}); |
| 32 | + if (!res.second) { |
| 33 | + return res.first->second; |
| 34 | + } |
| 35 | + ::apache::thrift::metadata::ThriftStruct& module_MyStruct = res.first->second; |
| 36 | + module_MyStruct.name() = "module.MyStruct"; |
| 37 | + module_MyStruct.is_union() = false; |
| 38 | + static const auto* const |
| 39 | + module_MyStruct_fields = new std::array<EncodedThriftField, 4>{ { |
| 40 | + { 1, "def_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 2, "opt_field", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 3, "req_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 4, "terse_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.TerseWrite", { }).cv_struct_ref(), }}, }}; |
| 41 | + for (const auto& f : *module_MyStruct_fields) { |
| 42 | + ::apache::thrift::metadata::ThriftField field; |
| 43 | + field.id() = f.id; |
| 44 | + field.name() = f.name; |
| 45 | + field.is_optional() = f.is_optional; |
| 46 | + f.metadata_type_interface->writeAndGenType(*field.type(), metadata); |
| 47 | + field.structured_annotations() = f.structured_annotations; |
| 48 | + module_MyStruct.fields()->push_back(std::move(field)); |
| 49 | + } |
| 50 | + return res.first->second; |
| 51 | +} |
| 52 | + |
| 53 | +} // namespace md |
| 54 | +} // namespace detail |
| 55 | +} // namespace thrift |
| 56 | +} // namespace apache |
0 commit comments