/*** * ==++== * * Copyright (c) Microsoft Corporation. All rights reserved. * * ==--== * =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ * * amprt_exceptions.h * * Define the C++ interfaces exported by the C++ AMP runtime * * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ****/ #pragma once #ifndef _SILENCE_AMP_DEPRECATION_WARNINGS #error is part of C++ AMP which is deprecated by Microsoft and will be REMOVED. \ You can define _SILENCE_AMP_DEPRECATION_WARNINGS to acknowledge that you have received this warning. #endif // _SILENCE_AMP_DEPRECATION_WARNINGS #include #if !defined(_AMPIMP) #define _AMPIMP __declspec(dllimport) #endif // exceptions namespace Concurrency { /// /// Exception thrown due to a C++ AMP runtime_exception. /// This is the base type for all C++ AMP exception types. /// class runtime_exception : public std::exception { public: /// /// Construct a runtime_exception exception with a message and an error code /// /// /// Descriptive message of error /// /// /// HRESULT of error that caused this exception /// _AMPIMP runtime_exception(const char * _Message, HRESULT _Hresult) throw(); /// /// Construct a runtime_exception exception with an error code /// /// /// HRESULT of error that caused this exception /// _AMPIMP explicit runtime_exception(HRESULT _Hresult) throw(); /// /// Copy construct a runtime_exception exception /// /// /// The runtime_exception object to be copied from /// _AMPIMP runtime_exception(const runtime_exception &_Other) throw(); /// /// Assignment operator /// /// /// The runtime_exception object to be assigned from /// _AMPIMP runtime_exception &operator=(const runtime_exception &_Other) throw(); /// /// Destruct a runtime_exception exception object instance /// _AMPIMP virtual ~runtime_exception() noexcept; /// /// Get the error code that caused this exception /// /// /// HRESULT of error that caused the exception /// _AMPIMP HRESULT get_error_code() const throw(); private: HRESULT _M_error_code; }; // class runtime_exception /// /// Exception thrown when an underlying OS/DirectX call fails /// due to lack of system or device memory /// class out_of_memory : public runtime_exception { public: /// /// Construct an out_of_memory exception with a message /// /// /// Descriptive message of error /// _AMPIMP explicit out_of_memory(const char * _Message) throw(); /// /// Construct an out_of_memory exception /// _AMPIMP out_of_memory () throw(); }; // class out_of_memory /// /// Exception thrown when an underlying DirectX call fails /// due to the Windows timeout detection and recovery mechanism /// class accelerator_view_removed : public runtime_exception { public: /// /// Construct an accelerator_view_removed exception with a message and /// a view removed reason code /// /// /// Descriptive message of error /// /// /// HRESULT error code indicating the cause of removal of the accelerator_view /// _AMPIMP explicit accelerator_view_removed(const char * _Message, HRESULT _View_removed_reason) throw(); /// /// Construct an accelerator_view_removed exception /// /// /// HRESULT error code indicating the cause of removal of the accelerator_view /// _AMPIMP explicit accelerator_view_removed(HRESULT _View_removed_reason) throw(); /// /// Returns an HRESULT error code indicating the cause of the accelerator_view's removal /// /// /// The HRESULT error code that indicates the cause of accelerator_view's removal /// _AMPIMP HRESULT get_view_removed_reason() const throw(); private: HRESULT _M_view_removed_reason_code; }; // class accelerator_view_removed /// /// Exception thrown when the runtime fails to launch a kernel /// using the compute domain specified at the parallel_for_each call site. /// class invalid_compute_domain : public runtime_exception { public: /// /// Construct an invalid_compute_domain exception with a message /// /// /// Descriptive message of error /// _AMPIMP explicit invalid_compute_domain(const char * _Message) throw(); /// /// Construct an invalid_compute_domain exception /// _AMPIMP invalid_compute_domain() throw(); }; // class invalid_compute_domain /// /// Exception thrown when an unsupported feature is used /// class unsupported_feature : public runtime_exception { public: /// /// Construct an unsupported_feature exception with a message /// /// /// Descriptive message of error /// _AMPIMP explicit unsupported_feature(const char * _Message) throw(); /// /// Construct an unsupported_feature exception /// _AMPIMP unsupported_feature() throw(); }; // class unsupported_feature }