Sierra Toolkit  Version of the Day
SignalHandler.hpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2002 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef STK_UTIL_DIAG_SignalHandler_hpp
10 #define STK_UTIL_DIAG_SignalHandler_hpp
11 
12 #include <map>
13 
14 #include <stk_util/diag/String.hpp>
16 
17 struct sigaction;
18 
25 namespace sierra {
26 
32 {
33 public:
39  static SignalHandler &instance();
40 
41  static bool check_signal_name(const sierra::String& signal);
42 
48  void handle_signal(int signal);
49 
56  void add_handler(int signal, CallbackBase &callback);
57 
64  void add_handler(const String &signal_name, CallbackBase &callback);
65 
72  void remove_handler(int signal, CallbackBase &callback);
73 
80  void remove_handler(const String &signal_name, CallbackBase &callback);
81 
86  void remove_all_handlers();
87 
88 private:
89  typedef std::multimap<int, CallbackBase *> HandlerMap;
90  typedef std::multimap<int, struct sigaction *> OldActionMap;
91 
92  HandlerMap m_handlerMap;
93  OldActionMap m_oldActionMap;
94 };
95 
96 } // namespace sierra
97 
98 #endif // STK_UTIL_DIAG_SignalHandler_h
Definition: Env.cpp:53
void remove_all_handlers()
Member function remove_all_handlers ...
void remove_handler(int signal, CallbackBase &callback)
Member function remove_handler ...
Class SignalHandler ...
static SignalHandler & instance()
Member function instance ...
void add_handler(int signal, CallbackBase &callback)
Member function add_handler ...
void handle_signal(int signal)
Member function handle_signal ...
Class Callback ...
Definition: Callback.hpp:31