itkfemexceptiontest.cxx

来自「DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.」· CXX 代码 · 共 72 行

CXX
72
字号
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: itkFEMExceptionTest.cxx,v $
  Language:  C++
  Date: $Date: 2003-12-12 14:58:00 $
  Version:   $Revision: 1.5 $

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

// disable debug warnings in MS compiler
#ifdef _MSC_VER
#pragma warning(disable: 4786)
#endif

#include "itkFEMException.h"
#include "itkExceptionObject.h"
#include "itkFEM.h"
#include <iostream>
#include <exception>


int itkFEMExceptionTest(int, char *[])
{
    try {
      throw itk::fem::FEMException(__FILE__,__LINE__, "itkFEMException");
    }
    catch (itk::ExceptionObject &) {
      std::cout << "Exception caught\n";
    }

    try {
      throw itk::fem::FEMExceptionIO(__FILE__,__LINE__,"itkFEMExceptionIO","IO exception");
    }
    catch (itk::ExceptionObject &) {
       std::cout << "IO exception caught\n";
    }

    try {
      throw itk::fem::FEMExceptionWrongClass(__FILE__,__LINE__,"itkFEMExceptionWrongClass");
    }
    catch (itk::ExceptionObject &) {
      std::cout << "Wrong class exception caught\n";
    }

    try {
      throw itk::fem::FEMExceptionObjectNotFound(__FILE__,__LINE__,"itkFEMExceptionObjectNotFound","baseClassName",0);
    }
    catch (itk::ExceptionObject &) {
      std::cout << "Not found exception caught\n";
    }

    try {
      throw itk::fem::FEMExceptionSolution(__FILE__,__LINE__,"itkFEMExceptionSolution","Solution exception");
    }
    catch (itk::ExceptionObject &) {
      std::cout << "Solution exception caught\n";
    }

    std::cout << "Test PASSED!\n";
    return EXIT_SUCCESS;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?