Haka: lib/haka/vbuffer_data.h Source File

Haka

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

vbuffer_data.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef HAKA_VBUFFER_DATA_H
6 #define HAKA_VBUFFER_DATA_H
7
8 #include <haka/thread.h>
9
10 void vbuffer_data_release(struct vbuffer_data *data);
11
12 extern struct vbuffer_data_ops vbuffer_data_basic_ops;
13
14 struct vbuffer_data_basic {
15 struct vbuffer_data super;
16 atomic_t ref;
17 size_t size;
18 uint8 buffer[0];
19 };
20
21 struct vbuffer_data_basic *vbuffer_data_basic(size_t size, bool zero);
22 bool vbuffer_data_is_basic(struct vbuffer_data *data);
23
24
25 struct vbuffer_data_ctl {
26 struct vbuffer_data super;
27 atomic_t ref;
28 };
29
30 extern struct vbuffer_data_ops vbuffer_data_ctl_select_ops;
31
32 struct vbuffer_data_ctl_select {
33 struct vbuffer_data_ctl super;
34 };
35
36 struct vbuffer_data_ctl_select *vbuffer_data_ctl_select();
37
38 extern struct vbuffer_data_ops vbuffer_data_ctl_push_ops;
39
40 struct vbuffer_data_ctl_push {
41 struct vbuffer_data_ctl super;
42 struct vbuffer_stream *stream;
43 struct vbuffer_stream_chunk *chunk;
44 };
45
46 struct vbuffer_data_ctl_push *vbuffer_data_ctl_push(struct vbuffer_stream *stream,
47 struct vbuffer_stream_chunk *chunk);
48
49 extern struct vbuffer_data_ops vbuffer_data_ctl_mark_ops;
50
51 struct vbuffer_data_ctl_mark {
52 struct vbuffer_data_ctl super;
53 bool readonly:1;
54 };
55
56 struct vbuffer_data_ctl_mark *vbuffer_data_ctl_mark(bool readonly);
57
58 #define vbuffer_data_cast(data, type) ((data) ? ((data)->ops == &type ## _ops ? (struct type*)(data) : NULL) : NULL)
59
60 #endif /* HAKA_VBUFFER_DATA_H */
vbuffer_data
Definition: vbuffer.h:50
vbuffer_data_ops
Definition: vbuffer.h:40
vbuffer_stream
Definition: vbuffer_stream.h:23
atomic_t
volatile uint32 atomic_t
Definition: thread.h:267
uint8
unsigned char uint8
Definition: types.h:27