FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
CNoSuchObjectException.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 #ifndef NOSUCHOBJECTEXCEPTION_H
18 #define NOSUCHOBJECTEXCEPTION_H
19 
20 #ifndef EXCEPTION_H
21 #include "Exception.h"
22 #endif
23 
24 
25 
26 #include <string>
27 
29 {
30  std::string m_sName;
31  std::string m_sReasonText;
32  public:
33 
34  CNoSuchObjectException(const char* pDoing, const char* pName) :
35  CException(pDoing),
36  m_sName(pName)
37  { UpdateReasonText(); }
38 
39  CNoSuchObjectException(const char* pDoing, const std::string& rName) :
40  CException(pDoing),
41  m_sName(rName)
42  { UpdateReasonText(); }
43 
44  CNoSuchObjectException(const std::string& rDoing, const char* pName) :
45  CException(rDoing),
46  m_sName(pName)
47  { UpdateReasonText(); }
48 
49  CNoSuchObjectException(const std::string& rDoing, const std::string& rName) :
50  CException(rDoing),
51  m_sName(rName)
52  { UpdateReasonText(); }
53 
54  virtual ~CNoSuchObjectException() { } // Destructor
55 
56  // Copy constructor
58  (const CNoSuchObjectException& aCNoSuchObjectException ) :
59  CException (aCNoSuchObjectException)
60  {
61  m_sName = aCNoSuchObjectException.m_sName;
62  UpdateReasonText();
63  }
64 
65  //Operator= Assignment Operator
66 
67  CNoSuchObjectException operator=
68  (const CNoSuchObjectException& aCNoSuchObjectException)
69  {
70  if (this != &aCNoSuchObjectException) {
71  CException::operator= (aCNoSuchObjectException);
72  m_sName = aCNoSuchObjectException.m_sName;
73  UpdateReasonText();
74  }
75  return *this;
76  }
77 
78  //Operator== Equality Operator
79 
80  int operator== (const CNoSuchObjectException& aCNoSuchObjectException)
81  {
82  return (
83  (CException::operator== (aCNoSuchObjectException)) &&
84  (m_sName == aCNoSuchObjectException.m_sName)
85  );
86 
87  }
88 
89  public:
90  std::string getName() const
91  {
92  return m_sName;
93  }
94 
95  public:
96  void setName (std::string am_sName)
97  {
98  m_sName = am_sName;
99  }
100 
101  public:
102 
103  virtual const char* ReasonText() const;
104 
105  protected:
106  void UpdateReasonText();
107 };
108 
109 #endif
Definition: CNoSuchObjectException.h:28
Definition: Exception.h:41