ASSA::SigHandlersList Class Reference

SigHandlersList class. More...

#include <SigHandlersList.h>

List of all members.

Public Types

typedef EventHandlerkey_type
typedef EventHandlerdata_type
typedef set< key_type, CompSHLset_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_Handlercfunc_handler (CFUNC_Handler *cfp_)
 Save 3rd party C function handler to remember.
CFUNC_Handlercfunc_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 SigHandlersListinstance (int signum_)
 Retrieve a pointer to the list of event handlers listening to signum_ signal delivery.

Static Public Attributes

static SigHandlersListm_instance [NSIG]
 Static map of signal numbers to SigHandlerLists.

Protected Member Functions

 SigHandlersList ()
 SigHandlersList (const SigHandlersList &map_)
SigHandlersListoperator= (const SigHandlersList &map_)

Private Attributes

set_tm_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_Handlerm_cfhp
 Pointer to the 3rd party signal handler in the set.

Classes

struct  CompSHL


Detailed Description

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 63 of file SigHandlersList.h.


Member Typedef Documentation

typedef EventHandler* ASSA::SigHandlersList::data_type
 

Definition at line 67 of file SigHandlersList.h.

typedef set< key_type, CompSHL >::iterator ASSA::SigHandlersList::iterator
 

Definition at line 80 of file SigHandlersList.h.

typedef EventHandler* ASSA::SigHandlersList::key_type
 

Definition at line 66 of file SigHandlersList.h.

typedef set< key_type, CompSHL > ASSA::SigHandlersList::set_t
 

Definition at line 79 of file SigHandlersList.h.


Constructor & Destructor Documentation

ASSA::SigHandlersList::~SigHandlersList  )  [inline]
 

Destructor.

Definition at line 190 of file SigHandlersList.h.

References erase(), m_set, ASSA::SIGHAND, and trace_with_mask.

00191 {
00192     trace_with_mask("SigHandlersList::~SigHandlersList", SIGHAND);
00193 
00194     erase ();
00195     delete m_set;
00196     m_set = NULL;
00197 }

ASSA::SigHandlersList::SigHandlersList  )  [inline, protected]
 

Definition at line 180 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by instance().

00181     : m_seen_cfh (false), m_cfhp (NULL)
00182 {
00183     trace_with_mask("SigHandlersList::SigHandlersList", SIGHAND);
00184 
00185     m_set = new set_t;
00186 }

ASSA::SigHandlersList::SigHandlersList const SigHandlersList map_  )  [protected]
 


Member Function Documentation

SigHandlersList::iterator ASSA::SigHandlersList::begin  )  [inline]
 

Return an iterator pointing to the beginning of the list.

Definition at line 298 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::dispatch().

00299 {
00300     trace_with_mask("SigHandlersList::begin()", SIGHAND);
00301 
00302     return m_set->begin ();
00303 }

CFUNC_Handler * ASSA::SigHandlersList::cfunc_handler  )  const [inline]
 

Retrieve pointer to 3rd party C function handler.

Returns:
3rd party C function handler.

Definition at line 338 of file SigHandlersList.h.

References m_cfhp, ASSA::SIGHAND, and trace_with_mask.

00339 {
00340     trace_with_mask("SigHandlersList::cfunc_handler", SIGHAND);
00341     
00342     return m_cfhp;
00343 }

CFUNC_Handler * ASSA::SigHandlersList::cfunc_handler CFUNC_Handler cfp_  )  [inline]
 

Save 3rd party C function handler to remember.

Parameters:
cfp_ New 3rd party C function handler. If it is NULL, then seen_cfh flag is set to FALSE.
Returns:
old 3rd party C function handler.

Definition at line 326 of file SigHandlersList.h.

References m_cfhp, m_seen_cfh, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::install().

00327 {
00328     trace_with_mask("SigHandlersList::cfunc_handler", SIGHAND);
00329     
00330     CFUNC_Handler* old_cfhp = m_cfhp;
00331     m_cfhp = cfhp_;
00332     m_seen_cfh = cfhp_ == NULL ? false : true;
00333     return old_cfhp;
00334 }

bool ASSA::SigHandlersList::empty  )  const [inline]
 

Is list empty.

Definition at line 217 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

00218 {
00219     trace_with_mask("SigHandlersList::empty", SIGHAND);
00220 
00221     // true if map is empty, false otherwise
00222 
00223     return m_set->empty ();
00224 }

SigHandlersList::iterator ASSA::SigHandlersList::end  )  [inline]
 

Return an iterator pointing to the end of the list.

Definition at line 307 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::dispatch(), and ASSA::SigHandlers::remove().

00308 {
00309     trace_with_mask("SigHandlersList::end", SIGHAND);
00310 
00311     return m_set->end ();
00312 }

void ASSA::SigHandlersList::erase  )  [inline]
 

Empty event handlers' list.

Definition at line 278 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ~SigHandlersList().

00279 {
00280     // empty the map
00281     trace_with_mask("SigHandlersList::erase(void)", SIGHAND);
00282 
00283     m_set->erase (m_set->begin(), m_set->end());
00284 }

