FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Exception.h
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2005.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Author:
11  Ron Fox
12  NSCL
13  Michigan State University
14  East Lansing, MI 48824-1321
15 */
16 
17 
18 // CException.h:
19 //
20 // This file defines the CException class.
21 //
22 // Author:
23 // Ron Fox
24 // NSCL
25 // Michigan State University
26 // East Lansing, MI 48824-1321
27 // mailto:fox@nscl.msu.edu
28 //
29 // Copyright 1999 NSCL, All Rights Reserved.
30 //
32 
33 #ifndef EXCEPTION_H //Required for current class
34 #define EXCEPTION_H
35 
36 
37 #include <string>
38 
39 #define kACTIONSIZE 1024 // Size of action message.
40 
41 class CException
42 {
43  // Attributes:
44 private:
45  char m_szAction[kACTIONSIZE] ; // Saved action in progress when
46  // exception was thrown.
47 public:
48  //Default constructor
49 
50  virtual ~ CException ( ) { } //Destructor
51 
52  //Constructors with arguments
53 
54  CException (const char* pszAction );
55  CException (const std::string& rsAction);
56 
57  //Copy constructor
58 
59  CException (const CException& aCException );
60 
61  //Operator= Assignment Operator
62 
63  CException& operator= (const CException& aCException);
64 
65  //Operator== Equality Operator
66  int operator== (const CException& aCException) const;
67  int operator!= (const CException& rException) const{
68  return !(operator==(rException));
69  }
70  //Get accessor function for attribute
71 
72  // Selectors:
73 
74 public:
75  const char* getAction() const
76  {
77  return m_szAction;
78  }
79 
80  //Set accessor function for attribute (protected)
81 
82 protected:
83  void setAction (const char* pszAction);
84  void setAction (const std::string& rsAction);
85 
86  // Selectors which depend on the actual exception type:
87 
88 public:
89  virtual const char* ReasonText () const ;
90  virtual int ReasonCode () const ;
91  const char* WasDoing () const ;
92 
93  // Utility functions:
94 protected:
95 
96  virtual void DoAssign(const CException& rhs);
97 };
98 
99 
100 #endif
Definition: Exception.h:41