www.pudn.com > DalsaNetlink.rar > CyApp.h


// CyApp.h : main header file for the CyApp application 
// 
 
#if !defined(AFX_CYAPP_H__EF32D4EC_329F_442A_8974_4A81A2CAEC15__INCLUDED_) 
#define AFX_CYAPP_H__EF32D4EC_329F_442A_8974_4A81A2CAEC15__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#ifndef __AFXWIN_H__ 
	#error include 'stdafx.h' before including this file for PCH 
#endif 
 
#include "resource.h"		// main symbols 
 
#include "CyConfig.h" 
#include "CyGrabber.h" 
#include "CyDisplayEx.h" 
#include "CyImageBuffer.h" 
#include "CyChannel.h" 
#include "CyCameraInterface.h" 
#include "CyPropertySheet.h" 
#include  
 
#ifdef _HIGH_MEMORY_ 
#include  
#endif // _HIGH_MEMORY_ 
 
///////////////////////////////////////////////////////////////////////////// 
// CyApp: 
// See CyApp.cpp for the implementation of this class 
// 
class CyApp : public CWinApp 
{ 
public: 
	CyApp(); 
    virtual ~CyApp(); 
 
    HACCEL  mAccelerators; 
    CyPropertySheet mPropertySheet; 
    CString mFileName; 
    bool    mSaveAdapterAsIndex; 
 
    bool mMulticastMasterNoData; 
 
    bool mConfigChanged; 
    bool mDetectOnStartup; 
    bool mSelectCameraAfterDetect; 
    bool mConnectAfterCameraSelection; 
    bool mAcquisitionAfterConnect; 
 
    unsigned long mDefaultAnswerTimeout; 
    unsigned long mDefaultFirstPacketTimeout; 
    unsigned long mDefaultPacketTimeout; 
    unsigned long mDefaultRequestTimeout; 
    unsigned long mDefaultPacketSize; 
 
    unsigned long mBayerFlag; 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CyApp) 
	public: 
	virtual BOOL InitInstance(); 
	virtual BOOL PreTranslateMessage(MSG* pMsg); 
	//}}AFX_VIRTUAL 
 
 
    CyDevice& GetDevice() const 
    { 
        return const_cast( this )->mGrabber->GetDevice(); 
    } 
 
    CyGrabber& GetGrabber() const 
    { 
        return *mGrabber; 
    } 
 
    void SetCamera( CyCameraInterface* aCamera ) 
    { 
        delete mCamera; 
        mCamera = aCamera; 
 
        UINT lFlags; 
        if ( mCamera != 0 ) 
        { 
            lFlags = MF_BYCOMMAND | MF_ENABLED; 
        } 
        else 
        { 
            lFlags = MF_BYCOMMAND | MF_GRAYED; 
        } 
 
        mPropertySheet.GetMenu()->GetSubMenu( 1 )->EnableMenuItem( ID_CAMERA_RESET, lFlags ); 
    } 
    bool HasCamera( ) const 
    { 
        return mCamera != 0; 
    } 
    CyCameraInterface& GetCamera() const 
    { 
        return *mCamera; 
    } 
 
    CyConfig& GetConfig() const 
    { 
        return const_cast( this )->mConfig; 
    }; 
 
 
    CyDisplayEx& GetDisplay() const 
    { 
        return const_cast(this)->mDisplay; 
    } 
 
 
    CyImageBuffer& GetBuffer( const CyChannel& aChannel ) const 
    { 
        if ( mChannels[ aChannel.GetID() ] == 0 ) 
        { 
            mChannels[ aChannel.GetID() ] = new ChannelData; 
#ifdef _HIGH_MEMORY_ 
            mChannels[ aChannel.GetID() ]->mBuffer.SetMemoryManager( mHighMemoryManager ); 
#endif // _HIGH_MEMORY_ 
        } 
 
        return mChannels[ aChannel.GetID() ]->mBuffer; 
    }; 
 
 
    static unsigned long mCallbackCounter; 
    static unsigned long mCallbackMask; 
    static unsigned long mCallbackTimestamp; 
 
 
// Implementation 
 
	//{{AFX_MSG(CyApp) 
	afx_msg void OnAbout(); 
	afx_msg void OnCameraReset(); 
	afx_msg void OnFileSaveAdapterIndex(); 
	//}}AFX_MSG 
 
	afx_msg void OnFileSave(); 
	afx_msg void OnFileSaveas(); 
 
    afx_msg void OnBufferQueue1(); 
    afx_msg void OnBufferQueue2(); 
    afx_msg void OnBufferQueue4(); 
    afx_msg void OnBufferQueue8(); 
    afx_msg void OnBufferQueue16(); 
    afx_msg void OnBufferQueue32(); 
    afx_msg void OnBufferQueue64(); 
    afx_msg void OnBufferQueue128(); 
    afx_msg void OnBufferQueue256(); 
 
    afx_msg void OnBufferQueueModeReplace(); 
    afx_msg void OnBufferQueueModeDrop(); 
 
    afx_msg void OnResetInterruptCount(); 
 
	DECLARE_MESSAGE_MAP() 
 
private: 
    CyConfig            mConfig; 
    CyGrabber*          mGrabber; 
    CyCameraInterface*  mCamera; 
    CyDisplayEx         mDisplay; 
 
#ifdef _HIGH_MEMORY_ 
    mutable CyHighMemoryManager mHighMemoryManager; 
#endif // _HIGH_MEMORY_ 
 
    struct ChannelData 
    { 
        CyImageBuffer   mBuffer; 
    }; 
 
    mutable std::map< CyChannelID, ChannelData* > 
        mChannels; 
 
    void SetBufferQueueSize( unsigned long aSize ); 
}; 
 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_CYAPP_H__EF32D4EC_329F_442A_8974_4A81A2CAEC15__INCLUDED_)