Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAlarmServerException.h

00001 // Author:
00002 //   Jason Venema
00003 //   NSCL
00004 //   Michigan State University
00005 //   East Lansing, MI 48824-1321
00006 //   mailto: venemaja@msu.edu
00007 //
00008 // Copyright
00009 //   NSCL All rights reserved.
00010 //
00011 // A CAlarmServerException is thrown whenever a CAlarmServer encounters a 
00012 // request from somewhere that it cannot interpret. The exception contains
00013 // information about the current value of errno, as well as the command that
00014 // it tried (and failed) to successfully interpret.
00015 //
00016 
00017 #ifndef __CALARMSERVEREXCEPTION_H  //Required for current class
00018 #define __CALARMSERVEREXCEPTION_H
00019                                   //Required for base classes
00020 #ifndef __CEXCEPTION_H
00021 #include "CException.h"
00022 #endif
00023 
00024 #ifndef __HISTOTYPES_H
00025 #include <histotypes.h>
00026 #endif
00027 
00028 #ifndef __ERRNO_H
00029 #include <errno.h>
00030 #endif
00031 
00032 #ifndef __STL_STRING
00033 #include <string>
00034 #define __STL_STRING
00035 #endif
00036 
00037 class CAlarmServerException : public CException
00038 {
00039   string m_sRequestString;  // The offending request that caused the exception
00040   Int_t  m_nErrno;          // Snapshot of errno at construction time
00041 
00042  public:
00043   // Default constructors
00044   CAlarmServerException(const char* pszAction, const char* pError) :
00045     m_sRequestString(pError),
00046     CException(pszAction),
00047     m_nErrno(errno) {}
00048   CAlarmServerException(const char* pszAction, const string& rError) :
00049     m_sRequestString(rError),
00050     CException(pszAction),
00051     m_nErrno(errno) {}
00052   CAlarmServerException(const std::string& rsAction, const char* pError) :
00053     m_sRequestString(pError),
00054     CException(rsAction),
00055     m_nErrno(errno) {}
00056   CAlarmServerException(const std::string& rsAction, const string& rError) :
00057     m_sRequestString(rError),
00058     CException(rsAction),
00059     m_nErrno(errno) {}
00060   
00061   // Destructor
00062   ~CAlarmServerException() {}
00063 
00064   // Copy constructor
00065   CAlarmServerException(const CAlarmServerException& aCAlarmServerException) :
00066     CException(aCAlarmServerException)
00067     {
00068       m_sRequestString = aCAlarmServerException.m_sRequestString;
00069     }
00070 
00071   // Ooperator= Assignment operator
00072   CAlarmServerException& operator= 
00073     (const CAlarmServerException& aCAlarmServerException)
00074     {
00075       if(this == &aCAlarmServerException) return *this;
00076       CException::operator= (aCAlarmServerException);
00077       m_sRequestString = aCAlarmServerException.m_sRequestString;
00078       return *this;
00079     }
00080 
00081   // Operator== Equality operator
00082   int operator== (const CAlarmServerException& aCAlarmServerException)
00083     {
00084       return ((CException::operator== (aCAlarmServerException)) &&
00085               (m_sRequestString == aCAlarmServerException.m_sRequestString));
00086     }
00087 
00088   // Public selector functions
00089   string getRequestString() const { return m_sRequestString; }
00090   Int_t getErrno() const { return m_nErrno; }
00091 
00092   // Protected mutator function
00093  protected:
00094   void setRequestString(string am_sRequestString) 
00095     { m_sRequestString = am_sRequestString; }
00096   void setErrno(Int_t err) { m_nErrno = err; }
00097 
00098   // Public member functions
00099   virtual const char* ReasonText() const;
00100   virtual Int_t ReasonCode() const;
00101 };
00102 
00103 #endif

Generated at Tue May 21 12:10:50 2002 for CAlarmLogger by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001