VSF Documented
vsf_stream_reader.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_SERVICE_STREAM_READER_H__
19#define __VSF_SERVICE_STREAM_READER_H__
20
21/*============================ INCLUDES ======================================*/
23
24#include "./pbuf/vsf_pbuf.h"
26
27#if VSF_USE_STREAM == ENABLED
28#include "./interface.h"
29#include "../pool/vsf_pool.h"
31#include "./vsf_stream_base.h"
32
37#define __PLOOC_CLASS_USE_STRICT_TEMPLATE__
38
39#if defined(__VSF_STREAM_READER_CLASS_IMPLEMENT)
40# define __PLOOC_CLASS_IMPLEMENT__
41# undef __VSF_STREAM_READER_CLASS_IMPLEMENT
42#elif defined(__VSF_STREAM_READER_CLASS_INHERIT__)
43# define __PLOOC_CLASS_INHERIT__
44# undef __VSF_STREAM_READER_CLASS_INHERIT__
45#endif
46
47#include "utilities/ooc_class.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/*============================ MACROS ========================================*/
54/*============================ MACROFIED FUNCTIONS ===========================*/
55/*============================ TYPES =========================================*/
56
57/*----------------------------------------------------------------------------*
58 * STREAM READER *
59 *----------------------------------------------------------------------------*/
60declare_class(vsf_stream_reader_t);
61
62def_class(vsf_stream_reader_t,
63 which(
64 implement(vsf_stream_usr_t)
65 ),
66 private_member(
67 vsf_pbuf_t *current_ptr;
68 uint16_t hwOffset;
69 uint16_t hwBufferSize;
70 )
71)
72end_def_class(vsf_stream_reader_t)
73
74typedef vsf_stream_usr_cfg_t vsf_stream_reader_cfg_t;
75
76def_interface(i_stream_reader_t)
77 vsf_err_t (*Init) (vsf_stream_reader_t *obj_ptr,
78 const vsf_stream_reader_cfg_t *cfg_ptr);
79#if VSF_STREAM_CFG_SUPPORT_OPEN_CLOSE == ENABLED
80 void (*Open)( vsf_stream_reader_t *obj_ptr);
81 void (*Close)( vsf_stream_reader_t *obj_ptr);
82#endif
83 struct {
84 vsf_pbuf_t * (*Fetch) (vsf_stream_reader_t *obj_ptr);
86
87 bool (*ReadByte)(vsf_stream_reader_t *obj_ptr,
88 uint8_t *byte_ptr);
89 int_fast32_t (*Read) (vsf_stream_reader_t *obj_ptr,
90 uint8_t *buffer_ptr,
91 uint_fast16_t u16_size);
92end_def_interface(i_stream_reader_t)
93
94/*============================ GLOBAL VARIABLES ==============================*/
95extern const i_stream_reader_t VSF_STREAM_READER;
96/*============================ PROTOTYPES ====================================*/
97
98/*----------------------------------------------------------------------------*
99 * STREAM READER *
100 *----------------------------------------------------------------------------*/
101
102extern
103vsf_err_t vsf_stream_reader_init( vsf_stream_reader_t *obj_ptr,
104 const vsf_stream_reader_cfg_t *cfg_ptr);
105
106extern
107vsf_pbuf_t *vsf_stream_reader_fetch_pbuf ( vsf_stream_reader_t *obj_ptr);
108
109extern
110int_fast32_t vsf_stream_reader_read(vsf_stream_reader_t *obj_ptr,
111 uint8_t *buffer_ptr,
112 uint_fast16_t u16_size);
113
114extern
115bool vsf_stream_reader_read_byte( vsf_stream_reader_t *obj_ptr,
116 uint8_t *byte_ptr);
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
123#endif
124/* EOF */
vsf_err_t
Definition __type.h:42
vsf_err_t(* Init)(vsf_adc_cfg_t *pCfg)
Definition adc_interface.h:38
bool
Definition type.h:60
unsigned short uint16_t
Definition stdint.h:7
int int_fast32_t
Definition stdint.h:26
unsigned short uint_fast16_t
Definition stdint.h:25
unsigned char uint8_t
Definition stdint.h:5
vsf_stream_usr_cfg_t
Definition vsf_stream_base.h:118
const i_stream_reader_t VSF_STREAM_READER
Definition vsf_stream_reader.c:37
void(* Open)(vsf_stream_reader_t *obj_ptr)
Definition vsf_stream_reader.h:80
vsf_pbuf_t * vsf_stream_reader_fetch_pbuf(vsf_stream_reader_t *obj_ptr)
Definition vsf_stream_reader.c:70
void(* Close)(vsf_stream_reader_t *obj_ptr)
Definition vsf_stream_reader.h:81
const vsf_stream_reader_cfg_t * cfg_ptr
Definition vsf_stream_reader.h:78
bool vsf_stream_reader_read_byte(vsf_stream_reader_t *obj_ptr, uint8_t *byte_ptr)
Definition vsf_stream_reader.c:142
int_fast32_t vsf_stream_reader_read(vsf_stream_reader_t *obj_ptr, uint8_t *buffer_ptr, uint_fast16_t u16_size)
Definition vsf_stream_reader.c:96
int_fast32_t(* Read)(vsf_stream_reader_t *obj_ptr, uint8_t *buffer_ptr, uint_fast16_t u16_size)
Definition vsf_stream_reader.h:89
struct @778 Block
declare_class(vsf_stream_reader_t)
end_def_interface(i_stream_reader_t) extern const i_stream_reader_t VSF_STREAM_READER
vsf_err_t vsf_stream_reader_init(vsf_stream_reader_t *obj_ptr, const vsf_stream_reader_cfg_t *cfg_ptr)
Definition vsf_stream_reader.c:60
bool(* ReadByte)(vsf_stream_reader_t *obj_ptr, uint8_t *byte_ptr)
Definition vsf_stream_reader.h:87
def_class(vsf_stream_reader_t, which(vsf_stream_usr_t), private:vsf_pbuf_t *current_ptr;uint16_t hwOffset;uint16_t hwBufferSize;) end_def_class(vsf_stream_reader_t) typedef vsf_stream_usr_cfg_t vsf_stream_reader_cfg_t
def_interface(i_stream_reader_t) vsf_err_t(*Init)(vsf_stream_reader_t *obj_ptr
which(union { inherit(vsf_msgt_container_t) vsf_tgui_control_t };vsf_tgui_v_container_t) implement_ex(struct
Definition vsf_tgui_control.h:540