📄 umc_file_writer.h
字号:
/*//// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.//*/#ifndef __UMC_FILE_WRITER_H__#define __UMC_FILE_WRITER_H__#include "umc_defs.h"#if defined (UMC_ENABLE_FILE_WRITER)#include <stdio.h>#include "umc_data_writer.h"//#define USE_FILE_MAPPINGnamespace UMC{ class FileWriterParams : public DataWriterParams { DYNAMIC_CAST_DECL(FileWriterParams, DataWriterParams) public: vm_char m_file_name[MAXIMUM_PATH]; vm_sizet m_portion_size; FileWriterParams(); }; class FileWriter : public DataWriter { public: ////////////////////////////////////////////////////////////////////////////// // Name: Init // // Purpose: Create and map first portion from file // // Parameters: // InitParams Pointer to the init (for filereader it's // vm_char m_file_name[] and m_portion_size // // // Return: // OK // ERR_FILECREATE_IS_INVALID file not ctrate // ERR_NULL_PTR pointer to the buffer is NULL // // // Notes: default value of portion_size is 0. After open portion = 1 // //////////////////////////////////////////////////////////////////////////////// Status Init (DataWriterParams *InitParams); ////////////////////////////////////////////////////////////////////////////// // Name: Close // // Purpose: Close file // // Parameters: // // Return: // OK file was close // // Notes: // //////////////////////////////////////////////////////////////////////////////// Status Close (); ////////////////////////////////////////////////////////////////////////////// // Name: Reset // // Purpose: Reset all internal parameters // // Parameters: // // Return: // OK // // Notes: // //////////////////////////////////////////////////////////////////////////////// Status Reset (); ////////////////////////////////////////////////////////////////////////////// // Name: GetData // // Purpose: Get nsize bytes and copy to data (return number bytes which was copy) // // Parameters: // data pointer to the data where copy nsize byte from stream // nsize integer - number bytes // // Return: // return number bytes which was copy // // Notes: // //////////////////////////////////////////////////////////////////////////////// Status PutData (void *data, int &nsize);#ifndef USE_FILE_MAPPING ////////////////////////////////////////////////////////////////////////////// // Name: SetPosition // // Purpose: Set current position in destination media // // Parameters: // nPosLow Lower 32 bit(s) of position // lpnPosHigh Pointer to upper 32 bit(s) of position (can be NULL) // nMethod Initial position. Use C standard defines: // SEEK_CUR - Current position of pointer // SEEK_END - End of media // SEEK_SET - Beginning of media // // Return: // return UMC_OK if position is changed, otherwise code of error // // Notes: // Not all media can change current position //////////////////////////////////////////////////////////////////////////////// virtual Status SetPosition (vm_var32 nPosLow, vm_var32 *lpnPosHigh, vm_var32 nMethod); ////////////////////////////////////////////////////////////////////////////// // Name: GetPosition // // Purpose: Get current position in destiantion media // // Parameters: // lpnPosLow Pointer to variable to lower 32 bit(s) of position // lpnPosHigh Pointer to variable to upper 32 bit(s) of position // // Return: // return UMC_OK if position is returned, otherwise code of error // // Notes: // Not all media can return current position //////////////////////////////////////////////////////////////////////////////// virtual Status GetPosition (vm_var32 *lpnPosLow, vm_var32 *lpnPosHigh);#endif //USE_FILE_MAPPING FileWriter(); virtual ~FileWriter(); protected:#ifndef USE_FILE_MAPPING FILE * m_file;#else Status FileWriter::MapCSize(); vm_mmap m_mmap; unsigned char *m_pbBuffer; vm_var32 m_uiFileSize; vm_var32 m_uiPortionSize; vm_sizet m_stDoneSize; // accumulative size of processed portions vm_sizet m_stPos; // position in current portion of file vm_var32 m_uiPageSize; bool m_bBufferInit;#endif };}//namespace UMC#endif //(UMC_ENABLE_FILE_READER)#endif /* __UMC_FILE_WRITER_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -