123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- //-----------------------------------------------------------------------------
- // Basler pylon SDK
- // Copyright (c) 2010-2021 Basler AG
- // http://www.baslerweb.com
- // Author: Andreas Gau
- //-----------------------------------------------------------------------------
- /**
- \file
- \brief Contains the configuration event handler base class.
- */
- #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;
- /** \addtogroup Pylon_InstantCameraApiGeneric
- * @{
- */
- /**
- \class CConfigurationEventHandler
- \brief The configuration event handler base class.
- */
- class CConfigurationEventHandler
- {
- public:
- /**
- \brief This method is called before a %Pylon Device (Pylon::IPylonDevice) is attached by calling the Instant Camera object's Attach() method.
- This method can not be used for detecting that a camera device has been attached to the PC.
- The camera's Attach() method must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnAttach( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after a %Pylon Device (Pylon::IPylonDevice) has been attached by calling the Instant Camera object's Attach() method.
- This method can not be used for detecting that a camera device has been attached to the PC.
- The camera's Attach() method must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnAttached( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called before the attached %Pylon Device is detached from the Instant Camera object.
- The camera's Detach() method must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnDetach( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after the attached %Pylon Device has been detached from the Instant Camera object.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnDetached( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called before the attached %Pylon Device is destroyed.
- Camera DestroyDevice must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnDestroy( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after the attached %Pylon Device has been destroyed.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnDestroyed( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called before the attached %Pylon Device is opened.
- \param[in] camera The source of the call.
- \error
- Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnOpen( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after the attached %Pylon Device has been opened.
- \param[in] camera The source of the call.
- \error
- Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnOpened( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called before the attached %Pylon Device is closed.
- Camera Close must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnClose( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after the attached %Pylon Device has been closed.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnClosed( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called before a grab session is started.
- Camera StartGrabbing must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnGrabStart( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after a grab session has been started.
- \param[in] camera The source of the call.
- \error
- Exceptions from this call will propagate through. The notification of event handlers stops when an exception is triggered.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnGrabStarted( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called before a grab session is stopped.
- Camera StopGrabbing must not be called from here or from subsequent calls to avoid infinite recursion.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnGrabStop( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called after a grab session has been stopped.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnGrabStopped( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called when an exception has been triggered during grabbing.
- An exception has been triggered by a grab thread. The grab will be stopped after this event call.
- \param[in] camera The source of the call.
- \param[in] errorMessage The message of the exception that signaled an error during grabbing.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnGrabError( CInstantCamera& camera, const char* errorMessage )
- {
- PYLON_UNUSED( &camera );
- PYLON_UNUSED( errorMessage );
- }
- /**
- \brief This method is called when a camera device removal from the PC has been detected.
- The %Pylon Device attached to the Instant Camera is not operable after this event.
- After it is made sure that no access to the %Pylon Device or any of its node maps is made anymore
- the %Pylon Device should be destroyed using InstantCamera::DeviceDestroy().
- The access to the %Pylon Device can be protected using the lock provided by GetLock(), e.g. when accessing parameters.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored. All event handlers are notified.
- \threading
- This method is called inside the lock of the camera object from an additional thread.
- */
- virtual void OnCameraDeviceRemoved( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called when the configuration event handler has been registered.
- \param[in] camera The source of the call.
- \error
- Exceptions from this call will propagate through.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnConfigurationRegistered( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /**
- \brief This method is called when the configuration event handler has been deregistered.
- The configuration event handler is automatically deregistered when the Instant Camera object
- is destroyed.
- \param[in] camera The source of the call.
- \error
- C++ exceptions from this call will be caught and ignored.
- \threading
- This method is called inside the lock of the camera object.
- */
- virtual void OnConfigurationDeregistered( CInstantCamera& camera )
- {
- PYLON_UNUSED( &camera );
- }
- /*!
- \brief Destroys the configuration event handler.
- \error
- C++ exceptions from this call will be caught and ignored.
- */
- 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;
- }
- /// Create.
- CConfigurationEventHandler()
- : m_eventHandlerRegistrationCount( 0 )
- {
- }
- /// Copy.
- CConfigurationEventHandler( const CConfigurationEventHandler& )
- : m_eventHandlerRegistrationCount( 0 )
- {
- }
- /// Assign.
- CConfigurationEventHandler& operator=( const CConfigurationEventHandler& )
- {
- return *this;
- }
- /// Destruct.
- 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 */
|