1 | /***************************************************************************
|
---|
2 | amcerror.h - description
|
---|
3 | -------------------
|
---|
4 | begin : Sun Nov 24 2002
|
---|
5 | copyright : (C) 2002 by Martin Merck
|
---|
6 | email : merck@astro.uni-wuerzburg.de
|
---|
7 | ***************************************************************************/
|
---|
8 |
|
---|
9 | /***************************************************************************
|
---|
10 | * *
|
---|
11 | * This program is part of the MAGIC control software for the AMC. *
|
---|
12 | * The software is only intended for use in the MAGIC telescope project *
|
---|
13 | * All rights remain with the author. *
|
---|
14 | ***************************************************************************/
|
---|
15 |
|
---|
16 | #ifndef AMCERROR_H
|
---|
17 | #define AMCERROR_H
|
---|
18 |
|
---|
19 | #include <qstring.h>
|
---|
20 | #include <qdatetime.h>
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * This class intended to be used as the exception class
|
---|
24 | * we throw when we encounter an error.
|
---|
25 | *@author Martin Merck
|
---|
26 | */
|
---|
27 |
|
---|
28 | class AMCError {
|
---|
29 | public:
|
---|
30 | AMCError( const char* p_sError = 0, int p_iDriver = 0 );
|
---|
31 | ~AMCError();
|
---|
32 | /** Return the driver number of the driver generating the error. */
|
---|
33 | int getDriver() const { return m_iDriver; }
|
---|
34 | /** Set the driver number of the driver generating the error. */
|
---|
35 | void setDriver( int p_iDriver );
|
---|
36 | /** return the Panel originating the error. */
|
---|
37 | void getPanel( int& p_iX, int& p_iY) const { p_iX = m_iX; p_iY = m_iY; }
|
---|
38 | /** Set the Panel originating the error. */
|
---|
39 | void setPanel( int p_iX, int p_iY) { m_iX = p_iX; m_iY = p_iY; }
|
---|
40 | /** Return a reference to the string describing the error. */
|
---|
41 | const QString& getErrorText() const;
|
---|
42 | /** Set the text describing the error condition. */
|
---|
43 | void setErrorText( const char* p_sError );
|
---|
44 | /** No descriptions */
|
---|
45 | void setCommand( QCString p_sCommand ) { m_sCommand = p_sCommand; }
|
---|
46 | /** No descriptions */
|
---|
47 | void setResponse( QCString p_sResponse ) { m_sResponse = p_sResponse; }
|
---|
48 | /** No descriptions */
|
---|
49 | QString formatError( int iNumSpace = 0 ) const;
|
---|
50 | private: // Private attributes
|
---|
51 | /** Description of the error */
|
---|
52 | /** */
|
---|
53 | QCString m_sCommand;
|
---|
54 | QCString m_sResponse;
|
---|
55 | QString m_sError;
|
---|
56 | int m_iDriver;
|
---|
57 | int m_iX, m_iY;
|
---|
58 | /** */
|
---|
59 | QDateTime m_time;
|
---|
60 | };
|
---|
61 |
|
---|
62 | #endif
|
---|