/[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 6.0 by kusanagi, Tue Feb 7 17:11:07 2006 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 5.1 2006/02/04 12:37:43 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    
13    #define  UINT32 unsigned int
14    #define  UINT16 unsigned short
15    #define  UINT8  unsigned char
16    
17    using namespace std;
18  namespace pamela {  namespace pamela {
19    class Exception: public std::exception {  
20      class Exception: public exception {
21        
22    private:    private:
23      std::string Name;      
24      protected:
25        const char *message;
26        char buff [100];
27    public:    public:
28      Exception(std::string name): Name(name) {}      Exception(const char *msg = "message"): message(msg){ }
29      virtual ~Exception () throw(){ }      virtual ~Exception () throw(){ }
30      virtual const char* what () const throw () { return Name.c_str(); }      virtual const char* print () const throw () { return message; }
31      };
32    
33      class NotFoundEnvironmentVarException: public Exception {
34      public:
35        NotFoundEnvironmentVarException::NotFoundEnvironmentVarException(const char* msg):  Exception(msg) {}
36        NotFoundEnvironmentVarException::~NotFoundEnvironmentVarException () throw(){ }
37      };
38    
39      class UnidentifiedPacketException: public Exception {
40      private:
41        UINT8     pktId;
42      public:
43        UnidentifiedPacketException::UnidentifiedPacketException(UINT8 id):
44        Exception("Unidentified PacketType - Id: ") {
45            pktId = id;
46        }
47        UnidentifiedPacketException::~UnidentifiedPacketException () throw(){ }
48        const char* UnidentifiedPacketException::print () const throw () {
49            sprintf((char*)buff," %s 0x%x", message, pktId);
50            return buff;
51        }
52      };
53    
54      class WrongCRCException: public Exception {
55      public:
56        WrongCRCException::WrongCRCException(const char* msg):  Exception(msg) {}
57        WrongCRCException::~WrongCRCException () throw(){ }
58      };
59    
60      class WrongCRCHeaderException: public Exception {
61      public:
62        WrongCRCHeaderException::WrongCRCHeaderException(const char* msg):  Exception(msg) {}
63        WrongCRCHeaderException::~WrongCRCHeaderException () throw(){ }
64      };
65    
66    
67      class LengthException: public Exception {
68      public:
69        LengthException::LengthException(const char* msg):  Exception(msg) { }
70        LengthException::~LengthException () throw(){ }
71      };
72    
73    
74      class NotExistingAlgorithmException: public Exception {
75      public:
76        NotExistingAlgorithmException::NotExistingAlgorithmException(const char *msg):  Exception(msg) { }
77        NotExistingAlgorithmException::~NotExistingAlgorithmException () throw(){ }
78      };
79      
80      class NotExistingCounterException: public Exception {
81      public:
82        NotExistingCounterException::NotExistingCounterException(const char *msg):  Exception(msg) { }
83        NotExistingCounterException::~NotExistingCounterException () throw(){ }
84      };
85    
86      class BackwardCounterException: public Exception {
87      public:
88        BackwardCounterException::BackwardCounterException(const char *msg):  Exception(msg) { }
89        BackwardCounterException::~BackwardCounterException () throw(){ }
90    };    };
91  }  }
92    #endif /* EXCEPTION_H */

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

  ViewVC Help
Powered by ViewVC 1.1.23