⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exceptionutil.h

📁 在使用TAO的事件服务过程中
💻 H
字号:
// ----------------------------------------------------------------------
// ExceptionUtil.h
//
// Copyright 1998, Object Computing, Inc.
// 
// Some simple utilities to ease the pain of dealing with
// CORBA::Exceptions.
// ----------------------------------------------------------------------

#ifndef _ExceptionUtil_h_
#define _ExceptionUtil_h_

#include <tao/corba.h>
#include <ace/streams.h> 

static ostream& operator<<(ostream& os, CORBA::Exception& exc)
{
  // save the id of the exception
  const char* id = exc._id();

  // determine if it is a SystemException or UserException
  CORBA::SystemException* sysexc = CORBA::SystemException::_downcast(&exc);
  if (sysexc != (CORBA::SystemException*)0) {
    os << "CORBA::SystemException: ID " << id << ", "
       << "minor code = 0x" << hex << sysexc->minor() << ", "
       << "completed = ";
    switch(sysexc->completed()) {
      case CORBA::COMPLETED_YES  : os << "YES"    ; break;
      case CORBA::COMPLETED_NO   : os << "NO"     ; break;
      case CORBA::COMPLETED_MAYBE: os << "MAYBE"  ; break;
      default                    : os << "UNKNOWN"; break;
    }
    os << ends;
  }
  else {
    os << "CORBA::Exception: ID " << id << ends;
  }

  return os;
}

#endif // _ExceptionUtil_h_

⌨️ 快捷键说明

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