00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SAGA_EXCEPTION_HPP
00009 #define SAGA_EXCEPTION_HPP
00010
00011
00012 #include <exception>
00013 #include <iostream>
00014 #include <string>
00015 #include <vector>
00016
00017
00018 #include <saga/saga/base.hpp>
00019 #include <saga/saga/util.hpp>
00020 #include <saga/saga/error.hpp>
00021 #include <saga/saga/object.hpp>
00022
00023
00024 #if defined(BOOST_MSVC)
00025 #pragma warning(push)
00026 #pragma warning(disable: 4251 4231 4660)
00027 #endif
00028
00030
00031 namespace saga
00032 {
00052 class SAGA_EXCEPTION_EXPORT exception : public std::exception
00053 {
00054 private:
00056 TR1::shared_ptr<saga::impl::exception> impl_;
00057 saga::impl::exception* get_impl() const { return impl_.get(); }
00058 friend struct saga::impl::runtime;
00060
00061 public:
00062
00063
00064
00070 exception (saga::object obj, std::string const& m, error e = NoSuccess);
00071
00077 exception (saga::object obj, std::vector<saga::exception> const& l);
00078
00084 explicit exception (std::string const& m, error e = NoSuccess);
00085
00091 explicit exception (std::vector<saga::exception> const& l);
00092
00095 ~exception() throw() {}
00096
00099 char const* what() const throw();
00100
00104 char const* get_message() const throw();
00105
00108 saga::error get_error () const throw();
00109
00113 saga::object get_object () const throw();
00114
00117 std::vector<saga::exception> const& get_all_exceptions() const throw();
00118
00123 std::vector<std::string> get_all_messages() const;
00124 };
00125
00127 class SAGA_EXCEPTION_EXPORT not_implemented : public saga::exception
00128 {
00129 public:
00132 not_implemented (saga::object obj, std::string const& m)
00133 : saga::exception(obj, m, NotImplemented)
00134 {}
00135
00136 not_implemented (saga::object obj, std::vector<saga::exception> const& l)
00137 : saga::exception(obj, l)
00138 {}
00139
00142 explicit not_implemented (std::string const& m)
00143 : saga::exception(m, NotImplemented)
00144 {}
00145 };
00146
00148 class SAGA_EXCEPTION_EXPORT parameter_exception : public saga::exception
00149 {
00150 protected:
00153 parameter_exception (saga::object obj, std::string const& m, saga::error e)
00154 : saga::exception(obj, m, e)
00155 {}
00156
00157 parameter_exception (saga::object obj, std::vector<saga::exception> const& l)
00158 : saga::exception(obj, l)
00159 {}
00160
00163 parameter_exception (std::string const& m, saga::error e)
00164 : saga::exception(m, e)
00165 {}
00166 };
00167
00169 class SAGA_EXCEPTION_EXPORT incorrect_url : public saga::parameter_exception
00170 {
00171 public:
00174 incorrect_url (saga::object obj, std::string const& m)
00175 : saga::parameter_exception(obj, m, IncorrectURL)
00176 {}
00177
00178 incorrect_url (saga::object obj, std::vector<saga::exception> const& l)
00179 : saga::parameter_exception(obj, l)
00180 {}
00181
00184 explicit incorrect_url (std::string const& m)
00185 : saga::parameter_exception(m, IncorrectURL)
00186 {}
00187 };
00188
00190 class SAGA_EXCEPTION_EXPORT bad_parameter : public saga::parameter_exception
00191 {
00192 public:
00195 bad_parameter (saga::object obj, std::string const& m)
00196 : saga::parameter_exception(obj, m, BadParameter)
00197 {}
00198
00199 bad_parameter (saga::object obj, std::vector<saga::exception> const& l)
00200 : saga::parameter_exception(obj, l)
00201 {}
00202
00205 explicit bad_parameter (std::string const& m)
00206 : saga::parameter_exception(m, BadParameter)
00207 {}
00208 };
00209
00211 class SAGA_EXCEPTION_EXPORT state_exception : public saga::exception
00212 {
00213 protected:
00216 state_exception (saga::object obj, std::string const& m, saga::error e)
00217 : saga::exception(obj, m, e)
00218 {}
00219
00220 state_exception (saga::object obj, std::vector<saga::exception> const& l)
00221 : saga::exception(obj, l)
00222 {}
00223
00226 state_exception (std::string const& m, saga::error e)
00227 : saga::exception(m, e)
00228 {}
00229 };
00230
00232 class SAGA_EXCEPTION_EXPORT already_exists : public saga::state_exception
00233 {
00234 public:
00237 already_exists (saga::object obj, std::string const& m)
00238 : saga::state_exception(obj, m, AlreadyExists)
00239 {}
00240
00241 already_exists (saga::object obj, std::vector<saga::exception> const& l)
00242 : saga::state_exception(obj, l)
00243 {}
00244
00247 explicit already_exists (std::string const& m)
00248 : saga::state_exception(m, AlreadyExists)
00249 {}
00250 };
00251
00253 class SAGA_EXCEPTION_EXPORT does_not_exist : public saga::state_exception
00254 {
00255 public:
00258 does_not_exist (saga::object obj, std::string const& m)
00259 : saga::state_exception(obj, m, DoesNotExist)
00260 {}
00261
00262 does_not_exist (saga::object obj, std::vector<saga::exception> const& l)
00263 : saga::state_exception(obj, l)
00264 {}
00265
00268 explicit does_not_exist (std::string const& m)
00269 : saga::state_exception(m, DoesNotExist)
00270 {}
00271 };
00272
00274 class SAGA_EXCEPTION_EXPORT incorrect_state : public saga::state_exception
00275 {
00276 public:
00279 incorrect_state (saga::object obj, std::string const& m)
00280 : saga::state_exception(obj, m, IncorrectState)
00281 {}
00282
00283 incorrect_state (saga::object obj, std::vector<saga::exception> const& l)
00284 : saga::state_exception(obj, l)
00285 {}
00286
00289 explicit incorrect_state (std::string const& m)
00290 : saga::state_exception(m, IncorrectState)
00291 {}
00292 };
00293
00295 class SAGA_EXCEPTION_EXPORT security_exception : public saga::exception
00296 {
00297 protected:
00300 security_exception (saga::object obj, std::string const& m, saga::error e)
00301 : saga::exception(obj, m, e)
00302 {}
00303
00304 security_exception (saga::object obj, std::vector<saga::exception> const& l)
00305 : saga::exception(obj, l)
00306 {}
00307
00310 security_exception (std::string const& m, saga::error e)
00311 : saga::exception(m, e)
00312 {}
00313 };
00314
00316 class SAGA_EXCEPTION_EXPORT permission_denied
00317 : public saga::security_exception
00318 {
00319 public:
00322 permission_denied (saga::object obj, std::string const& m)
00323 : saga::security_exception(obj, m, PermissionDenied)
00324 {}
00325
00326 permission_denied (saga::object obj, std::vector<saga::exception> const& l)
00327 : saga::security_exception(obj, l)
00328 {}
00329
00332 explicit permission_denied (std::string const& m)
00333 : saga::security_exception(m, PermissionDenied)
00334 {}
00335 };
00336
00338 class SAGA_EXCEPTION_EXPORT authorization_failed
00339 : public saga::security_exception
00340 {
00341 public:
00344 authorization_failed (saga::object obj, std::string const& m)
00345 : saga::security_exception(obj, m, AuthorizationFailed)
00346 {}
00347
00348 authorization_failed (saga::object obj, std::vector<saga::exception> const& l)
00349 : saga::security_exception(obj, l)
00350 {}
00351
00354 explicit authorization_failed (std::string const& m)
00355 : saga::security_exception(m, AuthorizationFailed)
00356 {}
00357 };
00358
00360 class SAGA_EXCEPTION_EXPORT authentication_failed
00361 : public saga::security_exception
00362 {
00363 public:
00366 authentication_failed (saga::object obj, std::string const& m)
00367 : saga::security_exception(obj, m, AuthenticationFailed)
00368 {}
00369
00370 authentication_failed (saga::object obj, std::vector<saga::exception> const& l)
00371 : saga::security_exception(obj, l)
00372 {}
00373
00376 explicit authentication_failed (std::string const& m)
00377 : saga::security_exception(m, AuthenticationFailed)
00378 {}
00379 };
00380
00382 class SAGA_EXCEPTION_EXPORT timeout : public saga::state_exception
00383 {
00384 public:
00387 timeout (saga::object obj, std::string const& m)
00388 : saga::state_exception(obj, m, Timeout)
00389 {}
00390
00391 timeout (saga::object obj, std::vector<saga::exception> const& l)
00392 : saga::state_exception(obj, l)
00393 {}
00394
00397 explicit timeout (std::string const& m)
00398 : saga::state_exception(m, Timeout)
00399 {}
00400 };
00401
00403 class SAGA_EXCEPTION_EXPORT no_success : public saga::exception
00404 {
00405 public:
00408 no_success (saga::object obj, std::string const& m)
00409 : saga::exception(obj, m, NoSuccess)
00410 {}
00411
00412 no_success (saga::object obj, std::vector<saga::exception> const& l)
00413 : saga::exception(obj, l)
00414 {}
00415
00418 explicit no_success (std::string const& m)
00419 : saga::exception(m, NoSuccess)
00420 {}
00421 };
00422
00424
00426
00427 namespace adaptors
00428 {
00430 class SAGA_EXCEPTION_EXPORT exception : public saga::exception
00431 {
00432 public:
00433 exception (saga::object obj,
00434 std::string const& name, std::string const& m,
00435 saga::error e = NoSuccess)
00436 : saga::exception (obj, name + ": " + m, e)
00437 {
00438 }
00439
00440 exception (saga::object obj, std::vector<saga::exception> const& l)
00441 : saga::exception (obj, l)
00442 {
00443 }
00444
00445 ~exception (void) throw () {}
00446 };
00447
00449 }
00451
00453 }
00454
00455
00456 #if defined(BOOST_MSVC)
00457 #pragma warning(pop)
00458 #endif
00459
00460 #endif // SAGA_EXCEPTION_HPP
00461