source: trunk/IPs/systemC/processor/Morpheo/Common/include/ErrorMorpheo.h @ 82

Last change on this file since 82 was 82, checked in by rosiere, 16 years ago
  • support locale (now must "just" translate)
  • update all component with new test format
  • update all component with usage
  • New component : decod queue and prediction_unit
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1#ifndef morpheo_ErrorMorpheo
2#define morpheo_ErrorMorpheo
3
4/*
5 * $Id: ErrorMorpheo.h 82 2008-05-01 16:48:45Z rosiere $
6 *
7 * [ Description ]
8 *
9 */
10
11#include "ToString.h"
12#include <iostream>
13#include <exception>
14
15namespace morpheo              {
16
17#define ERRORMORPHEO(funcname,msg) ErrorMorpheo(funcname,msg,__LINE__,__FILE__)
18
19  class ErrorMorpheo : public std::exception
20  {
21    // -----[ fields ]----------------------------------------------------
22  private : std::string _msg;
23   
24    // -----[ methods ]---------------------------------------------------
25  public  :             ErrorMorpheo  ()                throw() {_msg="Exception detected ...";}
26  public  :             ErrorMorpheo  (std::string msg) throw() {_msg=msg;}
27  public  :             ErrorMorpheo  (std::string funcname,
28                                       std::string msg     ,
29                                       int         line    ,
30                                       std::string file    ) throw() 
31    { 
32      _msg = toString("<%s> at line %d, in file %s : %s",funcname.c_str(),line,file.c_str(),msg.c_str());
33    }
34  public  :             ~ErrorMorpheo (void)       throw() {}
35  public  : const char* what          ()    const  throw() { return ( _msg.c_str() );}
36
37  };
38
39  class TestMorpheo : public std::exception
40  {
41    // -----[ fields ]----------------------------------------------------
42  private : std::string _msg;
43   
44    // -----[ methods ]---------------------------------------------------
45  public  :             TestMorpheo   ()                throw() {_msg="Test error ...";}
46  public  :             TestMorpheo   (std::string msg) throw() {_msg=msg;}
47  public  :             ~TestMorpheo  (void)            throw() {}
48  public  : const char* what          ()    const       throw() { return ( _msg.c_str() );}
49  };
50
51}; // end namespace morpheo             
52
53#endif
Note: See TracBrowser for help on using the repository browser.