libamxp
1.4.0
Patterns C Implementation
|
Data Structures | |
struct | _amxp_signal_mngr |
Structure containing the signal manager information. More... | |
Typedefs | |
typedef struct _amxp_signal_mngr | amxp_signal_mngr_t |
Structure containing the signal manager information. More... | |
Functions | |
int | amxp_sigmngr_new (amxp_signal_mngr_t **sig_mngr) |
Constructor function, creates a new signal manager instance. More... | |
int | amxp_sigmngr_delete (amxp_signal_mngr_t **sig_mngr) |
Destructor function, deletes a signal manager instance. More... | |
int | amxp_sigmngr_init (amxp_signal_mngr_t *sig_mngr) |
Initializing function, initializes members of the amxp_signal_mngr_t structure. More... | |
int | amxp_sigmngr_clean (amxp_signal_mngr_t *sig_mngr) |
Clean-up functions, cleans-up all members of a amxp_signal_mngr_t structure. More... | |
int | amxp_sigmngr_add_signal (amxp_signal_mngr_t *const sig_mngr, const char *name) |
Adds a signal to a signal manager. More... | |
int | amxp_sigmngr_remove_signal (amxp_signal_mngr_t *const sig_mngr, const char *name) |
Removes a signal from a signal manager. More... | |
amxp_signal_t * | amxp_sigmngr_find_signal (const amxp_signal_mngr_t *const sig_mngr, const char *name) |
Get the pointer to the signal. More... | |
void | amxp_sigmngr_trigger_signal (amxp_signal_mngr_t *const sig_mngr, const char *name, const amxc_var_t *const data) |
Triggers a signal. More... | |
A signal manager is a collection of named signals. It can trigger or emit a signal.
typedef struct _amxp_signal_mngr amxp_signal_mngr_t |
Structure containing the signal manager information.
int amxp_sigmngr_add_signal | ( | amxp_signal_mngr_t *const | sig_mngr, |
const char * | name | ||
) |
Adds a signal to a signal manager.
Creates a new signal with the given name and adds it to the signal manager. If sig_mngr is NULL the newly created signal is added to the global signal manager. A isgnal name must be unique. If a signal with the name already exists in the signal manager, this function fails.
sig_mngr | ponter to the sig_mngr pointer. Will be set to NULL |
name | the name of the signal |
Definition at line 433 of file amxp_signal.c.
int amxp_sigmngr_clean | ( | amxp_signal_mngr_t * | sig_mngr | ) |
Clean-up functions, cleans-up all members of a amxp_signal_mngr_t structure.
All signals of the signal manager will be removed, all connected slots will be automatically disconnected
sig_mngr | pointer to a amxp_signal_mngr_t structure |
Definition at line 405 of file amxp_signal.c.
int amxp_sigmngr_delete | ( | amxp_signal_mngr_t ** | sig_mngr | ) |
Destructor function, deletes a signal manager instance.
All signals of the signal manager will be removed, all connected slots will be automatically disconnected
sig_mngr | ponter to the sig_mngr pointer. Will be set to NULL |
Definition at line 349 of file amxp_signal.c.
amxp_signal_t* amxp_sigmngr_find_signal | ( | const amxp_signal_mngr_t *const | sig_mngr, |
const char * | name | ||
) |
Get the pointer to the signal.
Searches the signal manager for the given signal, if no signal is found with the given name, the functions returns a NULL pointer.
When sig_mngr is NULL, the signal is searched in the global signal manager.
The returned pointer can be used in all amxp signal functions that take a pointer to amxp_signal_t struct
sig_mngr | ponter to the sig_mngr pointer. Will be set to NULL |
name | the name of the signal |
Definition at line 475 of file amxp_signal.c.
int amxp_sigmngr_init | ( | amxp_signal_mngr_t * | sig_mngr | ) |
Initializing function, initializes members of the amxp_signal_mngr_t structure.
Use this function when the amxp_signal_mngr_t structure is declared on the stack. It will initialize all members of this structure.
sig_mngr | pointer to a amxp_signal_mngr_t structure |
Definition at line 377 of file amxp_signal.c.
int amxp_sigmngr_new | ( | amxp_signal_mngr_t ** | sig_mngr | ) |
Constructor function, creates a new signal manager instance.
This function allocates memory, to free the allocated memory use the destruction function amxp_sigmngr_delete
sig_mngr | where to store the sig_mngr pointer |
Definition at line 330 of file amxp_signal.c.
int amxp_sigmngr_remove_signal | ( | amxp_signal_mngr_t *const | sig_mngr, |
const char * | name | ||
) |
Removes a signal from a signal manager.
When sig_mngr is NULL, the signal will be removed from the global signal manager.
If no signal is found in the the signal manager with the given name, this function fails.
sig_mngr | ponter to the sig_mngr pointer. Will be set to NULL |
name | the name of the signal |
Definition at line 448 of file amxp_signal.c.
void amxp_sigmngr_trigger_signal | ( | amxp_signal_mngr_t *const | sig_mngr, |
const char * | name, | ||
const amxc_var_t *const | data | ||
) |
Triggers a signal.
Searches the signal manager for the given signal and triggers the signal. This function is basically the same as calling amxp_sigmngr_find_signal and amxp_signal_trigger in sequence.
When sig_mngr is NULL, the signal is searched in the global signal manager.
When no signal is found with the given name, nothing is done.
sig_mngr | ponter to the sig_mngr pointer. Will be set to NULL |
name | the name of the signal |
data | the data that is passed to all the slots. |
Definition at line 492 of file amxp_signal.c.