00001 /*============================================================================= 00002 Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 00003 00004 Redistribution of this file, in original or modified form, without 00005 prior written consent of Allied Vision Technologies is prohibited. 00006 00007 ------------------------------------------------------------------------------- 00008 00009 File: FrameHandler.h 00010 00011 Description: Definition of class AVT::VmbAPI::FrameHandler. 00012 00013 ------------------------------------------------------------------------------- 00014 00015 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 00016 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 00017 NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00018 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00019 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00021 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00022 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 00023 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00024 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 00026 =============================================================================*/ 00027 00028 #ifndef AVT_VMBAPI_FRAMEHANDLER_H 00029 #define AVT_VMBAPI_FRAMEHANDLER_H 00030 00031 #include <vector> 00032 00033 #include <VimbaC/Include/VmbCommonTypes.h> 00034 #include <VimbaCPP/Include/BasicLockable.h> 00035 #include <VimbaCPP/Include/SharedPointerDefines.h> 00036 #include <VimbaCPP/Include/Frame.h> 00037 #include <VimbaCPP/Include/IFrameObserver.h> 00038 #include <VimbaCPP/Source/ConditionHelper.h> 00039 00040 namespace AVT { 00041 namespace VmbAPI { 00042 00043 enum { FRAME_HDL=0, }; 00044 00045 class FrameHandler 00046 { 00047 public: 00048 static void VMB_CALL FrameDoneCallback( const VmbHandle_t handle, VmbFrame_t *pFrame ); 00049 00050 FrameHandler( FramePtr pFrame, IFrameObserverPtr pFrameObserver ); 00051 00052 FramePtr GetFrame() const; 00053 00054 bool EnterWriteLock( bool bExclusive = false ); 00055 void ExitWriteLock(); 00056 bool EnterReadLock(); 00057 void ExitReadLock(); 00058 00059 private: 00060 IFrameObserverPtr m_pObserver; 00061 FramePtr m_pFrame; 00062 ConditionHelper m_conditionHelper; 00063 MutexPtr m_pMutex; 00064 }; 00065 00066 typedef std::vector<FrameHandlerPtr> FrameHandlerPtrVector; 00067 00068 }} // namespace AVT::VmbAPI 00069 00070 #endif