DDS-PSM-C++  1.0
ISO C++ API for OpenSplice DDS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Exception.hpp
Go to the documentation of this file.
1 #ifndef OMG_DDS_CORE_EXCEPTION_HPP_
2 #define OMG_DDS_CORE_EXCEPTION_HPP_
3 
4 /* Copyright 2010, Object Management Group, Inc.
5  * Copyright 2010, PrismTech, Corp.
6  * Copyright 2010, Real-Time Innovations, Inc.
7  * All rights reserved.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #include <stdexcept>
23 #include <string>
24 #include <dds/core/macros.hpp>
25 
26 namespace dds { namespace core {
27 
34  class Exception
35  {
36  protected:
37  Exception();
38  public:
39  virtual ~Exception() throw ();
40 
41  public:
42  virtual const char* what() const throw () = 0;
43  };
44 
45  class Error : public Exception, public std::exception
46  {
47  public:
48  Error();
49  Error(const Error& src);
50  public:
51  virtual ~Error() throw ();
52 
53  public:
54  virtual const char* what() const throw ();
55  };
56 
57 
58  class AlreadyClosedError : public Exception, public std::logic_error
59  {
60  public:
61  explicit AlreadyClosedError(const std::string& msg);
63  virtual ~AlreadyClosedError() throw ();
64 
65  public:
66  virtual const char* what() const throw ();
67  };
68 
69 
70  class IllegalOperationError : public Exception, public std::logic_error
71  {
72  public:
73  explicit IllegalOperationError(const std::string& msg);
75  virtual ~IllegalOperationError() throw ();
76 
77  public:
78  virtual const char* what() const throw ();
79  };
80 
81 
82  class ImmutablePolicyError : public Exception, public std::logic_error
83  {
84  public:
85  explicit ImmutablePolicyError(const std::string& msg);
87  virtual ~ImmutablePolicyError() throw ();
88 
89  public:
90  virtual const char* what() const throw ();
91  };
92 
93 
94  class InconsistentPolicyError : public Exception, public std::logic_error
95  {
96  public:
97  explicit InconsistentPolicyError(const std::string& msg);
99  virtual ~InconsistentPolicyError() throw ();
100 
101  public:
102  virtual const char* what() const throw ();
103  };
104 
105 
106  class InvalidArgumentError : public Exception, public std::invalid_argument
107  {
108  public:
109  explicit InvalidArgumentError(const std::string& msg);
111  virtual ~InvalidArgumentError() throw ();
112 
113  public:
114  virtual const char* what() const throw ();
115  };
116 
117 
118  class NotEnabledError : public Exception, public std::logic_error
119  {
120  public:
121  explicit NotEnabledError(const std::string& msg);
122  NotEnabledError(const NotEnabledError& src);
123  virtual ~NotEnabledError() throw ();
124 
125  public:
126  virtual const char* what() const throw ();
127  };
128 
129 
130  class OutOfResourcesError : public Exception, public std::runtime_error
131  {
132  public:
133  explicit OutOfResourcesError(const std::string& msg);
135  virtual ~OutOfResourcesError() throw ();
136 
137  public:
138  virtual const char* what() const throw ();
139  };
140 
141 
142  class PreconditionNotMetError : public Exception, public std::logic_error
143  {
144  public:
145  explicit PreconditionNotMetError(const std::string& msg) : std::logic_error(msg) { }
146  PreconditionNotMetError(const PreconditionNotMetError& src) : std::logic_error(src.what()) {}
147  virtual ~PreconditionNotMetError() throw () { }
148 
149  public:
150  virtual const char* what() const throw () {
151  return this->std::logic_error::what();
152  }
153 
154  };
155 
156 
157  class TimeoutError : public Exception, public std::runtime_error
158  {
159  public:
160  explicit TimeoutError(const std::string& msg);
161  TimeoutError(const TimeoutError& src);
162  virtual ~TimeoutError() throw ();
163 
164  public:
165  virtual const char* what() const throw ();
166  };
167 
168 
169  class UnsupportedError : public Exception, public std::logic_error
170  {
171  public:
172  explicit UnsupportedError(const std::string& msg);
174  virtual ~UnsupportedError() throw ();
175 
176  public:
177  virtual const char* what() const throw ();
178  };
179 
180  class InvalidDowncastError : public Exception, public std::runtime_error
181  {
182  public:
183  explicit InvalidDowncastError(const std::string& msg);
185  virtual ~InvalidDowncastError() throw();
186 
187  public:
188  virtual const char* what() const throw ();
189  };
190 
191  class NullReferenceError : public Exception, public std::runtime_error
192  {
193  public:
194  explicit NullReferenceError(const std::string& msg);
196  virtual ~NullReferenceError() throw();
197 
198  public:
199  virtual const char* what() const throw ();
200  };
201 
202 
203  class InvalidDataError : public Exception, public std::logic_error
204  {
205  public:
206  explicit InvalidDataError(const std::string& msg);
208  virtual ~InvalidDataError() throw ();
209 
210  public:
211  virtual const char* what() const throw ();
212  };
213 
214 }}
215 
216 #endif /* OMG_DDS_CORE_EXCEPTION_HPP_ */