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

Contents of /chewbacca/event/Exception.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Sep 23 07:19:52 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: v0r00
CVS Tags: v1r02, v1r00, v1r01, start
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Imported sources, 23/09/2008

1 /** @file
2 * $Source: /repository/event/Exception.h,v $
3 * $Id: Exception.h,v 1.3 2008-03-04 18:07:25 messineo Exp $
4 * $Author: messineo $
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::CalibException(const char* msg): Exception(msg) {}
37 CalibException::~CalibException () throw(){ }
38 };
39
40 //marco:
41 class WrongCRCException_PKTUsed: public Exception {
42 public:
43 WrongCRCException_PKTUsed::WrongCRCException_PKTUsed(const char* msg): Exception(msg) {}
44 WrongCRCException_PKTUsed::~WrongCRCException_PKTUsed () throw(){ }
45 };
46
47 //marco:
48 class FatalException: public Exception {
49 public:
50 FatalException::FatalException(const char* msg): Exception(msg) {}
51 FatalException::~FatalException () throw(){ }
52 };
53
54 class NotFoundEnvironmentVarException: public Exception {
55 public:
56 NotFoundEnvironmentVarException::NotFoundEnvironmentVarException(const char* msg): Exception(msg) {}
57 NotFoundEnvironmentVarException::~NotFoundEnvironmentVarException () throw(){ }
58 };
59
60 class UnidentifiedPacketException: public Exception {
61 private:
62 UINT8 pktId;
63 public:
64 UnidentifiedPacketException::UnidentifiedPacketException(UINT8 id):
65 Exception("Unidentified PacketType - Id: ") {
66 pktId = id;
67 }
68 UnidentifiedPacketException::~UnidentifiedPacketException () throw(){ }
69 const char* UnidentifiedPacketException::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::WrongCRCException(const char* msg): Exception(msg) {}
78 WrongCRCException::~WrongCRCException () throw(){ }
79 };
80
81 class WrongCRCHeaderException: public Exception {
82 public:
83 WrongCRCHeaderException::WrongCRCHeaderException(const char* msg): Exception(msg) {}
84 WrongCRCHeaderException::~WrongCRCHeaderException () throw(){ }
85 };
86
87
88 class LengthException: public Exception {
89 public:
90 LengthException::LengthException(const char* msg): Exception(msg) { }
91 LengthException::~LengthException () throw(){ }
92 };
93
94
95 class NotExistingAlgorithmException: public Exception {
96 public:
97 NotExistingAlgorithmException::NotExistingAlgorithmException(const char *msg): Exception(msg) { }
98 NotExistingAlgorithmException::~NotExistingAlgorithmException () throw(){ }
99 };
100
101 class NotExistingCounterException: public Exception {
102 public:
103 NotExistingCounterException::NotExistingCounterException(const char *msg): Exception(msg) { }
104 NotExistingCounterException::~NotExistingCounterException () throw(){ }
105 };
106
107 class BackwardCounterException: public Exception {
108 public:
109 BackwardCounterException::BackwardCounterException(const char *msg): Exception(msg) { }
110 BackwardCounterException::~BackwardCounterException () throw(){ }
111 };
112 }
113 #endif /* EXCEPTION_H */

  ViewVC Help
Powered by ViewVC 1.1.23