/[PAMELA software]/yoda/event/Exception.h
ViewVC logotype

Diff of /yoda/event/Exception.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by kusanagi, Tue Jul 6 12:20:23 2004 UTC revision 2.3 by kusanagi, Tue Feb 15 17:53:35 2005 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvspamela/yoda/event/Exception.h,v $   * $Source: /home/cvsmanager/yoda/event/Exception.h,v $
3   * $Id: Exception.h,v 1.6 2004/03/16 10:18:28 nagni Exp $   * $Id: Exception.h,v 2.2 2005/01/11 14:58:20 kusanagi Exp $
4   * $Author: nagni $   * $Author: kusanagi $
5   *   *
6   * Header file for the exceptions of Pamela.   * Header file for the exceptions of Pamela.
7   */   */
8    #ifndef EXCEPTION_H
9    #define EXCEPTION_H
10  #include <exception>  #include <exception>
11  #include <string>  #include <stdio.h>
12    #include "SubPacket.h"
13    
14    using namespace std;
15  namespace pamela {  namespace pamela {
16    class Exception: public std::exception {  
17      class Exception: public exception {
18        
19    private:    private:
20      std::string Name;      
21      protected:
22        const char *message;
23        char buff [100];
24    public:    public:
25      Exception(std::string name): Name(name) {}      Exception(const char *msg = "message"): message(msg){ }
26      virtual ~Exception () throw(){ }      virtual ~Exception () throw(){ }
27      virtual const char* what () const throw () { return Name.c_str(); }      virtual const char* print () const throw () { return message; }
28      };
29    
30      class NotFoundEnvironmentVarException: public Exception {
31      public:
32        NotFoundEnvironmentVarException::NotFoundEnvironmentVarException(const char* msg):  Exception(msg) {}
33        NotFoundEnvironmentVarException::~NotFoundEnvironmentVarException () throw(){ }
34    };    };
35    
36      class UnidentifiedPacketException: public Exception {
37      private:
38        UINT8     pktId;
39      public:
40        UnidentifiedPacketException::UnidentifiedPacketException(UINT8 id):
41        Exception("Unidentified PacketType - Id: ") {
42            pktId = id;
43        }
44        UnidentifiedPacketException::~UnidentifiedPacketException () throw(){ }
45        const char* UnidentifiedPacketException::print () const throw () {
46            sprintf((char*)buff," %s 0x%x", message, pktId);
47            return buff;
48        }
49      };
50    
51      class WrongCRCException: public Exception {
52      public:
53        WrongCRCException::WrongCRCException(const char* msg):  Exception(msg) {}
54        WrongCRCException::~WrongCRCException () throw(){ }
55      };
56    
57      class WrongCRCHeaderException: public Exception {
58      public:
59        WrongCRCHeaderException::WrongCRCHeaderException(const char* msg):  Exception(msg) {}
60        WrongCRCHeaderException::~WrongCRCHeaderException () throw(){ }
61      };
62    
63    
64      class LengthException: public Exception {
65      public:
66        LengthException::LengthException(const char* msg):  Exception(msg) { }
67        LengthException::~LengthException () throw(){ }
68      };
69    
70    
71      class NotExistingAlgorithmException: public Exception {
72      public:
73        NotExistingAlgorithmException::NotExistingAlgorithmException(const char *msg):  Exception(msg) { }
74        NotExistingAlgorithmException::~NotExistingAlgorithmException () throw(){ }
75      };
76      
77      class NotExistingCounterException: public Exception {
78      public:
79        NotExistingCounterException::NotExistingCounterException(const char *msg):  Exception(msg) { }
80        NotExistingCounterException::~NotExistingCounterException () throw(){ }
81      };
82    
83  }  }
84    #endif /* EXCEPTION_H */

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.2.3

  ViewVC Help
Powered by ViewVC 1.1.23