blob: 3f73c38c00ad0b4f9d44e76d949d52dddec29cd2 [file] [log] [blame]
Roger Meier213a6642010-10-27 12:30:11 +00001#include "thrift_struct.h"
2
3static void
4thrift_struct_class_init (ThriftStructClass *cls)
5{
6 ThriftStructClass *c = THRIFT_STRUCT_CLASS (cls);
7 c->read = thrift_struct_read;
8 c->write = thrift_struct_write;
9}
10
11GType
12thrift_struct_get_type (void)
13{
14 static GType type = 0;
15
16 if (type == 0)
17 {
18 static const GTypeInfo type_info =
19 {
20 sizeof (ThriftStructClass),
21 NULL, /* base_init */
22 NULL, /* base finalize */
23 (GClassInitFunc) thrift_struct_class_init,
24 NULL, /* class finalize */
25 NULL, /* class data */
26 sizeof (ThriftStruct),
27 0, /* n_preallocs */
28 NULL, /* instance_init */
29 NULL, /* value_table */
30 };
31
32 type = g_type_register_static (G_TYPE_OBJECT,
33 "ThriftStructType",
34 &type_info, G_TYPE_FLAG_ABSTRACT);
35 }
36
37 return type;
38}
39
40gint32
41thrift_struct_read (ThriftStruct *object, ThriftProtocol *protocol,
42 GError **error)
43{
44 g_return_val_if_fail (THRIFT_IS_STRUCT (object), -1);
45 return THRIFT_STRUCT_GET_CLASS (object)->read (object, protocol, error);
46}
47
48gint32
49thrift_struct_write (ThriftStruct *object, ThriftProtocol *protocol,
50 GError **error)
51{
52 g_return_val_if_fail (THRIFT_IS_STRUCT (object), -1);
53 return THRIFT_STRUCT_GET_CLASS (object)->write (object, protocol, error);
54}
55