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_STRUCT_H 21 #define THRIFT_STRUCT_H 22 23 #include <glib-object.h> 24 25 #include <thrift/c_glib/protocol/thrift_protocol.h> 26 27 G_BEGIN_DECLS 28 29 #define THRIFT_TYPE_STRUCT (thrift_struct_get_type ()) 30 #define THRIFT_STRUCT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_STRUCT, ThriftStruct)) 31 #define THRIFT_STRUCT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_STRUCT, ThriftStructClass)) 32 #define THRIFT_IS_STRUCT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_STRUCT)) 33 #define THRIFT_IS_STRUCT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_STRUCT)) 34 #define THRIFT_STRUCT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_STRUCT, ThriftStructClass)) 35 36 typedef struct _ThriftStruct ThriftStruct; 37 38 /* struct */ 39 struct _ThriftStruct 40 { 41 GObject parent; 42 43 /* private */ 44 }; 45 46 typedef struct _ThriftStructClass ThriftStructClass; 47 48 struct _ThriftStructClass 49 { 50 GObjectClass parent; 51 52 /* public */ 53 gint32 (*read) (ThriftStruct *object, ThriftProtocol *protocol, 54 GError **error); 55 gint32 (*write) (ThriftStruct *object, ThriftProtocol *protocol, 56 GError **error); 57 }; 58 59 GType thrift_struct_get_type (void); 60 61 gint32 thrift_struct_read (ThriftStruct *object, ThriftProtocol *protocol, 62 GError **error); 63 64 gint32 thrift_struct_write (ThriftStruct *object, ThriftProtocol *protocol, 65 GError **error); 66 G_END_DECLS 67 68 #endif 69