Re-sync with internal repository
[hiphop-php.git] / third-party / thrift / src / thrift / compiler / test / fixtures / serialization_field_order / gen-cpp2 / module_metadata.cpp
blobf81b2c4494ce57a335916fce31d7301821e02d7e
1 /**
2 * Autogenerated by Thrift for src/module.thrift
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/serialization_field_order/gen-cpp2/module_metadata.h"
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!
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")
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&);
29 const ::apache::thrift::metadata::ThriftStruct&
30 StructMetadata<::cpp2::Foo>::gen(ThriftMetadata& metadata) {
31 auto res = metadata.structs()->emplace("module.Foo", ::apache::thrift::metadata::ThriftStruct{});
32 if (!res.second) {
33 return res.first->second;
35 ::apache::thrift::metadata::ThriftStruct& module_Foo = res.first->second;
36 module_Foo.name() = "module.Foo";
37 module_Foo.is_union() = false;
38 static const auto* const
39 module_Foo_fields = new std::array<EncodedThriftField, 3>{{
40 {3, "field1", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
41 {1, "field2", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
42 {2, "field3", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
43 }};
44 for (const auto& f : *module_Foo_fields) {
45 ::apache::thrift::metadata::ThriftField field;
46 field.id() = f.id;
47 field.name() = f.name;
48 field.is_optional() = f.is_optional;
49 f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
50 field.structured_annotations() = f.structured_annotations;
51 module_Foo.fields()->push_back(std::move(field));
53 module_Foo.structured_annotations()->push_back(*cvStruct("thrift.SerializeInFieldIdOrder", {}).cv_struct_ref());
54 return res.first->second;
56 const ::apache::thrift::metadata::ThriftStruct&
57 StructMetadata<::cpp2::Foo2>::gen(ThriftMetadata& metadata) {
58 auto res = metadata.structs()->emplace("module.Foo2", ::apache::thrift::metadata::ThriftStruct{});
59 if (!res.second) {
60 return res.first->second;
62 ::apache::thrift::metadata::ThriftStruct& module_Foo2 = res.first->second;
63 module_Foo2.name() = "module.Foo2";
64 module_Foo2.is_union() = false;
65 static const auto* const
66 module_Foo2_fields = new std::array<EncodedThriftField, 3>{{
67 {3, "field1", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
68 {1, "field2", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
69 {2, "field3", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{}},
70 }};
71 for (const auto& f : *module_Foo2_fields) {
72 ::apache::thrift::metadata::ThriftField field;
73 field.id() = f.id;
74 field.name() = f.name;
75 field.is_optional() = f.is_optional;
76 f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
77 field.structured_annotations() = f.structured_annotations;
78 module_Foo2.fields()->push_back(std::move(field));
80 return res.first->second;
83 } // namespace md
84 } // namespace detail
85 } // namespace thrift
86 } // namespace apache