|
design_pattern_for_c
V 1.00
|
This is API for Chain of Responsibility design pettern class. More...

Go to the source code of this file.
Typedefs | |
| typedef struct chain_element_part * | ChainElementPart |
| ChainElementPart class definition. More... | |
| typedef cor_result_e(* | chain_func) (void *arg, void *ctx) |
| chain func More... | |
Enumerations | |
| enum | cor_result_e { CoR_GONEXT, CoR_RETURN } |
| chain_api result type More... | |
Functions | |
| void | cor_set_threadsafe (int is_threadsafe) |
| set thredsafe More... | |
| ChainElementPart | cor_add_function (const int id, chain_func func, void *ctx) |
| add to chain api More... | |
| void | cor_call (const int id, void *arg) |
| call chain api More... | |
| void | cor_remove_function (const int id, chain_func func) |
| remove to chain api More... | |
| void | cor_remove_chain_element_part (const int id, ChainElementPart element) |
| remove to chain api More... | |
| void | cor_clear (void) |
| clear all list More... | |
This is API for Chain of Responsibility design pettern class.
Definition in file chain_of_responsibility.h.
| typedef cor_result_e(* chain_func) (void *arg, void *ctx) |
chain func
| [in] | arg | input parameter pointer, related to function |
| [in] | ctx | context information registered at cor_add_function |
| CoR_GONEXT | -> call next chain_api |
| CoR_RETURN | -> exit to call chain_api |
Definition at line 31 of file chain_of_responsibility.h.
| typedef struct chain_element_part* ChainElementPart |
ChainElementPart class definition.
Definition at line 21 of file chain_of_responsibility.h.
| enum cor_result_e |
chain_api result type
| Enumerator | |
|---|---|
| CoR_GONEXT | go to next |
| CoR_RETURN | exit to call chain_api |
Definition at line 11 of file chain_of_responsibility.h.
| ChainElementPart cor_add_function | ( | const int | id, |
| chain_func | func, | ||
| void * | ctx | ||
| ) |
add to chain api
| [in] | id | key id related to chain api |
| [in] | func | chain func |
| [in] | ctx | user defined context information |
| !=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.

| void cor_call | ( | const int | id, |
| void * | arg | ||
| ) |
call chain api
| [in] | id | key id related to chain api |
| [in] | arg | input parameter pointer, related to function |
Definition at line 112 of file chain_of_responsibility.c.

| void cor_clear | ( | void | ) |
clear all list
Definition at line 144 of file chain_of_responsibility.c.

| void cor_remove_chain_element_part | ( | const int | id, |
| ChainElementPart | element | ||
| ) |
remove to chain api
| [in] | id | key id related to chain api |
| [in] | element | chain element returned at cor_add_function |
Definition at line 133 of file chain_of_responsibility.c.

| void cor_remove_function | ( | const int | id, |
| chain_func | func | ||
| ) |
remove to chain api
| [in] | id | key id related to chain api |
| [in] | func | chain api func |
Definition at line 122 of file chain_of_responsibility.c.

| void cor_set_threadsafe | ( | int | is_threadsafe | ) |
set thredsafe
| [in] | is_threadsafe | 1 if you want to use threadsafe. |
Definition at line 86 of file chain_of_responsibility.c.