Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
CrashHandler.h
1 /*
2  * $Id$
3  * Copyright (c) 2007, IRIT - UPS
4  *
5  * CrashHandler class interface
6  */
7 #ifndef ELM_DEBUG_CRASH_HANDLER_H
8 #define ELM_DEBUG_CRASH_HANDLER_H
9 
10 #include <elm/types.h>
11 
12 namespace elm {
13 
14 // CrashHandler class
15 class CrashHandler {
16 public:
17  static const t::uint32
18  DEBUG = 0x01,
19  INT = 0x02;
20  typedef t::uint32 mode_t;
21 
22  static void set(CrashHandler *handler, mode_t mode);
23  static inline CrashHandler *get(void) { return current_handler; }
24  static inline mode_t mode(void) { return _mode; }
25  static void crash(void);
27 
28  virtual void setup(void);
29  virtual void handle(void);
30  virtual void cleanup(void);
31 
32 protected:
33  inline CrashHandler(void) { }
34  virtual ~CrashHandler(void) { }
35 
36 private:
37  static mode_t _mode;
38  static CrashHandler *current_handler;
39 };
40 
41 // NoCrashHandler class
43 public:
44  virtual void setup(void) { }
45  virtual void handle(void) { }
46  virtual void cleanup(void) { }
47 };
48 
49 } // elm
50 
51 #endif // ELM_DEBUG_CRASH_HANDLER_H
elm::CrashHandler::DEBUG
static const t::uint32 DEBUG
Definition: CrashHandler.h:18
elm::CrashHandler::CrashHandler
CrashHandler(void)
Definition: CrashHandler.h:33
elm::CrashHandler::INT
static const t::uint32 INT
Definition: CrashHandler.h:19
elm::CrashHandler::handle
virtual void handle(void)
Definition: debug_CrashHandler.cpp:149
elm::CrashHandler::crash
static void crash(void)
Definition: debug_CrashHandler.cpp:90
elm::NoCrashHandler::handle
virtual void handle(void)
Definition: CrashHandler.h:45
elm::NoCrashHandler::cleanup
virtual void cleanup(void)
Definition: CrashHandler.h:46
elm
Definition: adapter.h:26
elm::CrashHandler::mode
static mode_t mode(void)
Definition: CrashHandler.h:24
elm::CrashHandler::setup
virtual void setup(void)
Definition: debug_CrashHandler.cpp:110
elm::CrashHandler
Definition: CrashHandler.h:15
elm::NoCrashHandler::setup
virtual void setup(void)
Definition: CrashHandler.h:44
elm::CrashHandler::~CrashHandler
virtual ~CrashHandler(void)
Definition: CrashHandler.h:34
elm::CrashHandler::mode_t
t::uint32 mode_t
Definition: CrashHandler.h:20
elm::t::uint32
unsigned int uint32
Definition: arch.h:31
elm::CrashHandler::cleanup
virtual void cleanup(void)
Definition: debug_CrashHandler.cpp:157
elm::CrashHandler::set
static void set(CrashHandler *handler, mode_t mode)
Definition: debug_CrashHandler.cpp:68
elm::NoCrashHandler
Definition: CrashHandler.h:42
elm::CrashHandler::get
static CrashHandler * get(void)
Definition: CrashHandler.h:23
elm::CrashHandler::DEFAULT
static CrashHandler DEFAULT
Definition: CrashHandler.h:26