Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CGDBMException.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 CGDBMException is thrown whenever an exception occurs while using the
00012 // UNIX database system gdbm. Examples include a failed file open, a failed
00013 // entry store, a failed entry fetch, etc.
00014 //
00015 
00016 #ifndef __CGDBMEXCEPTION_H  //Required for current class
00017 #define __CGDBMEXCEPTION_H
00018                                //Required for base classes
00019 #ifndef __CEXCEPTION_H
00020 #include "CException.h"
00021 #endif
00022 
00023 #ifndef __HISTOTYPES_H
00024 #include <histotypes.h>
00025 #endif
00026 
00027 #ifndef __GDBM_H
00028 #include <gdbm.h>
00029 #endif
00030 
00031 #ifndef __STL_STRING
00032 #include <string>
00033 #define __STL_STRING
00034 #endif
00035 
00036 class CGDBMException : public CException
00037 {
00038   gdbm_error m_nError;      // Snapshot of gdbm_errno at construction time
00039 
00040  public:
00041   // Default constructors
00042   CGDBMException(const char* pszAction, gdbm_error am_nError) :
00043     m_nError(am_nError),
00044     CException(pszAction) {}
00045   CGDBMException(const std::string& rsAction, gdbm_error am_nError) :
00046     m_nError(am_nError),
00047     CException(rsAction) {}
00048 
00049   // Destructor
00050   ~CGDBMException() {}
00051 
00052   // Copy constructor
00053   CGDBMException(const CGDBMException& aCGDBMException) :
00054     CException(aCGDBMException)
00055     {
00056       m_nError = aCGDBMException.m_nError;
00057     }
00058 
00059   // Ooperator= Assignment operator
00060   CGDBMException& operator= (const CGDBMException& aCGDBMException)
00061     {
00062       if(this == &aCGDBMException) return *this;
00063       CException::operator= (aCGDBMException);
00064       m_nError = aCGDBMException.m_nError;
00065       return *this;
00066     }
00067 
00068   // Operator== Equality operator
00069   int operator== (const CGDBMException& aCGDBMException)
00070     {
00071       return ((CException::operator== (aCGDBMException)) &&
00072               (m_nError == aCGDBMException.m_nError));
00073     }
00074 
00075   // Public selector functions
00076   gdbm_error getError() const { return m_nError; }
00077 
00078   // Protected mutator function
00079  protected:
00080   void setError(gdbm_error am_nError) { m_nError = am_nError; }
00081 
00082   // Public member functions
00083   virtual const char* ReasonText() const;
00084   virtual Int_t ReasonCode() const;
00085 };
00086 
00087 #endif

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