Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/MsqInterrupt.hpp
Go to the documentation of this file.
1 /* *****************************************************************
2  MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4  Copyright 2004 Sandia Corporation and Argonne National
5  Laboratory. Under the terms of Contract DE-AC04-94AL85000
6  with Sandia Corporation, the U.S. Government retains certain
7  rights in this software.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  (lgpl.txt) along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 
23  ***************************************************************** */
24 
25 #ifndef MSQ_INTERRUPT_HPP
26 #define MSQ_INTERRUPT_HPP
27 
28 #include "MsqError.hpp"
29 
30 namespace Mesquite {
31 
52 {
53 public:
54 
56  static void disable( MsqError& err );
58  static void allow( MsqError& err );
60  static void enable( MsqError& err );
61 
63  static bool interrupt() { return sawInterrupt; }
65  static void clear() { sawInterrupt = false; }
67  static void set_interrupt() { sawInterrupt = true; }
68 
71  MsqInterrupt();
74  ~MsqInterrupt();
75 
76  static void set_handler();
77 
78 private:
79 
81 
83  static unsigned instanceCount;
84  static bool sawInterrupt;
85 
86  // Don't allow any of this stuff (make them private)
87  void* operator new(size_t size);
88  MsqInterrupt( const MsqInterrupt& );
90 };
91 }
92 
93 #endif
94 
MsqInterrupt & operator=(const MsqInterrupt &)
static bool interrupt()
Check if an interrupt was seen.
Used to hold the error state and return it to the application.
MsqInterrupt()
Constructor, increment instance count.
~MsqInterrupt()
Constructor, decrement instance count.
static void set_interrupt()
Set the interrupt flag.
static void allow(MsqError &err)
Allow Mesquite to register a SIGINT handler.
static void disable(MsqError &err)
Disable Mesquite's SIGINT handler.
static InterruptMode interruptMode
static void enable(MsqError &err)
Force Mesquite to register SIGINT handler.
static void clear()
Clear the interrupt flag.
Class to watch for user-interrupt (SIGINT, ctrl-C)