Skip to content

File Exception.h

File List > include > Exception.h

Go to the documentation of this file

//=============================================================================
// Copyright (c) 2026 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR).
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================

#ifndef PGR_SPINNAKER_EXCEPTION_H
#define PGR_SPINNAKER_EXCEPTION_H

#include "SpinnakerPlatform.h"
#include "SpinnakerDefs.h"
#include <stdio.h>
#include <exception>

#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4275) // non dll-interface structXXX used as base
#endif

namespace Spinnaker
{
    class SPINNAKER_API Exception : public virtual std::exception
    {

      public:
        Exception();

        Exception(int line, const char* fileName, const char* funcName, const char* errMsg, Error err);

        Exception(
            int line,
            const char* fileName,
            const char* funcName,
            const char* buildDate,
            const char* buildTime,
            const char* errMsg,
            Error err);

        Exception(const Exception& except);

        virtual ~Exception() throw();

        Exception& operator=(const Exception& except);

        bool operator==(const Error err) const;

        bool operator!=(const Error err) const;

        virtual const char* what() const throw(); // add throw() to avoid looser throw specifier error

        const char* GetFullErrorMessage() const;

        const char* GetErrorMessage() const;
        const char* GetFileName() const;
        const char* GetFunctionName() const;
        const char* GetBuildDate() const;
        const char* GetBuildTime() const;
        int GetLineNumber() const;
        Error GetError() const;

      protected:
      private:
        struct ExceptionData;
        ExceptionData* m_pImpl;
    };

} // namespace Spinnaker

#ifdef _WIN32
#pragma warning(pop)
#endif

#endif // PGR_SPINNAKER_EXCEPTION_H