1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/event/Exception.h,v $ |
* $Source: /home/cvsmanager/yoda/event/Exception.h,v $ |
3 |
* $Id: Exception.h,v 2.0 2004/09/21 20:49:57 kusanagi Exp $ |
* $Id: Exception.h,v 5.0 2005/08/29 09:45:48 Maurizio Nagni Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: Maurizio Nagni $ |
5 |
* |
* |
6 |
* Header file for the exceptions of Pamela. |
* Header file for the exceptions of Pamela. |
7 |
*/ |
*/ |
9 |
#define EXCEPTION_H |
#define EXCEPTION_H |
10 |
#include <exception> |
#include <exception> |
11 |
#include <stdio.h> |
#include <stdio.h> |
12 |
#include "SubPacket.h" |
|
13 |
|
#define UINT32 unsigned int |
14 |
|
#define UINT16 unsigned short |
15 |
|
#define UINT8 unsigned char |
16 |
|
|
17 |
using namespace std; |
using namespace std; |
18 |
namespace pamela { |
namespace pamela { |
30 |
virtual const char* print () const throw () { return message; } |
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 { |
class UnidentifiedPacketException: public Exception { |
40 |
private: |
private: |
41 |
UINT8 pktId; |
UINT8 pktId; |
53 |
|
|
54 |
class WrongCRCException: public Exception { |
class WrongCRCException: public Exception { |
55 |
public: |
public: |
56 |
WrongCRCException::WrongCRCException(char* msg): Exception(msg) {} |
WrongCRCException::WrongCRCException(const char* msg): Exception(msg) {} |
57 |
WrongCRCException::~WrongCRCException () throw(){ } |
WrongCRCException::~WrongCRCException () throw(){ } |
|
const char* WrongCRCException::print () const throw () { |
|
|
return message; |
|
|
} |
|
58 |
}; |
}; |
59 |
|
|
60 |
class WrongCRCHeaderException: public Exception { |
class WrongCRCHeaderException: public Exception { |
61 |
public: |
public: |
62 |
WrongCRCHeaderException::WrongCRCHeaderException(): Exception() {} |
WrongCRCHeaderException::WrongCRCHeaderException(const char* msg): Exception(msg) {} |
63 |
WrongCRCHeaderException::~WrongCRCHeaderException () throw(){ } |
WrongCRCHeaderException::~WrongCRCHeaderException () throw(){ } |
|
const char* WrongCRCHeaderException::print () const throw () { |
|
|
return "CRC Header Exception"; |
|
|
} |
|
64 |
}; |
}; |
65 |
|
|
66 |
|
|
67 |
class LengthException: public Exception { |
class LengthException: public Exception { |
68 |
public: |
public: |
69 |
LengthException::LengthException(char* msg): Exception(msg) { } |
LengthException::LengthException(const char* msg): Exception(msg) { } |
70 |
LengthException::~LengthException () throw(){ } |
LengthException::~LengthException () throw(){ } |
|
const char* LengthException::print () const throw () { |
|
|
return message; |
|
|
} |
|
71 |
}; |
}; |
72 |
|
|
73 |
|
|
75 |
public: |
public: |
76 |
NotExistingAlgorithmException::NotExistingAlgorithmException(const char *msg): Exception(msg) { } |
NotExistingAlgorithmException::NotExistingAlgorithmException(const char *msg): Exception(msg) { } |
77 |
NotExistingAlgorithmException::~NotExistingAlgorithmException () throw(){ } |
NotExistingAlgorithmException::~NotExistingAlgorithmException () throw(){ } |
|
const char* NotExistingAlgorithmException::print () const throw () { |
|
|
return strcat("\n No way to read events of type ", message); |
|
|
} |
|
78 |
}; |
}; |
79 |
|
|
80 |
class NotExistingCounterException: public Exception { |
class NotExistingCounterException: public Exception { |
81 |
public: |
public: |
82 |
NotExistingCounterException::NotExistingCounterException(const char *msg): Exception(msg) { } |
NotExistingCounterException::NotExistingCounterException(const char *msg): Exception(msg) { } |
83 |
NotExistingCounterException::~NotExistingCounterException () throw(){ } |
NotExistingCounterException::~NotExistingCounterException () throw(){ } |
|
const char* NotExistingCounterException::print () const throw () { |
|
|
return strcat("\n No counter of type ", message); |
|
|
} |
|
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 */ |
#endif /* EXCEPTION_H */ |