]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
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_MEMORY_BUFFER_H | |
21 | #define _THRIFT_MEMORY_BUFFER_H | |
22 | ||
23 | #include <glib.h> | |
24 | #include <glib-object.h> | |
25 | ||
26 | #include <thrift/c_glib/transport/thrift_transport.h> | |
27 | ||
28 | G_BEGIN_DECLS | |
29 | ||
30 | /*! \file thrift_memory_buffer.h | |
31 | * \brief Implementation of a Thrift memory buffer transport. | |
32 | */ | |
33 | ||
34 | /* type macros */ | |
35 | #define THRIFT_TYPE_MEMORY_BUFFER (thrift_memory_buffer_get_type ()) | |
36 | #define THRIFT_MEMORY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_MEMORY_BUFFER, ThriftMemoryBuffer)) | |
37 | #define THRIFT_IS_MEMORY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_MEMORY_BUFFER)) | |
38 | #define THRIFT_MEMORY_BUFFER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_MEMORY_BUFFER, ThriftMemoryBufferClass)) | |
39 | #define THRIFT_IS_MEMORY_BUFFER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_MEMORY_BUFFER) | |
40 | #define THRIFT_MEMORY_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_MEMORY_BUFFER, ThriftMemoryBufferClass)) | |
41 | ||
42 | typedef struct _ThriftMemoryBuffer ThriftMemoryBuffer; | |
43 | ||
44 | /*! | |
45 | * ThriftMemoryBuffer instance. | |
46 | */ | |
47 | struct _ThriftMemoryBuffer | |
48 | { | |
49 | ThriftTransport parent; | |
50 | ||
51 | /* private */ | |
52 | GByteArray *buf; | |
53 | guint32 buf_size; | |
54 | gboolean owner; | |
55 | }; | |
56 | ||
57 | typedef struct _ThriftMemoryBufferClass ThriftMemoryBufferClass; | |
58 | ||
59 | /*! | |
60 | * ThriftMemoryBuffer class. | |
61 | */ | |
62 | struct _ThriftMemoryBufferClass | |
63 | { | |
64 | ThriftTransportClass parent; | |
65 | }; | |
66 | ||
67 | /* used by THRIFT_TYPE_MEMORY_BUFFER */ | |
68 | GType thrift_memory_buffer_get_type (void); | |
69 | ||
70 | G_END_DECLS | |
71 | ||
72 | #endif |