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

Contents of /chewbacca/event/Exception.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Aug 4 13:58:17 2009 UTC (15 years, 3 months ago) by mocchiut
Branch: MAIN
CVS Tags: v10RED, v9r00, v9r01, HEAD
Changes since 1.1: +26 -26 lines
File MIME type: text/plain
Changed to work with GCC 4.x (gfortran) + ROOT >= 5.24

1 /** @file
2 * $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/Exception.h,v $
3 * $Id: Exception.h,v 1.1.1.1 2008/09/23 07:19:52 mocchiut Exp $
4 * $Author: mocchiut $
5 *
6 * Header file for the exceptions of Pamela.
7 */
8 #ifndef EXCEPTION_H
9 #define EXCEPTION_H
10 #include <exception>
11 #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 {
19
20 class Exception: public exception {
21
22 private:
23
24 protected:
25 const char *message;
26 char buff [100];
27 public:
28 Exception(const char *msg = "message"): message(msg){ }
29 virtual ~Exception () throw(){ }
30 virtual const char* print () const throw () { return message; }
31 };
32
33 //marco:
34 class CalibException: public Exception {
35 public:
36 CalibException(const char* msg): Exception(msg) {}
37 ~CalibException () throw(){ }
38 };
39
40 //marco:
41 class WrongCRCException_PKTUsed: public Exception {
42 public:
43 WrongCRCException_PKTUsed(const char* msg): Exception(msg) {}
44 ~WrongCRCException_PKTUsed () throw(){ }
45 };
46
47 //marco:
48 class FatalException: public Exception {
49 public:
50 FatalException(const char* msg): Exception(msg) {}
51 ~FatalException () throw(){ }
52 };
53
54 class NotFoundEnvironmentVarException: public Exception {
55 public:
56 NotFoundEnvironmentVarException(const char* msg): Exception(msg) {}
57 ~NotFoundEnvironmentVarException () throw(){ }
58 };
59
60 class UnidentifiedPacketException: public Exception {
61 private:
62 UINT8 pktId;
63 public:
64 UnidentifiedPacketException(UINT8 id):
65 Exception("Unidentified PacketType - Id: ") {
66 pktId = id;
67 }
68 ~UnidentifiedPacketException () throw(){ }
69 const char* print () const throw () {
70 sprintf((char*)buff," %s 0x%x", message, pktId);
71 return buff;
72 }
73 };
74
75 class WrongCRCException: public Exception {
76 public:
77 WrongCRCException(const char* msg): Exception(msg) {}
78 ~WrongCRCException () throw(){ }
79 };
80
81 class WrongCRCHeaderException: public Exception {
82 public:
83 WrongCRCHeaderException(const char* msg): Exception(msg) {}
84 ~WrongCRCHeaderException () throw(){ }
85 };
86
87
88 class LengthException: public Exception {
89 public:
90 LengthException(const char* msg): Exception(msg) { }
91 ~LengthException () throw(){ }
92 };
93
94
95 class NotExistingAlgorithmException: public Exception {
96 public:
97 NotExistingAlgorithmException(const char *msg): Exception(msg) { }
98 ~NotExistingAlgorithmException () throw(){ }
99 };
100
101 class NotExistingCounterException: public Exception {
102 public:
103 NotExistingCounterException(const char *msg): Exception(msg) { }
104 ~NotExistingCounterException () throw(){ }
105 };
106
107 class BackwardCounterException: public Exception {
108 public:
109 BackwardCounterException(const char *msg): Exception(msg) { }
110 ~BackwardCounterException () throw(){ }
111 };
112 }
113 #endif /* EXCEPTION_H */

  ViewVC Help
Powered by ViewVC 1.1.23