1 /**
2  * Autogenerated by Thrift for 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/isset_bitpacking/gen-cpp2/module_metadata.h"
9 
10 namespace apache {
11 namespace thrift {
12 namespace detail {
13 namespace md {
14 using ThriftMetadata = ::apache::thrift::metadata::ThriftMetadata;
15 using ThriftPrimitiveType = ::apache::thrift::metadata::ThriftPrimitiveType;
16 using ThriftType = ::apache::thrift::metadata::ThriftType;
17 using ThriftService = ::apache::thrift::metadata::ThriftService;
18 using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
19 using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
20 
21 
22 const ::apache::thrift::metadata::ThriftStruct&
gen(ThriftMetadata & metadata)23 StructMetadata<::cpp2::Foo>::gen(ThriftMetadata& metadata) {
24   auto res = metadata.structs_ref()->emplace("module.Foo", ::apache::thrift::metadata::ThriftStruct{});
25   if (!res.second) {
26     return res.first->second;
27   }
28   ::apache::thrift::metadata::ThriftStruct& module_Foo = res.first->second;
29   module_Foo.name_ref() = "module.Foo";
30   module_Foo.is_union_ref() = false;
31   static const EncodedThriftField
32   module_Foo_fields[] = {
33     {1, "field1", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
34     {2, "field2", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
35     {3, "field3", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{}},
36     {4, "field4", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_DOUBLE_TYPE), std::vector<ThriftConstStruct>{}},
37   };
38   for (const auto& f : module_Foo_fields) {
39     ::apache::thrift::metadata::ThriftField field;
40     field.id_ref() = f.id;
41     field.name_ref() = f.name;
42     field.is_optional_ref() = f.is_optional;
43     f.metadata_type_interface->writeAndGenType(*field.type_ref(), metadata);
44     field.structured_annotations_ref() = f.structured_annotations;
45     module_Foo.fields_ref()->push_back(std::move(field));
46   }
47   module_Foo.structured_annotations_ref()->push_back(*cvStruct("cpp.PackIsset", {}).cv_struct_ref());
48   return res.first->second;
49 }
50 
51 } // namespace md
52 } // namespace detail
53 } // namespace thrift
54 } // namespace apache
55