#ifndef ROOT_TSysEvtHandler
#define ROOT_TSysEvtHandler
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TQObject
#include "TQObject.h"
#endif
class TSysEvtHandler : public TObject, public TQObject {
private:
Bool_t fIsActive;
void *GetSender() { return this; }
public:
TSysEvtHandler() : fIsActive(kTRUE) { }
virtual ~TSysEvtHandler() { }
void Activate();
void DeActivate();
Bool_t IsActive() const { return fIsActive; }
virtual void Add() = 0;
virtual void Remove() = 0;
virtual Bool_t Notify() = 0;
virtual void Activated() { Emit("Activated()"); }
virtual void DeActivated() { Emit("DeActivated()"); }
virtual void Notified() { Emit("Notified()"); }
virtual void Added() { Emit("Added()"); }
virtual void Removed() { Emit("Removed()"); }
ClassDef(TSysEvtHandler,0)
};
class TFileHandler : public TSysEvtHandler {
protected:
int fFileNum;
int fMask;
int fReadyMask;
TFileHandler(): fFileNum(-1), fMask(0), fReadyMask(0) { }
public:
enum { kRead = 1, kWrite = 2 };
TFileHandler(int fd, int mask);
virtual ~TFileHandler() { Remove(); }
int GetFd() const { return fFileNum; }
void SetFd(int fd) { fFileNum = fd; }
virtual Bool_t Notify();
virtual Bool_t ReadNotify();
virtual Bool_t WriteNotify();
virtual Bool_t HasReadInterest();
virtual Bool_t HasWriteInterest();
virtual void SetInterest(Int_t mask);
virtual void ResetReadyMask() { fReadyMask = 0; }
virtual void SetReadReady() { fReadyMask |= 0x1; }
virtual void SetWriteReady() { fReadyMask |= 0x2; }
virtual Bool_t IsReadReady() const { return (fReadyMask & 0x1) == 0x1; }
virtual Bool_t IsWriteReady() const { return (fReadyMask & 0x2) == 0x2; }
virtual void Add();
virtual void Remove();
ClassDef(TFileHandler,0)
};
enum ESignals {
kSigBus,
kSigSegmentationViolation,
kSigSystem,
kSigPipe,
kSigIllegalInstruction,
kSigQuit,
kSigInterrupt,
kSigWindowChanged,
kSigAlarm,
kSigChild,
kSigUrgent,
kSigFloatingException,
kSigTermination,
kSigUser1,
kSigUser2
};
class TSignalHandler : public TSysEvtHandler {
protected:
ESignals fSignal;
Bool_t fSync;
Int_t fDelay;
TSignalHandler(): fSignal((ESignals)-1), fSync(kTRUE), fDelay(0) { }
public:
TSignalHandler(ESignals sig, Bool_t sync = kTRUE);
virtual ~TSignalHandler() { Remove(); }
void Delay() { fDelay = 1; }
void HandleDelayedSignal();
ESignals GetSignal() const { return fSignal; }
void SetSignal(ESignals sig) { fSignal = sig; }
Bool_t IsSync() const { return fSync; }
Bool_t IsAsync() const { return !fSync; }
virtual Bool_t Notify();
virtual void Add();
virtual void Remove();
ClassDef(TSignalHandler,0)
};
inline void TSignalHandler::HandleDelayedSignal()
{
if (fDelay > 1) {
fDelay = 0;
Notify();
} else
fDelay = 0;
}
namespace std { class exception; }
class TStdExceptionHandler : public TSysEvtHandler {
public:
enum EStatus { kSEProceed, kSEHandled, kSEAbort };
TStdExceptionHandler();
virtual ~TStdExceptionHandler() { }
virtual void Add();
virtual void Remove();
virtual Bool_t Notify();
virtual EStatus Handle(std::exception& exc) = 0;
ClassDef(TStdExceptionHandler,0)
};
#endif
Last change: Wed Jun 25 08:39:01 2008
Last generated: 2008-06-25 08:39
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.