#include <SigHandlersList.h>
Collaboration diagram for ASSA::SigHandlersList:
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. | |
Classes | |
struct | CompSHL |
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. |
|
Definition at line 82 of file SigHandlersList.h. |
|
Definition at line 68 of file SigHandlersList.h. |
|
Definition at line 81 of file SigHandlersList.h. |
|
Destructor.
Definition at line 192 of file SigHandlersList.h. References erase(), m_set, ASSA::SIGHAND, and trace_with_mask. 00193 { 00194 trace_with_mask("SigHandlersList::~SigHandlersList", SIGHAND); 00195 00196 erase (); 00197 delete m_set; 00198 m_set = NULL; 00199 }
|
|
Definition at line 182 of file SigHandlersList.h. References m_set, ASSA::SIGHAND, and trace_with_mask. Referenced by instance(). 00183 : m_seen_cfh (false), m_cfhp (NULL) 00184 { 00185 trace_with_mask("SigHandlersList::SigHandlersList", SIGHAND); 00186 00187 m_set = new set_t; 00188 }
|
|
|
|
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(). 00301 { 00302 trace_with_mask("SigHandlersList::begin()", SIGHAND); 00303 00304 return m_set->begin (); 00305 }
|
|
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. 00341 { 00342 trace_with_mask("SigHandlersList::cfunc_handler", SIGHAND); 00343 00344 return m_cfhp; 00345 }
|
|
Save 3rd party C function handler to remember.
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(). 00329 { 00330 trace_with_mask("SigHandlersList::cfunc_handler", SIGHAND); 00331 00332 CFUNC_Handler* old_cfhp = m_cfhp; 00333 m_cfhp = cfhp_; 00334 m_seen_cfh = cfhp_ == NULL ? false : true; 00335 return old_cfhp; 00336 }
|
|
Is list empty.
Definition at line 219 of file SigHandlersList.h. References m_set, ASSA::SIGHAND, and trace_with_mask. 00220 { 00221 trace_with_mask("SigHandlersList::empty", SIGHAND); 00222 00223 // true if map is empty, false otherwise 00224 00225 return m_set->empty (); 00226 }
|
|
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(). 00310 { 00311 trace_with_mask("SigHandlersList::end", SIGHAND); 00312 00313 return m_set->end (); 00314 }
|
|
Empty event handlers' list.
Definition at line 280 of file SigHandlersList.h. References m_set, ASSA::SIGHAND, and trace_with_mask. Referenced by ~SigHandlersList(). 00281 { 00282 // empty the map 00283 trace_with_mask("SigHandlersList::erase(void)", SIGHAND); 00284 00285 m_set->erase (m_set->begin(), m_set->end()); 00286 }
|
|
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. 00291 { 00292 // erase element pointed by iterator 00293 trace_with_mask("SigHandlersList::erase(it_)", SIGHAND); 00294 00295 m_set->erase(it_); 00296 }
|
|
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(), and ASSA::SigHandlers::remove(). 00271 { 00272 // return number of erased elements 00273 trace_with_mask("SigHandlersList::erase(key_)", SIGHAND); 00274 00275 m_set->erase (key_); 00276 }
|
|
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(). 00319 { 00320 trace_with_mask("SigHandlersList::find", SIGHAND); 00321 00322 return m_set->find (key_); 00323 }
|
|
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(). 00242 { 00243 trace_with_mask("SigHandlersList::insert", SIGHAND); 00244 00245 /*--- 00246 Insert 'eh_' into the set. set::insert() returns a 'pair' object. 00247 00248 If the set doesn't contain an element that matches 'eh_', insert a 00249 copy of 'eh_' and returns a 'pair' whose first element is an 00250 iterator positioned at the new element and second element is 00251 'true'. 00252 00253 If the set already contains an element that matches 'eh_', returns 00254 a pair whose first element is an iterator positioned at the 00255 existing element and second element is false! 00256 ---*/ 00257 00258 set_t::const_iterator it = m_set->find (eh_); 00259 00260 /*--- Not in the set ---*/ 00261 if (it == m_set->end ()) { 00262 return (m_set->insert (eh_)).second; 00263 } 00264 /*--- Already in the set ---*/ 00265 return true; 00266 }
|
|
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(). 00204 { 00205 trace_with_mask("SigHandlersList::instance", SIGHAND); 00206 00207 DL((APP, "m_instance[%d] = 0x%x\n", signum_, 00208 SigHandlersList::m_instance[signum_])); 00209 00210 if (SigHandlersList::m_instance[signum_] == 0) { 00211 DL((APP, "new SigHandlersList allocated\n")); 00212 SigHandlersList::m_instance[signum_] = new SigHandlersList(); 00213 } 00214 return SigHandlersList::m_instance[signum_]; 00215 }
|
|
|
|
Definition at line 358 of file SigHandlersList.h. References m_seen_cfh, ASSA::SIGHAND, and trace_with_mask. 00359 { 00360 trace_with_mask("SigHandlersList::seen_cfunc_handler", SIGHAND); 00361 00362 return m_seen_cfh; 00363 }
|
|
Indicate whether 3rd party C function handler was installed.
Definition at line 349 of file SigHandlersList.h. References m_seen_cfh, ASSA::SIGHAND, and trace_with_mask. 00350 { 00351 trace_with_mask("SigHandlersList::seen_cfunc_handler", SIGHAND); 00352 00353 m_seen_cfh = ft_; 00354 }
|
|
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::remove(). 00231 { 00232 trace_with_mask("SigHandlersList::size", SIGHAND); 00233 00234 // return number of elements in the map 00235 00236 return m_set->size (); 00237 }
|
|
Pointer to the 3rd party signal handler in the set.
Definition at line 173 of file SigHandlersList.h. Referenced by cfunc_handler(). |
|
Static map of signal numbers to SigHandlerLists.
Definition at line 159 of file SigHandlersList.h. Referenced by instance(). |
|
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 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(). |