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
RevLine 
[2]1#ifndef morpheo_ErrorMorpheo
2#define morpheo_ErrorMorpheo
3
4/*
5 * $Id: ErrorMorpheo.h 82 2008-05-01 16:48:45Z rosiere $
6 *
[71]7 * [ Description ]
[2]8 *
9 */
10
[71]11#include "ToString.h"
[2]12#include <iostream>
13#include <exception>
14
15namespace morpheo              {
16
[71]17#define ERRORMORPHEO(funcname,msg) ErrorMorpheo(funcname,msg,__LINE__,__FILE__)
18
19  class ErrorMorpheo : public std::exception
[2]20  {
21    // -----[ fields ]----------------------------------------------------
[71]22  private : std::string _msg;
[2]23   
24    // -----[ methods ]---------------------------------------------------
[71]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    { 
[82]32      _msg = toString("<%s> at line %d, in file %s : %s",funcname.c_str(),line,file.c_str(),msg.c_str());
[71]33    }
[2]34  public  :             ~ErrorMorpheo (void)       throw() {}
35  public  : const char* what          ()    const  throw() { return ( _msg.c_str() );}
36
37  };
38
[71]39  class TestMorpheo : public std::exception
[3]40  {
41    // -----[ fields ]----------------------------------------------------
[71]42  private : std::string _msg;
[3]43   
44    // -----[ methods ]---------------------------------------------------
[71]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() );}
[3]49  };
50
[2]51}; // end namespace morpheo             
52
53#endif
Note: See TracBrowser for help on using the repository browser.