Diana  0.8.3
DianaSignals.hpp
00001 /* -----------------------------------------------------------------------------
00002  *  Diana process modelling, simulation and analysis software
00003  *  Copyright (c) 2005, Michael Krasnyk
00004  *  All rights reserved.
00005  *
00006  *  This file is a part of Diana process modelling, simulation and analysis software
00007  *
00008  *  Diana is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published
00010  *  by the Free Software Foundation (see accompanying file LICENSE)
00011  * -----------------------------------------------------------------------------
00012  *  $Id: DianaSignals.hpp 8160 2009-03-16 18:36:30Z miha $
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 #ifndef DIANA_SIGNALS_HPP
00018 #define DIANA_SIGNALS_HPP
00019 
00020 #include <stdio.h>
00021 #include <unistd.h>
00022 #include <signal.h>
00023 #include <stdlib.h>
00024 #include <vector>
00025 #include <Basic/CapeException.hpp>
00026 
00027 namespace Diana{
00033   class DianaINTSignalHandler {
00034   private:
00035     int _state;
00036     static std::vector<DianaINTSignalHandler*> handlers;
00037     static struct sigaction new_action, old_action;
00038     static void handler(int signum);
00039   public:
00040     DianaINTSignalHandler();
00041     ~DianaINTSignalHandler();
00042     int state() const {return _state;}
00043   };
00044 };
00045 
00046 #endif // DIANA_SIGNALS_HPP