📄 umc_file_reader.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_READER_H__#define __UMC_FILE_READER_H__#include "umc_defs.h"#if defined (UMC_ENABLE_FILE_READER) || defined(UMC_ENABLE_FIO_READER)#include "vm_mmap.h"#include "vm_types.h"#include "ippdefs.h"#include "umc_data_reader.h"namespace UMC{ class FileReaderParams : public DataReaderParams { DYNAMIC_CAST_DECL(FileReaderParams, DataReaderParams) public: FileReaderParams():m_portion_size(0) { memset(m_file_name, 0, sizeof(m_file_name)); } vm_char m_file_name[MAXIMUM_PATH]; vm_var32 m_portion_size; }; class FileReader : public DataReader { DYNAMIC_CAST_DECL(FileReader, DataReader) public: ////////////////////////////////////////////////////////////////////////////// // Name: Init // // Purpose: Create and map first portion from file // // Parameters: // InitParams Pointer to the init (for filereader it's vm_char file_name[255] and portion_size // // // Return: // UMC_OK // UMC_FAILED_TO_OPEN_DEVICE file was not open // UMC_FAILED_TO_ALLOCATE_BUFFER mapping was not create // // // Notes: default value of portion_size is 0. After open portion = 1 // //////////////////////////////////////////////////////////////////////////////// virtual Status Init (DataReaderParams *InitParams); ////////////////////////////////////////////////////////////////////////////// // Name: Close // // Purpose: Close file // // Return: // UMC_OK // // Notes: // //////////////////////////////////////////////////////////////////////////////// virtual Status Close (); ////////////////////////////////////////////////////////////////////////////// // Name: Reset // // Purpose: Reset all internal parameters // // Parameters: // // Return: // UMC_OK // UMC_NOT_INITIALIZED - object was not initialize // UMC_FAILED_TO_ALLOCATE_BUFFER - mapping was not create // // Notes: // //////////////////////////////////////////////////////////////////////////////// virtual Status Reset (); ////////////////////////////////////////////////////////////////////////////// // Name: ReadData // // Purpose: Read nsize bytes and copy to data (return number bytes which was copy) // Cache data in case of small nsize // // Parameters: // data pointer to the data where copy nsize byte from stream // nsize integer - number bytes // // // Return: // UMC_OK // UMC_NOT_INITIALIZED - object was not initialize // UMC_END_OF_STREAM - end of stream // // // //////////////////////////////////////////////////////////////////////////////// virtual Status ReadData (void *data,vm_var32 *nsize) ; ////////////////////////////////////////////////////////////////////////////// // Name: MovePosition // // Purpose: Move position on npos bytes // // Parameters: // npos integer (+/-) bytes // // // Return: // UMC_OK // UMC_NOT_INITIALIZED - object was not initialize // UMC_END_OF_STREAM - end of stream // // // Notes: // //////////////////////////////////////////////////////////////////////////////// virtual Status MovePosition (vm_sizet npos) ; virtual Status CacheData (void *data,vm_var32 *nsize, int how_far); ////////////////////////////////////////////////////////////////////////////// // Name: SetPosition // // Purpose: Set position // // Parameters: // pos double (0:1.0) // // Return: // OK // ERR_MAP Error map next portion // // Notes: set position in the stream (file size * pos) // //////////////////////////////////////////////////////////////////////////////// virtual Status SetPosition (double pos); // return position in the stream virtual vm_sizet GetPosition (); // return file_size virtual vm_sizet GetSize (); FileReader(); virtual ~FileReader(); protected: vm_mmap m_mmap; Ipp8u *m_pbBuffer; vm_sizet m_stCurPortionSize; // size of current portion of file vm_var32 m_uiPortionSize; vm_sizet m_stDoneSize; // accumulative size of processed portions vm_sizet m_stFileSize; // file size vm_var32 m_uiPageSize; bool m_bBufferInit; bool m_bLastPortion; virtual Status MapCSize(vm_sizet csize); };}//namespace UMC#endif /* __UMC_FILE_READER_H__ */#endif //(UMC_ENABLE_FILE_READER) || defined(UMC_ENABLE_FIO_READER)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -