1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #pragma once
- #include "DataElementInterface.h"
- #include "LoggerInterface.h"
- #define ECMHOLDERDLL_CLASS_DECL
- namespace DIOS_FILE
- {
- class ECMHOLDERDLL_CLASS_DECL IFileHolderInterface
- {
- public:
- virtual bool OpenFile(const wchar_t* wszFileName) = 0;
- virtual bool Create(const wchar_t* wszFileName) = 0;
- virtual bool ReadFrame(unsigned int nFrameId) = 0;//nFrameId >= 1
- virtual const wchar_t* GetFileDisp() = 0;
- virtual const wchar_t* GetFileName() = 0;
- virtual DIOS_DataElement::CDataElementGroup* GetFrame() = 0;
- virtual const wchar_t* GetFrameDisp() { return L""; };
- virtual void Close() = 0;
- virtual unsigned int GetNumberofFrames() const = 0;
- virtual unsigned int GetStoredNumberofFrames() const = 0;
- virtual unsigned int GetFileMaxNumberofFrames() const = 0;
- };
- class CStdECOMFileHolder;
- class ECMHOLDERDLL_CLASS_DECL CStdECOMHolder : public IFileHolderInterface
- {
- public:
- CStdECOMHolder(DIOS_DataElement::IDataMgr* pDataMgr);
- virtual ~CStdECOMHolder();
- bool SetFileCfg(unsigned int uFileHeaderDispMaxLen, unsigned int uFrameHeaderDispMaxLen, unsigned int uFrameDataRegionMaxLen, unsigned int uMaxNumberofFrames);
- bool GetFileCfg(unsigned int& uFileHeaderDispMaxLen, unsigned int& uFrameHeaderDispMaxLen, unsigned int& uFrameDataRegionMaxLen, unsigned int& uMaxNumberofFrames);
- void SetDefaultFileCfg();//默认值 4 * 1024 * 1024, 4 * 1024, 0, 500
- virtual bool Create(const wchar_t* wszFileName);
- virtual const wchar_t* GetFileName();
- bool AddFrame(const wchar_t* wszFrameDisp, DIOS_DataElement::CDataElementGroup* opGroup);
- bool UpdateFrame(unsigned int nFrameId, const wchar_t* wszFrameDisp, DIOS_DataElement::CDataElementGroup* opGroup);
- //更新文件头描述
- bool UpdateFile(const wchar_t* wszFileHeaderDisp);
- virtual bool OpenFile(const wchar_t* wszFileName);
- virtual bool ReadFrame(unsigned int nFrameId);
- virtual void Close();
- //获取文件数据帧信息,需要先调用ReadFrame
- virtual DIOS_DataElement::CDataElementGroup* GetFrame();
- //文件帧头描述,需要先调用ReadFrame
- virtual const wchar_t* GetFrameDisp();
- //文件头描述
- virtual const wchar_t* GetFileDisp();
- //文件存储的有效总帧数
- virtual unsigned int GetNumberofFrames() const;
- //文件存储的实际总帧数
- virtual unsigned int GetStoredNumberofFrames() const;
- //每个文件分块的最大帧数
- virtual unsigned int GetFileMaxNumberofFrames() const;
- private:
- CStdECOMFileHolder* m_pStdECOMFileHolder;
- std::wstring* poFrameDisp;
- std::wstring* poFileDisp;
- DIOS_Kernel::CLogClient* m_pLogClient;
- bool m_bInit;
- };
- }
|