PosixSignalDispatcher.h
Go to the documentation of this file.
//
// C++ Interface: %{MODULE}
//
// Description:
//
//
// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef _PosixSignalDispatcher_h_
#define _PosixSignalDispatcher_h_
#include <stdexcept>
/*
* Forward declarations.
*/
class PosixSignalHandler ;
class PosixSignalDispatcher
{
public:
static PosixSignalDispatcher& Instance() ;
class CannotAttachHandler : public std::runtime_error
{
public:
CannotAttachHandler( const std::string& whatArg ) :
runtime_error(whatArg) { }
} ;
class CannotDetachHandler : public std::runtime_error
{
public:
CannotDetachHandler( const std::string& whatArg ) :
runtime_error(whatArg) { }
} ;
void AttachHandler( const int posixSignalNumber,
PosixSignalHandler& signalHandler )
throw( CannotAttachHandler ) ;
void DetachHandler( const int posixSignalNumber,
const PosixSignalHandler& signalHandler )
throw( CannotDetachHandler,
std::logic_error ) ;
private:
PosixSignalDispatcher() ;
~PosixSignalDispatcher() ;
PosixSignalDispatcher( const PosixSignalDispatcher& otherInstance ) ;
const PosixSignalDispatcher&
operator=( const PosixSignalDispatcher& otherInstance ) ;
} ;
#endif
PosixSignalHandler
Gets a method called when the corresponding signal is received.
Definition: PosixSignalHandler.h:9
PosixSignalDispatcher::DetachHandler
void DetachHandler(const int posixSignalNumber, const PosixSignalHandler &signalHandler)
Detach the specified signal handler from the signal dispatcher.
PosixSignalDispatcher::CannotAttachHandler::CannotAttachHandler
CannotAttachHandler(const std::string &whatArg)
Definition: PosixSignalDispatcher.h:50
PosixSignalDispatcher::CannotDetachHandler
Exception thrown when DetachHandler() fails due to a runtime error.
Definition: PosixSignalDispatcher.h:58
PosixSignalDispatcher::CannotDetachHandler::CannotDetachHandler
CannotDetachHandler(const std::string &whatArg)
Definition: PosixSignalDispatcher.h:61
PosixSignalDispatcher::CannotAttachHandler
Exception thrown when AttachHandler() fails due to a runtime error.
Definition: PosixSignalDispatcher.h:47
PosixSignalDispatcher
Definition: PosixSignalDispatcher.h:33
PosixSignalDispatcher::Instance
static PosixSignalDispatcher & Instance()
This is a singleton class and there is only one instance of this class per process.
PosixSignalDispatcher::PosixSignalDispatcher
PosixSignalDispatcher()
This is a singleton class and the only instances of this class can only be accessed using the Instanc...
PosixSignalDispatcher::operator=
const PosixSignalDispatcher & operator=(const PosixSignalDispatcher &otherInstance)
Copying of an instance of this class is not allowed.
PosixSignalDispatcher::AttachHandler
void AttachHandler(const int posixSignalNumber, PosixSignalHandler &signalHandler)
Attach a signal handler to the signal dispatcher.
PosixSignalDispatcher::~PosixSignalDispatcher
~PosixSignalDispatcher()
This class cannot be subclassed.