Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 1 | #ifndef THRIFT_STRUCT_H |
| 2 | #define THRIFT_STRUCT_H |
| 3 | |
| 4 | #include <glib-object.h> |
| 5 | |
| 6 | #include "protocol/thrift_protocol.h" |
| 7 | |
| 8 | #define THRIFT_TYPE_STRUCT (thrift_struct_get_type ()) |
| 9 | #define THRIFT_STRUCT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ |
| 10 | THRIFT_TYPE_STRUCT, ThriftStruct)) |
| 11 | #define THRIFT_STRUCT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), \ |
| 12 | THRIFT_TYPE_STRUCT, ThriftStructClass)) |
| 13 | #define THRIFT_IS_STRUCT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ |
| 14 | THRIFT_TYPE_STRUCT)) |
| 15 | #define THRIFT_IS_STRUCT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \ |
| 16 | THRIFT_TYPE_STRUCT)) |
| 17 | #define THRIFT_STRUCT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ |
| 18 | THRIFT_TYPE_STRUCT, \ |
| 19 | ThriftStructClass)) |
| 20 | |
| 21 | /* struct */ |
| 22 | struct _ThriftStruct |
| 23 | { |
| 24 | GObject parent; |
| 25 | |
| 26 | /* private */ |
| 27 | }; |
| 28 | typedef struct _ThriftStruct ThriftStruct; |
| 29 | |
| 30 | struct _ThriftStructClass |
| 31 | { |
| 32 | GObjectClass parent; |
| 33 | |
| 34 | /* public */ |
| 35 | gint32 (*read) (ThriftStruct *object, ThriftProtocol *protocol, |
| 36 | GError **error); |
| 37 | gint32 (*write) (ThriftStruct *object, ThriftProtocol *protocol, |
| 38 | GError **error); |
| 39 | }; |
| 40 | typedef struct _ThriftStructClass ThriftStructClass; |
| 41 | |
| 42 | GType thrift_struct_get_type (void); |
| 43 | |
| 44 | gint32 thrift_struct_read (ThriftStruct *object, ThriftProtocol *protocol, |
| 45 | GError **error); |
| 46 | |
| 47 | gint32 thrift_struct_write (ThriftStruct *object, ThriftProtocol *protocol, |
| 48 | GError **error); |
| 49 | |
| 50 | #endif |