Skip to content

File BasePtr.h

File List > include > BasePtr.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 FLIR_SPINNAKER_BASE_PTR_H
#define FLIR_SPINNAKER_BASE_PTR_H

#include "SpinnakerPlatform.h"

namespace Spinnaker
{
    template <class T, class B = T> class SPINNAKER_API BasePtr
    {
      public:
        BasePtr(void) throw();

        virtual ~BasePtr(void);

        BasePtr(const BasePtr& other) throw();

        virtual BasePtr& operator=(const BasePtr& rhs);

        virtual BasePtr& operator=(const int nMustBeNull);

        virtual BasePtr& operator=(const long nMustBeNull);

        virtual BasePtr& operator=(const std::nullptr_t nullPtr);

        virtual operator T*(void)const;

        virtual T* operator->(void)const;

        virtual bool IsValid() const throw();

        virtual operator bool(void) const throw();

        virtual bool operator==(const BasePtr& rT) const;

        virtual bool operator==(std::nullptr_t) const;

        virtual bool operator==(int nMustBeNull) const;

        virtual bool operator==(long nMustBeNull) const;

        virtual bool operator!=(const BasePtr& rT) const;

        virtual bool operator!=(std::nullptr_t) const;

        virtual bool operator!=(int nMustBeNull) const;

        virtual bool operator!=(long nMustBeNull) const;

        virtual T* get() const;

      protected:
        friend class CameraListImpl;
        friend class InterfaceListImpl;
        friend class ProducerListImpl;

        struct PointerData;
        PointerData* m_pT;
    };

    template <class T, class B> inline bool operator==(const std::nullptr_t, const BasePtr<T, B>& rhs)
    {
        return rhs == nullptr;
    }

} // namespace Spinnaker
#endif // FLIR_SPINNAKER_BASE_PTR_H