3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Just Standard Profile Kernel
6 * Copyright (C) 2003 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
9 * 上記著作権者は,以下の (1)〜(4) の条件か,Free Software Foundation
10 * によって公表されている GNU General Public License の Version 2 に記
11 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
12 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
14 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
15 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
17 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
18 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
19 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
21 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
22 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
24 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
25 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
26 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
28 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
29 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
31 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
32 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
33 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
34 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
36 * @(#) $Id: except.h,v 1.1 2009/01/31 05:27:37 suikan Exp $
39 // $Header: /cvsroot/toppersjsp4bf/jsp/cfg/base/except.h,v 1.1 2009/01/31 05:27:37 suikan Exp $
45 # pragma warning(disable:4290) //C++ の例外の指定は無視されます。関数が __declspec(nothrow) でないことのみ表示されます。
48 //#include "testsuite.h"
57 static bool is_throwable;
61 std::string classname; //この例外を生成したクラスの名前 (識別用)
62 std::string details; //例外の説明
65 Exception(std::string classname = "Exception", int code = 0, std::string details = "") throw();
66 Exception(std::string classname, std::string details) throw();
70 Exception(const Exception & src) throw();
72 virtual ~Exception(void) throw();
74 //is-an-instance-of関係の評価
75 inline bool isInstanceOf(const char * _classname) const throw()
76 { return classname.compare(_classname) == 0; }
79 inline int getCode(void) const throw()
83 inline std::string getDetails(void) const throw()
86 //現在の例外制御フラグの状態に従って例外を発行する
87 inline bool throwException(void)
95 static void setThrowControl(bool _throwable) throw()
96 { is_throwable = _throwable; }
98 static bool getThrowControl(void) throw()
99 { return is_throwable; }
102 // TESTSUITE_PROTOTYPE(main)
106 #define EXCEPTION(x) class x : public Exception { public: x(void) throw() : Exception(#x) {} };
107 #define EXCEPTION_(x,y) class x : public Exception { public: x(void) throw() : Exception(#x, y) {} };
108 #define EXCEPTION__(x,y,z) class x : public Exception { public: x(void) throw() : Exception(#x, y, z) {} };