libassa 3.5.0
|
SigHandlersList class. More...
#include <SigHandlersList.h>
Classes | |
struct | CompSHL |
Public Types | |
typedef EventHandler * | key_type |
typedef EventHandler * | data_type |
typedef set< key_type, CompSHL > | set_t |
typedef set< key_type, CompSHL > ::iterator | iterator |
Public Member Functions | |
~SigHandlersList () | |
Destructor. | |
bool | empty () const |
Is list empty. | |
size_t | size () const |
Size of the list. | |
bool | insert (data_type data_) |
Add an event handler data_ to the list. | |
void | erase (const key_type key_) |
Find and remove event handler key_ from the list. | |
void | erase (iterator it_) |
Remove an event handler pointed by iterator it_ from the list. | |
void | erase () |
Empty event handlers' list. | |
iterator | begin () |
Return an iterator pointing to the beginning of the list. | |
iterator | end () |
Return an iterator pointing to the end of the list. | |
iterator | find (const key_type key_) |
Find event handler by its pointer key_. | |
CFUNC_Handler * | cfunc_handler (CFUNC_Handler *cfp_) |
Save 3rd party C function handler to remember. | |
CFUNC_Handler * | cfunc_handler () const |
Retrieve pointer to 3rd party C function handler. | |
void | seen_cfunc_handler (bool ft_) |
Indicate whether 3rd party C function handler was installed. | |
bool | seen_cfunc_handler () const |
Static Public Member Functions | |
static SigHandlersList * | instance (int signum_) |
Retrieve a pointer to the list of event handlers listening to signum_ signal delivery. | |
Static Public Attributes | |
static SigHandlersList * | m_instance [NSIG] |
Static map of signal numbers to SigHandlerLists. | |
Protected Member Functions | |
SigHandlersList () | |
SigHandlersList (const SigHandlersList &map_) | |
SigHandlersList & | operator= (const SigHandlersList &map_) |
Private Attributes | |
set_t * | m_set |
Set of all event handlers registered for this signal. | |
int | m_seen_cfh |
If true this flag indicates that 3rd party event handler has already been installed prior taking control by SigHandlers manager. | |
CFUNC_Handler * | m_cfhp |
Pointer to the 3rd party signal handler in the set. |
SigHandlersList class.
SigHandlersList class is used by SigHandlers class to keep track of EventHandlers installed to be called on signal's delivery. It is sort of global process map of signal numbers into corresponding sets of EventHandlers that are listening for signal delivery.
Definition at line 65 of file SigHandlersList.h.
Definition at line 69 of file SigHandlersList.h.
typedef set< key_type, CompSHL >::iterator ASSA::SigHandlersList::iterator |
Definition at line 82 of file SigHandlersList.h.
Definition at line 68 of file SigHandlersList.h.
typedef set< key_type, CompSHL > ASSA::SigHandlersList::set_t |
Definition at line 81 of file SigHandlersList.h.
ASSA::SigHandlersList::~SigHandlersList | ( | ) | [inline] |
Destructor.
Definition at line 192 of file SigHandlersList.h.
References erase(), m_set, ASSA::SIGHAND, and trace_with_mask.
{ trace_with_mask("SigHandlersList::~SigHandlersList", SIGHAND); erase (); delete m_set; m_set = NULL; }
ASSA::SigHandlersList::SigHandlersList | ( | ) | [inline, protected] |
Definition at line 182 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by instance().
: m_seen_cfh (false), m_cfhp (NULL) { trace_with_mask("SigHandlersList::SigHandlersList", SIGHAND); m_set = new set_t; }
ASSA::SigHandlersList::SigHandlersList | ( | const SigHandlersList & | map_ | ) | [protected] |
SigHandlersList::iterator ASSA::SigHandlersList::begin | ( | ) | [inline] |
Return an iterator pointing to the beginning of the list.
Definition at line 300 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::dispatch().
{ trace_with_mask("SigHandlersList::begin()", SIGHAND); return m_set->begin (); }
CFUNC_Handler * ASSA::SigHandlersList::cfunc_handler | ( | CFUNC_Handler * | cfp_ | ) | [inline] |
Save 3rd party C function handler to remember.
cfp_ | New 3rd party C function handler. If it is NULL, then seen_cfh flag is set to FALSE. |
Definition at line 328 of file SigHandlersList.h.
References m_cfhp, m_seen_cfh, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::install(), and ASSA::SigHandlers::remove().
{ trace_with_mask("SigHandlersList::cfunc_handler", SIGHAND); CFUNC_Handler* old_cfhp = m_cfhp; m_cfhp = cfhp_; m_seen_cfh = cfhp_ == NULL ? false : true; return old_cfhp; }
CFUNC_Handler * ASSA::SigHandlersList::cfunc_handler | ( | ) | const [inline] |
Retrieve pointer to 3rd party C function handler.
Definition at line 340 of file SigHandlersList.h.
References m_cfhp, ASSA::SIGHAND, and trace_with_mask.
{ trace_with_mask("SigHandlersList::cfunc_handler", SIGHAND); return m_cfhp; }
bool ASSA::SigHandlersList::empty | ( | ) | const [inline] |
Is list empty.
Definition at line 219 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
{ trace_with_mask("SigHandlersList::empty", SIGHAND); // true if map is empty, false otherwise return m_set->empty (); }
SigHandlersList::iterator ASSA::SigHandlersList::end | ( | ) | [inline] |
Return an iterator pointing to the end of the list.
Definition at line 309 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::dispatch(), and ASSA::SigHandlers::remove().
{ trace_with_mask("SigHandlersList::end", SIGHAND); return m_set->end (); }
void ASSA::SigHandlersList::erase | ( | const key_type | key_ | ) | [inline] |
Find and remove event handler key_ from the list.
Definition at line 270 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::dispatch(), ASSA::SigHandlers::install(), and ASSA::SigHandlers::remove().
{ // return number of erased elements trace_with_mask("SigHandlersList::erase(key_)", SIGHAND); m_set->erase (key_); }
void ASSA::SigHandlersList::erase | ( | iterator | it_ | ) | [inline] |
Remove an event handler pointed by iterator it_ from the list.
Definition at line 290 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
{ // erase element pointed by iterator trace_with_mask("SigHandlersList::erase(it_)", SIGHAND); m_set->erase(it_); }
void ASSA::SigHandlersList::erase | ( | ) | [inline] |
Empty event handlers' list.
Definition at line 280 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ~SigHandlersList().
{ // empty the map trace_with_mask("SigHandlersList::erase(void)", SIGHAND); m_set->erase (m_set->begin(), m_set->end()); }
SigHandlersList::iterator ASSA::SigHandlersList::find | ( | const key_type | key_ | ) | [inline] |
Find event handler by its pointer key_.
Definition at line 318 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::remove().
{ trace_with_mask("SigHandlersList::find", SIGHAND); return m_set->find (key_); }
bool ASSA::SigHandlersList::insert | ( | data_type | data_ | ) | [inline] |
Add an event handler data_ to the list.
Definition at line 241 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::install().
{ trace_with_mask("SigHandlersList::insert", SIGHAND); /*--- Insert 'eh_' into the set. set::insert() returns a 'pair' object. If the set doesn't contain an element that matches 'eh_', insert a copy of 'eh_' and returns a 'pair' whose first element is an iterator positioned at the new element and second element is 'true'. If the set already contains an element that matches 'eh_', returns a pair whose first element is an iterator positioned at the existing element and second element is false! ---*/ set_t::const_iterator it = m_set->find (eh_); /*--- Not in the set ---*/ if (it == m_set->end ()) { return (m_set->insert (eh_)).second; } /*--- Already in the set ---*/ return true; }
SigHandlersList * ASSA::SigHandlersList::instance | ( | int | signum_ | ) | [inline, static] |
Retrieve a pointer to the list of event handlers listening to signum_ signal delivery.
Definition at line 203 of file SigHandlersList.h.
References ASSA::APP, DL, m_instance, ASSA::SIGHAND, SigHandlersList(), and trace_with_mask.
Referenced by ASSA::SigHandlers::dispatch(), ASSA::SigHandlers::install(), and ASSA::SigHandlers::remove().
{ trace_with_mask("SigHandlersList::instance", SIGHAND); DL((APP, "m_instance[%d] = 0x%x\n", signum_, SigHandlersList::m_instance[signum_])); if (SigHandlersList::m_instance[signum_] == 0) { DL((APP, "new SigHandlersList allocated\n")); SigHandlersList::m_instance[signum_] = new SigHandlersList(); } return SigHandlersList::m_instance[signum_]; }
SigHandlersList& ASSA::SigHandlersList::operator= | ( | const SigHandlersList & | map_ | ) | [protected] |
void ASSA::SigHandlersList::seen_cfunc_handler | ( | bool | ft_ | ) | [inline] |
Indicate whether 3rd party C function handler was installed.
ft_ | TRUE if was, FALSE if not. |
Definition at line 349 of file SigHandlersList.h.
References m_seen_cfh, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::install(), and ASSA::SigHandlers::remove().
{ trace_with_mask("SigHandlersList::seen_cfunc_handler", SIGHAND); m_seen_cfh = ft_; }
bool ASSA::SigHandlersList::seen_cfunc_handler | ( | ) | const [inline] |
Definition at line 358 of file SigHandlersList.h.
References m_seen_cfh, ASSA::SIGHAND, and trace_with_mask.
{ trace_with_mask("SigHandlersList::seen_cfunc_handler", SIGHAND); return m_seen_cfh; }
size_t ASSA::SigHandlersList::size | ( | ) | const [inline] |
Size of the list.
Definition at line 230 of file SigHandlersList.h.
References m_set, ASSA::SIGHAND, and trace_with_mask.
Referenced by ASSA::SigHandlers::install(), and ASSA::SigHandlers::remove().
{ trace_with_mask("SigHandlersList::size", SIGHAND); // return number of elements in the map return m_set->size (); }
CFUNC_Handler* ASSA::SigHandlersList::m_cfhp [private] |
Pointer to the 3rd party signal handler in the set.
Definition at line 173 of file SigHandlersList.h.
Referenced by cfunc_handler().
SigHandlersList * SigHandlersList::m_instance [static] |
Static map of signal numbers to SigHandlerLists.
Definition at line 159 of file SigHandlersList.h.
Referenced by instance().
int ASSA::SigHandlersList::m_seen_cfh [private] |
If true this flag indicates that 3rd party event handler has already been installed prior taking control by SigHandlers manager.
Definition at line 169 of file SigHandlersList.h.
Referenced by cfunc_handler(), and seen_cfunc_handler().
set_t* ASSA::SigHandlersList::m_set [private] |
Set of all event handlers registered for this signal.
Definition at line 163 of file SigHandlersList.h.
Referenced by begin(), empty(), end(), erase(), find(), insert(), SigHandlersList(), size(), and ~SigHandlersList().