Skip to content

pylon/BaslerUniversalConfigurationEventHandler.h#

Contains the configuration event handler base class.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::CBaslerUniversalConfigurationEventHandler
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_BASLERUNIVERSALCONFIGURATIONEVENTHANDLERH
#define INCLUDED_BASLERUNIVERSALCONFIGURATIONEVENTHANDLERH

#pragma once

#include <pylon/stdinclude.h>

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

namespace Pylon
{
    class CBaslerUniversalInstantCamera;

    class CBaslerUniversalConfigurationEventHandler
    {
    public:
        virtual void OnAttach( CBaslerUniversalInstantCamera& camera )
        {
            PYLON_UNUSED( &camera );
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

        virtual void OnConfigurationDeregistered( CBaslerUniversalInstantCamera& 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;
        }

        CBaslerUniversalConfigurationEventHandler()
            : m_eventHandlerRegistrationCount( 0 )
        {
        }

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

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

        virtual ~CBaslerUniversalConfigurationEventHandler()
        {
            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_BASLERUNIVERSALCONFIGURATIONEVENTHANDLERH */

Updated on 5 July 2022 at 15:30:01