VSF Documented
delegate.h
Go to the documentation of this file.
1/****************************************************************************
2* Copyright 2020 by Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
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/*****************************************************************************
19 * Copyright(C)2009-2022 by VSF Team *
20 * *
21 * Licensed under the Apache License, Version 2.0 (the "License"); *
22 * you may not use this file except in compliance with the License. *
23 * You may obtain a copy of the License at *
24 * *
25 * http://www.apache.org/licenses/LICENSE-2.0 *
26 * *
27 * Unless required by applicable law or agreed to in writing, software *
28 * distributed under the License is distributed on an "AS IS" BASIS, *
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
30 * See the License for the specific language governing permissions and *
31 * limitations under the License. *
32 * *
33 ****************************************************************************/
34
35#ifndef __DELEGATE_H__
36#define __DELEGATE_H__
37
38/*============================ INCLUDES ======================================*/
39#include "../compiler/compiler.h"
40
45#define __PLOOC_CLASS_USE_STRICT_TEMPLATE__
46
47#if defined(__VSF_DELEGATE_CLASS_IMPLEMENT)
48# define __PLOOC_CLASS_IMPLEMENT__
49# undef __VSF_DELEGATE_CLASS_IMPLEMENT
50#elif defined(__VSF_DELEGATE_CLASS_INHERIT__)
51# define __PLOOC_CLASS_INHERIT__
52# undef __VSF_DELEGATE_CLASS_INHERIT__
53#endif
54
55#include "../ooc_class.h"
56
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61/*============================ MACROS ========================================*/
62#define EVENT_RT_UNREGISTER 4
63
64/*============================ MACROFIED FUNCTIONS ===========================*/
65/*============================ TYPES =========================================*/
66
67typedef fsm_rt_t delegate_handler_func_t(void *arg_ptr, void *param_ptr);
68
69
70dcl_class( delegate_handler_t )
73def_class( delegate_handler_t,
74 private_member(
75 delegate_handler_func_t *handler_fn;
76 void *arg_ptr;
77 delegate_handler_t *next_ptr;
78 )
79)
80end_def_class(delegate_handler_t)
82
83dcl_class( delegate_t )
86def_class(delegate_t,
87 private_member(
88 delegate_handler_t *event_ptr;
89 delegate_handler_t *blocked_list_ptr;
90 delegate_handler_t **handler_pptr;
91 )
92)
93end_def_class(delegate_t)
95
96/*============================ GLOBAL VARIABLES ==============================*/
97/*============================ LOCAL VARIABLES ===============================*/
98/*============================ PROTOTYPES ====================================*/
99
100
105extern delegate_t *delegate_init(delegate_t *event_ptr);
106
113extern delegate_handler_t *delegate_handler_init(
114 delegate_handler_t *handler_ptr,
115 delegate_handler_func_t *routine_fn,
116 void *arg_ptr);
117
123extern vsf_err_t register_delegate_handler( delegate_t *event_ptr,
124 delegate_handler_t *handler_ptr);
125
131extern vsf_err_t unregister_delegate_handler( delegate_t *event_ptr,
132 delegate_handler_t *handler_ptr);
133
139extern fsm_rt_t invoke_delegate( delegate_t *event_ptr, void *param_ptr);
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif
146/* EOF */
vsf_err_t
Definition __type.h:42
delegate_t * delegate_init(delegate_t *event_ptr)
initialize event !
Definition delegate.c:62
fsm_rt_t delegate_handler_func_t(void *arg_ptr, void *param_ptr)
Definition delegate.h:67
fsm_rt_t
Definition vsf_fsm.h:315
def_class(vsf_stream_fifo_t, which(vsf_stream_tx_t TX;vsf_stream_rx_t RX;), private:vsf_slist_queue_t union { vsf_stream_fifo_cfg_t cfg;struct { vsf_stream_dat_rdy_evt_t tDataReadyEventHandling;vsf_stream_dat_drn_evt_t tDataDrainEventHandling;vsf_stream_status_t Status;#if !defined(VSF_PBUF_QUEUE_CFG_ATOM_ACCESS) vsf_protect_region_t *pregion;#endif };};) end_def_class(vsf_stream_fifo_t) extern vsf_err_t vsf_stream_fifo_init(vsf_stream_fifo_t *obj_ptr
dcl_class(vsf_pool_t) typedef void vsf_pool_item_init_evt_handler_t(uintptr_t target_ptr