Implement of Chain of Responsibility design petten library API.
More...
Go to the source code of this file.
Implement of Chain of Responsibility design petten library API.
Definition in file chain_of_responsibility.c.
◆ ChainOfResponsibility
◆ chain_of_resp_equall_operand()
static int chain_of_resp_equall_operand |
( |
void * |
this, |
|
|
size_t |
size, |
|
|
void * |
input_parameter |
|
) |
| |
|
static |
◆ chain_of_resp_free()
static void chain_of_resp_free |
( |
void * |
this | ) |
|
|
static |
◆ chain_of_resp_new()
static void chain_of_resp_new |
( |
void * |
this, |
|
|
size_t |
size, |
|
|
void * |
input_parameter |
|
) |
| |
|
static |
◆ chain_of_resp_setter()
static int chain_of_resp_setter |
( |
void * |
this, |
|
|
size_t |
size, |
|
|
void * |
input_parameter |
|
) |
| |
|
static |
◆ cor_add_function()
add to chain api
- Parameters
-
[in] | id | key id related to chain api |
[in] | func | chain func |
[in] | ctx | user defined context information |
- Return values
-
!=NULL | -> Success to add, if you want to remove element, please keep it. |
NULL | -> Faled to add |
Definition at line 90 of file chain_of_responsibility.c.
◆ cor_call()
void cor_call |
( |
const int |
id, |
|
|
void * |
arg |
|
) |
| |
call chain api
- Parameters
-
[in] | id | key id related to chain api |
[in] | arg | input parameter pointer, related to function |
- Returns
- none. If you want to get result, please define input parameter to know result
Definition at line 112 of file chain_of_responsibility.c.
◆ cor_clear()
◆ cor_remove_chain_element_part()
remove to chain api
- Parameters
-
[in] | id | key id related to chain api |
[in] | element | chain element returned at cor_add_function |
- Returns
- none
- Note
- This function only remove element. So if you want to register same functions, and remove only one element, please use it.
-
This function "NOT" free ctx
Definition at line 133 of file chain_of_responsibility.c.
◆ cor_remove_function()
void cor_remove_function |
( |
const int |
id, |
|
|
chain_func |
func |
|
) |
| |
remove to chain api
- Parameters
-
[in] | id | key id related to chain api |
[in] | func | chain api func |
- Returns
- none
- Note
- This function remove all functions which is same address. So if you set same function by cor_add_function, all of them will remove.
-
This function "NOT" free ctx
Definition at line 122 of file chain_of_responsibility.c.
◆ cor_set_threadsafe()
void cor_set_threadsafe |
( |
int |
is_threadsafe | ) |
|
set thredsafe
- Parameters
-
[in] | is_threadsafe | 1 if you want to use threadsafe. |
- Returns
- none
Definition at line 86 of file chain_of_responsibility.c.
◆ cor_mng_g
Initial value:= {
.method ={
},
.handle = NULL,
.is_threadsafe = 0,
}
static void chain_of_resp_new(void *this, size_t size, void *input_parameter)
new API
static int chain_of_resp_equall_operand(void *this, size_t size, void *input_parameter)
equall operand, check name
static int chain_of_resp_setter(void *this, size_t size, void *input_parameter)
setter, add function to ChainElement
static void chain_of_resp_free(void *this)
free member resource