Skip to content

pylon/ConfigurationEventHandler.h#

Contains the configuration event handler base class.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::CConfigurationEventHandler
The configuration event handler base class.

Source code#

//-----------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2010-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  Andreas Gau
//-----------------------------------------------------------------------------
#ifndef INCLUDED_CONFIGURATIONEVENTHANDLER_H_01627755
#define INCLUDED_CONFIGURATIONEVENTHANDLER_H_01627755

#include <pylon/stdinclude.h>

#ifdef _MSC_VER
#   pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */

namespace Pylon
{
    class CInstantCamera;

    class CConfigurationEventHandler
    {
    public:
        virtual void OnAttach( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnAttached( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnDetach( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnDetached( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnDestroy( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnDestroyed( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnOpen( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnOpened( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnClose( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnClosed( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnGrabStart( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnGrabStarted( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnGrabStop( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnGrabStopped( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnGrabError( CInstantCamera& camera, const char* errorMessage )
        {
            PYLON_UNUSED( &camera );
            PYLON_UNUSED( errorMessage );
        }

        virtual void OnCameraDeviceRemoved( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }


        virtual void OnConfigurationRegistered( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void OnConfigurationDeregistered( CInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

        virtual void DestroyConfiguration()
        {
            //If runtime errors occur here during delete, check the following:
            //Check that the cleanup procedure is correctly set when registering.
            //Ensure that the registered object has been allocated on the heap using new.
            //Ensure that the registered object has not already been deleted.
            delete this;
        }

        CConfigurationEventHandler()
            : m_eventHandlerRegistrationCount( 0 )
        {
        }

        CConfigurationEventHandler( const CConfigurationEventHandler& )
            : m_eventHandlerRegistrationCount( 0 )
        {
        }

        CConfigurationEventHandler& operator=( const CConfigurationEventHandler& )
        {
            return *this;
        }

        virtual ~CConfigurationEventHandler()
        {
            PYLON_ASSERT2( DebugGetEventHandlerRegistrationCount() == 0, "Error: The event handler must not be destroyed while it is registered." );
        }

        // Internal use only. Subject to change without notice.
        const long& DebugGetEventHandlerRegistrationCount()
        {
            return m_eventHandlerRegistrationCount;
        }

    private:
        long m_eventHandlerRegistrationCount; // Counts how many times the event handler is registered.
    };

}

#ifdef _MSC_VER
#   pragma pack(pop)
#endif /* _MSC_VER */

#endif /* INCLUDED_CONFIGURATIONEVENTHANDLER_H_01627755 */

Updated on 5 July 2022 at 15:30:01