sipxportlib  Version 3.3
OsExcept.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _OsExcept_h_
13 #define _OsExcept_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include "OsDefs.h"
19 #include "utl/UtlString.h"
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // CONSTANTS
26 // STRUCTS
27 // TYPEDEFS
28 // FORWARD DECLARATIONS
29 
30 //:Base class for exceptions thrown from the OS abstraction layer
31 // The abstraction layer exception handling mechanism is based on the
32 // OsExcept class. This class stores information about the type, cause,
33 // and location of the exception.
34 
35 class OsExcept
36 {
37 /* //////////////////////////// PUBLIC //////////////////////////////////// */
38 public:
39 
40  enum MajorCode
41  {
42  MAJOR_NONE, // Unclassified exception
43  MAJOR_RUNTIME, // Runtime exception
44  MAJOR_USER // User-defined exception
45  };
49 
50  enum MinorCode
51  {
52  MINOR_NONE, // Unclassified exception
53  MINOR_RUNTIME, // Runtime exception
54  MINOR_USER // User-defined exception
55  };
59 
60 /* ============================ CREATORS ================================== */
61 
62  OsExcept(const int majorCode=MAJOR_NONE, const int minorCode=MINOR_NONE,
63  const UtlString& rText="", const UtlString& rContext="");
64  //:Constructor
65 
66  OsExcept(const OsExcept& rOsExcept);
67  //:Copy constructor
68 
69  virtual
70  ~OsExcept();
71  //:Destructor
72 
73 /* ============================ MANIPULATORS ============================== */
74 
75  OsExcept& operator=(const OsExcept& rhs);
76  //:Assignment operator
77 
78  virtual void setMajorCode(const int majorCode);
79  //:Set major exception code
80 
81  virtual void setMinorCode(const int minorCode);
82  //:Set minor exception code
83 
84  virtual void setContext(const UtlString& rContext);
85  //:Set exception context
86 
87  virtual void setText(const UtlString& rText);
88  //:Set exception text
89 
90 /* ============================ ACCESSORS ================================= */
91 
92  virtual int getMajorCode(void) const;
93  //:Get major exception code
94 
95  virtual int getMinorCode(void) const;
96  //:Get minor exception code
97 
98  virtual const UtlString& getContext(void) const;
99  //:Get exception context
100 
101  virtual const UtlString& getText(void) const;
102  //:Get exception text
103 
104 /* ============================ INQUIRY =================================== */
105 
106 /* //////////////////////////// PROTECTED ///////////////////////////////// */
107 protected:
108 
109 /* //////////////////////////// PRIVATE /////////////////////////////////// */
110 private:
111  int mMajorCode; // major exception code
112  int mMinorCode; // minor exception code
113  UtlString* mpText; // exception text
114  UtlString* mpContext; // exception context
115 
116  void init(void);
117  //:Initialize the member variables (called by the constructors)
118 
119 };
120 
121 /* ============================ INLINE METHODS ============================ */
122 
123 #endif // _OsExcept_h_
Definition: OsExcept.h:54
Definition: OsExcept.h:43
Definition: OsExcept.h:42
Definition: OsExcept.h:52
virtual const UtlString & getContext(void) const
Definition: OsExcept.cpp:117
virtual void setMajorCode(const int majorCode)
Definition: OsExcept.cpp:79
OsExcept(const int majorCode=MAJOR_NONE, const int minorCode=MINOR_NONE, const UtlString &rText="", const UtlString &rContext="")
enumcode: MINOR_NONE - Unclassified exception enumcode: MINOR_RUNTIME - Runtime exception enumcode: M...
Definition: OsExcept.cpp:27
Definition: OsExcept.h:44
virtual void setText(const UtlString &rText)
Definition: OsExcept.cpp:97
virtual ~OsExcept()
Definition: OsExcept.cpp:48
MinorCode
enumcode: MAJOR_NONE - Unclassified exception enumcode: MAJOR_RUNTIME - Runtime exception enumcode: M...
Definition: OsExcept.h:50
virtual void setMinorCode(const int minorCode)
Definition: OsExcept.cpp:85
Definition: UtlString.h:48
Definition: OsExcept.h:35
MajorCode
Definition: OsExcept.h:40
OsExcept & operator=(const OsExcept &rhs)
Definition: OsExcept.cpp:61
virtual const UtlString & getText(void) const
Definition: OsExcept.cpp:123
virtual int getMinorCode(void) const
Definition: OsExcept.cpp:111
virtual void setContext(const UtlString &rContext)
Definition: OsExcept.cpp:91
virtual int getMajorCode(void) const
Definition: OsExcept.cpp:105
Definition: OsExcept.h:53