itkfemexceptiontest.cxx

来自「InsightToolkit-1.4.0(有大量的优化算法程序)」· CXX 代码 · 共 75 行

CXX
75
字号
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: itkFEMExceptionTest.cxx,v $
  Language:  C++
  Date: $Date: 2003/09/10 14:30:11 $
  Version:   $Revision: 1.4 $

  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>

using namespace std;
using namespace itk;
using namespace fem;

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

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

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

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

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

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


⌨️ 快捷键说明

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