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 #pragma once
8 
9 #include "thrift/compiler/test/fixtures/refs/gen-cpp2/module_metadata.h"
10 #include <thrift/lib/cpp2/visitation/for_each.h>
11 
12 namespace apache {
13 namespace thrift {
14 namespace detail {
15 
16 template <>
17 struct ForEachField<::cpp2::MyUnion> {
18   template <typename F, typename... T>
19   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
20     f(0, static_cast<T&&>(t).anInteger_ref()...);
21     f(1, static_cast<T&&>(t).aString_ref()...);
22   }
23 };
24 
25 template <>
26 struct ForEachField<::cpp2::MyField> {
27   template <typename F, typename... T>
28   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
29     f(0, static_cast<T&&>(t).opt_value_ref()...);
30     f(1, static_cast<T&&>(t).value_ref()...);
31     f(2, static_cast<T&&>(t).req_value_ref()...);
32     f(3, static_cast<T&&>(t).opt_enum_value_ref()...);
33     f(4, static_cast<T&&>(t).enum_value_ref()...);
34     f(5, static_cast<T&&>(t).req_enum_value_ref()...);
35     f(6, static_cast<T&&>(t).opt_str_value_ref()...);
36     f(7, static_cast<T&&>(t).str_value_ref()...);
37     f(8, static_cast<T&&>(t).req_str_value_ref()...);
38   }
39 };
40 
41 template <>
42 struct ForEachField<::cpp2::MyStruct> {
43   template <typename F, typename... T>
44   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
45     f(0, static_cast<T&&>(t).opt_ref_ref()...);
46     f(1, static_cast<T&&>(t).ref_ref()...);
47     f(2, static_cast<T&&>(t).req_ref_ref()...);
48   }
49 };
50 
51 template <>
52 struct ForEachField<::cpp2::StructWithUnion> {
53   template <typename F, typename... T>
54   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
55     f(0, static_cast<T&&>(t).u_ref()...);
56     f(1, static_cast<T&&>(t).aDouble_ref()...);
57     f(2, static_cast<T&&>(t).f_ref()...);
58   }
59 };
60 
61 template <>
62 struct ForEachField<::cpp2::RecursiveStruct> {
63   template <typename F, typename... T>
64   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
65     f(0, static_cast<T&&>(t).mes_ref()...);
66   }
67 };
68 
69 template <>
70 struct ForEachField<::cpp2::StructWithContainers> {
71   template <typename F, typename... T>
72   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
73     f(0, static_cast<T&&>(t).list_ref_ref()...);
74     f(1, static_cast<T&&>(t).set_ref_ref()...);
75     f(2, static_cast<T&&>(t).map_ref_ref()...);
76     f(3, static_cast<T&&>(t).list_ref_unique_ref()...);
77     f(4, static_cast<T&&>(t).set_ref_shared_ref()...);
78     f(5, static_cast<T&&>(t).list_ref_shared_const_ref()...);
79   }
80 };
81 
82 template <>
83 struct ForEachField<::cpp2::StructWithSharedConst> {
84   template <typename F, typename... T>
85   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
86     f(0, static_cast<T&&>(t).opt_shared_const_ref()...);
87     f(1, static_cast<T&&>(t).shared_const_ref()...);
88     f(2, static_cast<T&&>(t).req_shared_const_ref()...);
89   }
90 };
91 
92 template <>
93 struct ForEachField<::cpp2::Empty> {
94   template <typename F, typename... T>
95   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
96   }
97 };
98 
99 template <>
100 struct ForEachField<::cpp2::StructWithRef> {
101   template <typename F, typename... T>
102   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
103     f(0, static_cast<T&&>(t).def_field_ref()...);
104     f(1, static_cast<T&&>(t).opt_field_ref()...);
105     f(2, static_cast<T&&>(t).req_field_ref()...);
106   }
107 };
108 
109 template <>
110 struct ForEachField<::cpp2::StructWithBox> {
111   template <typename F, typename... T>
112   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
113     f(0, static_cast<T&&>(t).a_ref()...);
114     f(1, static_cast<T&&>(t).b_ref()...);
115     f(2, static_cast<T&&>(t).c_ref()...);
116   }
117 };
118 
119 template <>
120 struct ForEachField<::cpp2::StructWithRefTypeUnique> {
121   template <typename F, typename... T>
122   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
123     f(0, static_cast<T&&>(t).def_field_ref()...);
124     f(1, static_cast<T&&>(t).opt_field_ref()...);
125     f(2, static_cast<T&&>(t).req_field_ref()...);
126   }
127 };
128 
129 template <>
130 struct ForEachField<::cpp2::StructWithRefTypeShared> {
131   template <typename F, typename... T>
132   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
133     f(0, static_cast<T&&>(t).def_field_ref()...);
134     f(1, static_cast<T&&>(t).opt_field_ref()...);
135     f(2, static_cast<T&&>(t).req_field_ref()...);
136   }
137 };
138 
139 template <>
140 struct ForEachField<::cpp2::StructWithRefTypeSharedConst> {
141   template <typename F, typename... T>
142   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
143     f(0, static_cast<T&&>(t).def_field_ref()...);
144     f(1, static_cast<T&&>(t).opt_field_ref()...);
145     f(2, static_cast<T&&>(t).req_field_ref()...);
146   }
147 };
148 
149 template <>
150 struct ForEachField<::cpp2::StructWithRefAndAnnotCppNoexceptMoveCtor> {
151   template <typename F, typename... T>
152   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
153     f(0, static_cast<T&&>(t).def_field_ref()...);
154   }
155 };
156 
157 template <>
158 struct ForEachField<::cpp2::StructWithString> {
159   template <typename F, typename... T>
160   void operator()(FOLLY_MAYBE_UNUSED F&& f, FOLLY_MAYBE_UNUSED T&&... t) const {
161     f(0, static_cast<T&&>(t).def_unique_string_ref_ref()...);
162     f(1, static_cast<T&&>(t).def_shared_string_ref_ref()...);
163     f(2, static_cast<T&&>(t).def_shared_string_const_ref_ref()...);
164     f(3, static_cast<T&&>(t).unique_string_ref_ref()...);
165     f(4, static_cast<T&&>(t).shared_string_ref_ref()...);
166   }
167 };
168 } // namespace detail
169 } // namespace thrift
170 } // namespace apache
171