Alphabetical Class List   File List   Compound Members  

DataLoader.h

00001 //
00002 // Copyright (c) 2000 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 // $Header:
00013 //
00014 // DataLoader.h : Declaration of the CDataLoader class
00015 //
00017 
00018 #if !defined(AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_)
00019 #define AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_
00020 
00021 #if _MSC_VER > 1000
00022 #pragma once
00023 #endif // _MSC_VER > 1000
00024 
00025 #include "resource.h"       // main symbols
00026 #include <atlctl.h>
00027 #include "HUtility.h"
00028 
00029 #include "HStream.h"
00030 #include "HOpcodeHandler.h"
00031 struct IWebBrowserApp;
00032 
00033 
00034 #include "Vector"
00035 using namespace std;
00036 
00037  
00038 class HBaseModel;
00039 class HCtrlView;
00040 class HCtrlDB;
00041 class HBaseOperator;
00042 class CHoops3dStreamCtrl;
00043 
00044 
00045 struct databuffer
00046 {
00047         unsigned char *data;
00048         unsigned int length;
00049 };
00050 
00051 
00053 
00059 class CDataLoader  
00060 {
00061 public:
00062         CDataLoader();
00063         virtual ~CDataLoader();
00064 
00069         void Init(HCtrlView *View);
00076         bool StartDownload(BSTR filename, bool isStreamable = true);
00083         bool OnData (BYTE* pBytes, DWORD dwSize);
00084 
00089         bool ProcessNextChunk();        
00090 
00094         bool GetDownloadInProgress() { return m_bDownloadInProgress; }
00095 
00099         long GetDownloadDataReceived() { return m_DataReceived; }
00100         
00104         long GetDownloadDataTotalSize() { return m_DataReceiveSize; }
00109         void AbortDownload() { if (m_bDownloadInProgress) m_bAbortDownload = true; }
00114         void SetDownloadStatus(int ulProgressMax) { m_DataReceiveSize = ulProgressMax; }
00115 
00116 protected:
00123         TK_Status                       ProcessData( BYTE* pBytes, DWORD dwSize);
00127         void ClearCachedDataList();
00128 
00129 
00130         
00131         vector <databuffer *> m_CachedDataList;                 
00133         HCtrlView*                      m_pView;                                        
00134         bool                            m_bDataIsStreamable;            
00136         bool                            m_bDownloadInProgress;          
00137         long                            m_DataReceived;                         
00138         long                            m_DataReceiveSize;                      
00139         bool                            m_bAbortDownload;                       
00141         bool                            m_bDataProcessingComplete;  
00143 private:
00144         FILE *                          m_temphandle;
00145         char                            m_tempfilename[MAX_PATH];
00146 
00147 };
00148 
00149 
00150 
00151 template <class T>
00152 class CBindStatusCallback2 : public CBindStatusCallback<T>
00153 {
00154 public:
00155         STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
00156         {
00157 //              ATLTRACE(_T("CBindStatusCallback2::OnProgress"));
00158 //              return m_pT->OnProgress ( ulProgress, ulProgressMax, ulStatusCode, szStatusText );
00159                 m_pT->GetDataLoader()->SetDownloadStatus(ulProgressMax);
00160                 return S_OK;
00161         }
00162 
00163         static HRESULT Download(T* pT, ATL_PDATAAVAILABLE pFunc, BSTR bstrURL, IUnknown* pUnkContainer = NULL, BOOL bRelative = FALSE)
00164         {
00165                 CComObject<CBindStatusCallback2<T> > *pbsc;
00166                 HRESULT hRes = CComObject<CBindStatusCallback2<T> >::CreateInstance(&pbsc);
00167                 if (FAILED(hRes))
00168                         return hRes;
00169                 return pbsc->StartAsyncDownload(pT, pFunc, bstrURL, pUnkContainer, bRelative);
00170         }
00171 };
00172 
00173 
00174 
00175 
00176 class TK_My_Initial_View : public HTK_Camera 
00177 {
00178 private:
00179         HCtrlView * m_pView;
00180         int                             my_stage;
00181         HTK_Camera              *my_camera; 
00182 
00183 public:
00184         TK_My_Initial_View(HCtrlView * view) : HTK_Camera(TKE_View) 
00185         { 
00186                 m_pView = view;
00187         }
00188 
00189         TK_Status       Interpret(BStreamFileToolkit &tk, ID_Key key, int variant) alter;
00190         TK_Status   Execute (BStreamFileToolkit & tk) alter;    
00191 };
00192 
00193 #endif // !defined(AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_)
00194 
00195 


Copyright © 2002 Tech Soft 3D