VSF Documented
vsf_queue_stream.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_QUEUE_STREAM_H__
19#define __VSF_QUEUE_STREAM_H__
20
21/*============================ INCLUDES ======================================*/
22
24
25#if VSF_USE_SIMPLE_STREAM == ENABLED && VSF_USE_HEAP == ENABLED
26
28
29#if defined(__VSF_QUEUE_STREAM_CLASS_IMPLEMENT)
30# define __VSF_CLASS_IMPLEMENT__
31# undef __VSF_QUEUE_STREAM_CLASS_IMPLEMENT
32#elif defined(__VSF_QUEUE_STREAM_CLASS_INHERIT__)
33# define __VSF_CLASS_INHERIT__
34# undef __VSF_QUEUE_STREAM_CLASS_INHERIT__
35#endif
36
37#include "utilities/ooc_class.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/*============================ MACROS ========================================*/
44
45#define __VSF_QUEUE_STREAM_INIT(__MAX) \
46 .op = &vsf_queue_stream_op, \
47 .max_buffer_size = (__MAX),
48#define VSF_QUEUE_STREAM_INIT(__MAX) __VSF_QUEUE_STREAM_INIT(__MAX)
49
50#define __describe_queue_stream(__name, __max) \
51 vsf_queue_stream_t __name = { \
52 VSF_QUEUE_STREAM_INIT(__max) \
53 };
54
55#define describe_queue_stream(__name, __max) __describe_queue_stream(__name)
56
57/*============================ MACROFIED FUNCTIONS ===========================*/
58/*============================ TYPES =========================================*/
59
61 public_member(
62 implement(vsf_stream_t)
63 // max_buffer_size < 0 means no limitation, otherwise means the buffer limit in bytes
64 int32_t max_buffer_size;
65 // each write will add a entry in queue
66 // max_entry_num < 0 means no limitation, otherwise means the entry limit
67 int32_t max_entry_num;
68 )
69 private_member(
70 vsf_slist_queue_t buffer_queue;
72 uint32_t entry_num;
73 )
74};
75
76/*============================ GLOBAL VARIABLES ==============================*/
77
79
80/*============================ PROTOTYPES ====================================*/
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif // VSF_USE_SIMPLE_STREAM
87#endif // __VSF_QUEUE_STREAM_H__
Definition vsf_queue_stream.h:60
Definition vsf_simple_stream.h:176
Definition vsf_simple_stream.h:254
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned uint32_t
Definition stdint.h:9
int int32_t
Definition stdint.h:8
Definition vsf_list.h:896
uint32_t size
Definition vsf_memfs.h:50
const vsf_stream_op_t vsf_queue_stream_op
Definition vsf_queue_stream.c:61