1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  *   http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef _THRIFT_TEST_HANDLER_H
21 #define _THRIFT_TEST_HANDLER_H
22 
23 #include <glib-object.h>
24 #include <stdio.h>
25 
26 #include "../gen-c_glib/t_test_thrift_test.h"
27 
28 G_BEGIN_DECLS
29 
30 /* A handler that implements the TTestThriftTestIf interface */
31 
32 #define TYPE_THRIFT_TEST_HANDLER (thrift_test_handler_get_type ())
33 
34 #define THRIFT_TEST_HANDLER(obj)                                \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj),                           \
36                                TYPE_THRIFT_TEST_HANDLER,        \
37                                ThriftTestHandler))
38 #define IS_THRIFT_TEST_HANDLER(obj)                             \
39   (G_TYPE_CHECK_INSTANCE_TYPE ((obj),                           \
40                                TYPE_THRIFT_TEST_HANDLER))
41 #define THRIFT_TEST_HANDLER_CLASS(c)                    \
42   (G_TYPE_CHECK_CLASS_CAST ((c),                        \
43                             TYPE_THRIFT_TEST_HANDLER,   \
44                             ThriftTestHandlerClass))
45 #define IS_THRIFT_TEST_HANDLER_CLASS(c)                 \
46   (G_TYPE_CHECK_CLASS_TYPE ((c),                        \
47                             TYPE_THRIFT_TEST_HANDLER))
48 #define THRIFT_TEST_HANDLER_GET_CLASS(obj)              \
49   (G_TYPE_INSTANCE_GET_CLASS ((obj),                    \
50                               TYPE_THRIFT_TEST_HANDLER, \
51                               ThriftTestHandlerClass))
52 
53 typedef struct _ThriftTestHandler ThriftTestHandler;
54 typedef struct _ThriftTestHandlerClass ThriftTestHandlerClass;
55 
56 struct _ThriftTestHandler {
57   TTestThriftTestHandler parent;
58 };
59 
60 struct _ThriftTestHandlerClass {
61   TTestThriftTestHandlerClass parent;
62 
63   gboolean (*test_void)            (TTestThriftTestIf    *iface,
64                                     GError              **error);
65   gboolean (*test_string)          (TTestThriftTestIf    *iface,
66                                     gchar               **_return,
67                                     const gchar          *thing,
68                                     GError              **error);
69   gboolean (*test_bool)            (TTestThriftTestIf    *iface,
70                                     gboolean*_return,
71                                     const gboolean        thing,
72                                     GError              **error);
73   gboolean (*test_byte)            (TTestThriftTestIf    *iface,
74                                     gint8*_return,
75                                     const gint8           thing,
76                                     GError              **error);
77   gboolean (*test_i32)             (TTestThriftTestIf    *iface,
78                                     gint32*_return,
79                                     const gint32          thing,
80                                     GError              **error);
81   gboolean (*test_i64)             (TTestThriftTestIf    *iface,
82                                     gint64*_return,
83                                     const gint64          thing,
84                                     GError              **error);
85   gboolean (*test_double)          (TTestThriftTestIf    *iface,
86                                     gdouble*_return,
87                                     const gdouble         thing,
88                                     GError              **error);
89   gboolean (*test_binary)          (TTestThriftTestIf    *iface,
90                                     GByteArray        **_return,
91                                     const GByteArray     *thing,
92                                     GError              **error);
93   gboolean (*test_struct)          (TTestThriftTestIf    *iface,
94                                     TTestXtruct         **_return,
95                                     const TTestXtruct    *thing,
96                                     GError              **error);
97   gboolean (*test_nest)            (TTestThriftTestIf    *iface,
98                                     TTestXtruct2        **_return,
99                                     const TTestXtruct2   *thing,
100                                     GError              **error);
101   gboolean (*test_map)             (TTestThriftTestIf    *iface,
102                                     GHashTable          **_return,
103                                     const GHashTable     *thing,
104                                     GError              **error);
105   gboolean (*test_string_map)      (TTestThriftTestIf    *iface,
106                                     GHashTable          **_return,
107                                     const GHashTable     *thing,
108                                     GError              **error);
109   gboolean (*test_set)             (TTestThriftTestIf    *iface,
110                                     GHashTable          **_return,
111                                     const GHashTable     *thing,
112                                     GError              **error);
113   gboolean (*test_list)            (TTestThriftTestIf    *iface,
114                                     GArray              **_return,
115                                     const GArray         *thing,
116                                     GError              **error);
117   gboolean (*test_enum)            (TTestThriftTestIf    *iface,
118                                     TTestNumberz*_return,
119                                     const TTestNumberz    thing,
120                                     GError              **error);
121   gboolean (*test_typedef)         (TTestThriftTestIf    *iface,
122                                     TTestUserId*_return,
123                                     const TTestUserId     thing,
124                                     GError              **error);
125   gboolean (*test_map_map)         (TTestThriftTestIf    *iface,
126                                     GHashTable          **_return,
127                                     const gint32          hello,
128                                     GError              **error);
129   gboolean (*test_insanity)        (TTestThriftTestIf    *iface,
130                                     GHashTable          **_return,
131                                     const TTestInsanity  *argument,
132                                     GError              **error);
133   gboolean (*test_multi)           (TTestThriftTestIf    *iface,
134                                     TTestXtruct         **_return,
135                                     const gint8           arg0,
136                                     const gint32          arg1,
137                                     const gint64          arg2,
138                                     const GHashTable     *arg3,
139                                     const TTestNumberz    arg4,
140                                     const TTestUserId     arg5,
141                                     GError              **error);
142   gboolean (*test_exception)       (TTestThriftTestIf    *iface,
143                                     const gchar          *arg,
144                                     TTestXception       **err1,
145                                     GError              **error);
146   gboolean (*test_multi_exception) (TTestThriftTestIf    *iface,
147                                     TTestXtruct         **_return,
148                                     const gchar          *arg0,
149                                     const gchar          *arg1,
150                                     TTestXception       **err1,
151                                     TTestXception2      **err2,
152                                     GError              **error);
153   gboolean (*test_oneway)          (TTestThriftTestIf    *iface,
154                                     const gint32          secondsToSleep,
155                                     GError              **error);
156 };
157 
158 /* Used by THRIFT_TEST_HANDLER_GET_TYPE */
159 GType thrift_test_handler_get_type (void);
160 
161 gboolean thrift_test_handler_test_void            (TTestThriftTestIf    *iface,
162                                                    GError              **error);
163 gboolean thrift_test_handler_test_string          (TTestThriftTestIf    *iface,
164                                                    gchar               **_return,
165                                                    const gchar          *thing,
166                                                    GError              **error);
167 gboolean thrift_test_handler_test_byte            (TTestThriftTestIf    *iface,
168                                                    gint8*_return,
169                                                    const gint8           thing,
170                                                    GError              **error);
171 gboolean t_test_thrift_test_if_test_i32           (TTestThriftTestIf    *iface,
172                                                    gint32*_return,
173                                                    const gint32          thing,
174                                                    GError              **error);
175 gboolean thrift_test_handler_test_i64             (TTestThriftTestIf    *iface,
176                                                    gint64*_return,
177                                                    const gint64          thing,
178                                                    GError              **error);
179 gboolean thrift_test_handler_test_double          (TTestThriftTestIf    *iface,
180                                                    gdouble*_return,
181                                                    const gdouble         thing,
182                                                    GError              **error);
183 gboolean thrift_test_handler_test_struct          (TTestThriftTestIf    *iface,
184                                                    TTestXtruct         **_return,
185                                                    const TTestXtruct    *thing,
186                                                    GError              **error);
187 gboolean thrift_test_handler_test_nest            (TTestThriftTestIf    *iface,
188                                                    TTestXtruct2        **_return,
189                                                    const TTestXtruct2   *thing,
190                                                    GError              **error);
191 gboolean thrift_test_handler_test_map             (TTestThriftTestIf    *iface,
192                                                    GHashTable          **_return,
193                                                    const GHashTable     *thing,
194                                                    GError              **error);
195 gboolean thrift_test_handler_test_string_map      (TTestThriftTestIf    *iface,
196                                                    GHashTable          **_return,
197                                                    const GHashTable     *thing,
198                                                    GError              **error);
199 gboolean thrift_test_handler_test_set             (TTestThriftTestIf    *iface,
200                                                    GHashTable          **_return,
201                                                    const GHashTable     *thing,
202                                                    GError              **error);
203 gboolean thrift_test_handler_test_list            (TTestThriftTestIf    *iface,
204                                                    GArray              **_return,
205                                                    const GArray         *thing,
206                                                    GError              **error);
207 gboolean thrift_test_handler_test_typedef         (TTestThriftTestIf    *iface,
208                                                    TTestUserId*_return,
209                                                    const TTestUserId     thing,
210                                                    GError              **error);
211 gboolean thrift_test_handler_test_map_map         (TTestThriftTestIf    *iface,
212                                                    GHashTable          **_return,
213                                                    const gint32          hello,
214                                                    GError              **error);
215 gboolean thrift_test_handler_test_insanity        (TTestThriftTestIf    *iface,
216                                                    GHashTable          **_return,
217                                                    const TTestInsanity  *argument,
218                                                    GError              **error);
219 gboolean thrift_test_handler_test_multi           (TTestThriftTestIf    *iface,
220                                                    TTestXtruct         **_return,
221                                                    const gint8           arg0,
222                                                    const gint32          arg1,
223                                                    const gint64          arg2,
224                                                    const GHashTable     *arg3,
225                                                    const TTestNumberz    arg4,
226                                                    const TTestUserId     arg5,
227                                                    GError              **error);
228 gboolean thrift_test_handler_test_exception       (TTestThriftTestIf    *iface,
229                                                    const gchar          *arg,
230                                                    TTestXception       **err1,
231                                                    GError              **error);
232 gboolean thrift_test_handler_test_multi_exception (TTestThriftTestIf    *iface,
233                                                    TTestXtruct         **_return,
234                                                    const gchar          *arg0,
235                                                    const gchar          *arg1,
236                                                    TTestXception       **err1,
237                                                    TTestXception2      **err2,
238                                                    GError              **error);
239 gboolean thrift_test_handler_test_oneway          (TTestThriftTestIf    *iface,
240                                                    const gint32          secondsToSleep,
241                                                    GError              **error);
242 
243 G_END_DECLS
244 
245 #endif /* _THRIFT_TEST_HANDLER_H */
246