Roger Meier | c101092 | 2010-11-26 10:17:48 +0000 | [diff] [blame] | 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 | |
Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 20 | #ifndef THRIFT_STRUCT_H |
| 21 | #define THRIFT_STRUCT_H |
| 22 | |
| 23 | #include <glib-object.h> |
| 24 | |
| 25 | #include "protocol/thrift_protocol.h" |
| 26 | |
Roger Meier | c101092 | 2010-11-26 10:17:48 +0000 | [diff] [blame] | 27 | G_BEGIN_DECLS |
| 28 | |
Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 29 | #define THRIFT_TYPE_STRUCT (thrift_struct_get_type ()) |
Roger Meier | c101092 | 2010-11-26 10:17:48 +0000 | [diff] [blame] | 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)) |
Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 35 | |
| 36 | /* struct */ |
| 37 | struct _ThriftStruct |
| 38 | { |
| 39 | GObject parent; |
| 40 | |
| 41 | /* private */ |
| 42 | }; |
| 43 | typedef struct _ThriftStruct ThriftStruct; |
| 44 | |
| 45 | struct _ThriftStructClass |
| 46 | { |
| 47 | GObjectClass parent; |
| 48 | |
| 49 | /* public */ |
| 50 | gint32 (*read) (ThriftStruct *object, ThriftProtocol *protocol, |
| 51 | GError **error); |
| 52 | gint32 (*write) (ThriftStruct *object, ThriftProtocol *protocol, |
| 53 | GError **error); |
| 54 | }; |
| 55 | typedef struct _ThriftStructClass ThriftStructClass; |
| 56 | |
| 57 | GType thrift_struct_get_type (void); |
| 58 | |
| 59 | gint32 thrift_struct_read (ThriftStruct *object, ThriftProtocol *protocol, |
| 60 | GError **error); |
| 61 | |
| 62 | gint32 thrift_struct_write (ThriftStruct *object, ThriftProtocol *protocol, |
| 63 | GError **error); |
Roger Meier | c101092 | 2010-11-26 10:17:48 +0000 | [diff] [blame] | 64 | G_END_DECLS |
Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 65 | |
| 66 | #endif |