ITK  5.2.0
Insight Toolkit
itkFloatingPointExceptions.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkFloatingPointExceptions_h
19 #define itkFloatingPointExceptions_h
20 
21 #include "itkMacro.h" // for ITKCommon_EXPORT
22 #include "itkSingletonMacro.h"
23 
24 namespace itk
25 {
31 {
32 public:
36  enum class ExceptionAction : uint8_t
37  {
38  ABORT,
39  EXIT
40  };
41 };
42 // Define how to print enumeration
43 extern ITKCommon_EXPORT std::ostream &
44  operator<<(std::ostream & out, const FloatingPointExceptionsEnums::ExceptionAction value);
45 
53 struct ExceptionGlobals;
54 
55 class ITKCommon_EXPORT FloatingPointExceptions
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_ASSIGN(FloatingPointExceptions);
59  // default constructor required for wrapping to succeed
60  FloatingPointExceptions() = default;
61  virtual ~FloatingPointExceptions() = default;
62 
64 #if !defined(ITK_LEGACY_REMOVE)
65 
67  static constexpr ExceptionActionEnum ABORT = ExceptionActionEnum::ABORT;
68  static constexpr ExceptionActionEnum EXIT = ExceptionActionEnum::EXIT;
69 #endif
70 
82  static void
83  Enable();
84 
89  static void
90  Disable();
91 
93  static bool
94  GetEnabled();
95 
100  static void
101  SetEnabled(bool val);
102 
104  static void
105  SetExceptionAction(ExceptionActionEnum a);
106 
108  static ExceptionActionEnum
109  GetExceptionAction();
110 
112  static bool
113  HasFloatingPointExceptionsSupport();
114 
115 private:
116  itkGetGlobalDeclarationMacro(ExceptionGlobals, PimplGlobals);
118  static ExceptionGlobals * m_PimplGlobals;
119 };
120 } // namespace itk
121 
122 #endif
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:213
itkSingletonMacro.h
itk::FloatingPointExceptions
Definition: itkFloatingPointExceptions.h:55
itk::FloatingPointExceptionsEnums::ExceptionAction::ABORT
itkMacro.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkGetGlobalDeclarationMacro
#define itkGetGlobalDeclarationMacro(Type, VarName)
Definition: itkSingletonMacro.h:34
itk::FloatingPointExceptionsEnums::ExceptionAction
ExceptionAction
Definition: itkFloatingPointExceptions.h:36
itk::FloatingPointExceptionsEnums::ExceptionAction::EXIT
ExceptionAction
itk::FloatingPointExceptionsEnums
Contains all enum classes used by FloatingPointExceptions class.
Definition: itkFloatingPointExceptions.h:30
itk::FloatingPointExceptions::m_PimplGlobals
static ExceptionGlobals * m_PimplGlobals
Definition: itkFloatingPointExceptions.h:118