CLException.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //-----------------------------------------------------------------------------
  2. // (c) 2008 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Fritz Dierks
  6. // $Header$
  7. //
  8. // License: This file is published under the license of the EMVA GenICam Standard Group.
  9. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  10. // If for some reason you are missing this file please contact the EMVA or visit the website
  11. // (http://www.genicam.org) for a full copy.
  12. //
  13. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
  14. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
  17. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  23. // POSSIBILITY OF SUCH DAMAGE.
  24. //-----------------------------------------------------------------------------
  25. /*!
  26. \file
  27. \brief CLProtocol exception type
  28. */
  29. #ifndef CLPROTOCOL_CLEXCEPTION_H
  30. #define CLPROTOCOL_CLEXCEPTION_H
  31. #include <Base\GCBase.h>
  32. #include <CLProtocol\CLProtocol.h>
  33. namespace CLProtocol
  34. {
  35. //! CL Serial Exception type to hold the CL_ERR-code
  36. class CLErrException : public GENICAM_NAMESPACE::GenericException
  37. {
  38. public:
  39. // must have this c'tor signature to use the ExceptionReporter
  40. CLErrException(const char* description, const char *pSourceFileName, int SourceLine, const char* pExceptionType)
  41. : GENICAM_NAMESPACE::GenericException(description, pSourceFileName, SourceLine, pExceptionType)
  42. , m_CLCode(CL_ERR_NO_ERR)
  43. {
  44. }
  45. public:
  46. CLINT32 GetCLErrorCode() const
  47. {
  48. return m_CLCode;
  49. }
  50. CLErrException& SetCLErrorCode(CLINT32 errorCode)
  51. {
  52. m_CLCode = errorCode;
  53. return *this;
  54. }
  55. protected:
  56. CLINT32 m_CLCode;
  57. };
  58. #if !defined(CL_ERR_EXCEPTION)
  59. # define CLERR_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<CLProtocol::CLErrException>(__FILE__, __LINE__, "CLErrException" ).Report
  60. #endif
  61. }
  62. #endif // CLPROTOCOL_CLEXCEPTION_H