void ASSA::SigHandlersList::erase iterator  it_  )  [inline]
 

Remove an event handler pointed by iterator it_ from the list.

Definition at line 288 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

00289 {
00290     // erase element pointed by iterator
00291     trace_with_mask("SigHandlersList::erase(it_)", SIGHAND);
00292 
00293     m_set->erase(it_);
00294 }

void ASSA::SigHandlersList::erase const key_type  key_  )  [inline]
 

Find and remove event handler key_ from the list.

Definition at line 268 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::dispatch(), and ASSA::SigHandlers::remove().

00269 {
00270     // return number of erased elements
00271     trace_with_mask("SigHandlersList::erase(key_)", SIGHAND);
00272     
00273     m_set->erase (key_);
00274 }

SigHandlersList::iterator ASSA::SigHandlersList::find const key_type  key_  )  [inline]
 

Find event handler by its pointer key_.

Returns:
Iterator to the element.

Definition at line 316 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::remove().

00317 {
00318     trace_with_mask("SigHandlersList::find", SIGHAND);
00319 
00320     return m_set->find (key_);
00321 }

bool ASSA::SigHandlersList::insert data_type  data_  )  [inline]
 

Add an event handler data_ to the list.

Returns:
TRUE on success, FALSE on error.

Definition at line 239 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::install().

00240 {
00241     trace_with_mask("SigHandlersList::insert", SIGHAND);
00242 
00243     /*---
00244       Insert 'eh_' into the set. set::insert() returns a 'pair' object.
00245 
00246       If the set doesn't contain an element that matches 'eh_', insert a 
00247       copy of 'eh_' and returns a 'pair' whose first element is an
00248       iterator positioned at the new element and second element is
00249       'true'.
00250 
00251       If the set already contains an element that matches 'eh_', returns
00252       a pair whose first element is an iterator positioned at the
00253       existing element and second element is false!
00254       ---*/
00255 
00256     set_t::const_iterator it = m_set->find (eh_);
00257 
00258     /*--- Not in the set ---*/
00259     if (it == m_set->end ()) { 
00260         return (m_set->insert (eh_)).second;
00261     }
00262     /*--- Already in the set ---*/
00263     return true;
00264 }

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 201 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().

00202 {
00203     trace_with_mask("SigHandlersList::instance", SIGHAND);
00204 
00205     DL((APP, "m_instance[%d] = 0x%x\n", signum_,
00206         SigHandlersList::m_instance[signum_]));
00207 
00208     if (SigHandlersList::m_instance[signum_] == 0) {
00209         DL((APP, "new SigHandlersList allocated\n"));
00210         SigHandlersList::m_instance[signum_] = new SigHandlersList();
00211     }
00212     return SigHandlersList::m_instance[signum_];
00213 }

SigHandlersList& ASSA::SigHandlersList::operator= const SigHandlersList map_  )  [protected]
 

bool ASSA::SigHandlersList::seen_cfunc_handler  )  const [inline]
 

Returns:
TRUE if we've seen 3rd party C function handler; FALSE otherwise.

Definition at line 356 of file SigHandlersList.h.

References m_seen_cfh, ASSA::SIGHAND, and trace_with_mask.

00357 {
00358     trace_with_mask("SigHandlersList::seen_cfunc_handler", SIGHAND);
00359 
00360     return m_seen_cfh;
00361 }

void ASSA::SigHandlersList::seen_cfunc_handler bool  ft_  )  [inline]
 

Indicate whether 3rd party C function handler was installed.

Parameters:
ft_ TRUE if was, FALSE if not.

Definition at line 347 of file SigHandlersList.h.

References m_seen_cfh, ASSA::SIGHAND, and trace_with_mask.

00348 {
00349     trace_with_mask("SigHandlersList::seen_cfunc_handler", SIGHAND);
00350 
00351     m_seen_cfh = ft_;
00352 }

size_t ASSA::SigHandlersList::size  )  const [inline]
 

Size of the list.

Definition at line 228 of file SigHandlersList.h.

References m_set, ASSA::SIGHAND, and trace_with_mask.

Referenced by ASSA::SigHandlers::remove().

00229 {
00230     trace_with_mask("SigHandlersList::size", SIGHAND);
00231 
00232     // return number of elements in the map
00233 
00234     return m_set->size ();
00235 }


Member Data Documentation

CFUNC_Handler* ASSA::SigHandlersList::m_cfhp [private]
 

Pointer to the 3rd party signal handler in the set.

Definition at line 171 of file SigHandlersList.h.

Referenced by cfunc_handler().

SigHandlersList * SigHandlersList::m_instance [static]
 

Static map of signal numbers to SigHandlerLists.

Definition at line 157 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 167 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 161 of file SigHandlersList.h.

Referenced by begin(), empty(), end(), erase(), find(), insert(), SigHandlersList(), size(), and ~SigHandlersList().


The documentation for this class was generated from the following files:
Generated on Wed Jun 21 01:42:52 2006 for libassa by  doxygen 1.4.6