ECMInterface.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #pragma once
  2. #include "DataElementInterface.h"
  3. #include "LoggerInterface.h"
  4. #define ECMHOLDERDLL_CLASS_DECL
  5. namespace DIOS_FILE
  6. {
  7. class ECMHOLDERDLL_CLASS_DECL IFileHolderInterface
  8. {
  9. public:
  10. virtual bool OpenFile(const wchar_t* wszFileName) = 0;
  11. virtual bool Create(const wchar_t* wszFileName) = 0;
  12. virtual bool ReadFrame(unsigned int nFrameId) = 0;//nFrameId >= 1
  13. virtual const wchar_t* GetFileDisp() = 0;
  14. virtual const wchar_t* GetFileName() = 0;
  15. virtual DIOS_DataElement::CDataElementGroup* GetFrame() = 0;
  16. virtual const wchar_t* GetFrameDisp() { return L""; };
  17. virtual void Close() = 0;
  18. virtual unsigned int GetNumberofFrames() const = 0;
  19. virtual unsigned int GetStoredNumberofFrames() const = 0;
  20. virtual unsigned int GetFileMaxNumberofFrames() const = 0;
  21. };
  22. class CStdECOMFileHolder;
  23. class ECMHOLDERDLL_CLASS_DECL CStdECOMHolder : public IFileHolderInterface
  24. {
  25. public:
  26. CStdECOMHolder(DIOS_DataElement::IDataMgr* pDataMgr);
  27. virtual ~CStdECOMHolder();
  28. bool SetFileCfg(unsigned int uFileHeaderDispMaxLen, unsigned int uFrameHeaderDispMaxLen, unsigned int uFrameDataRegionMaxLen, unsigned int uMaxNumberofFrames);
  29. bool GetFileCfg(unsigned int& uFileHeaderDispMaxLen, unsigned int& uFrameHeaderDispMaxLen, unsigned int& uFrameDataRegionMaxLen, unsigned int& uMaxNumberofFrames);
  30. void SetDefaultFileCfg();//默认值 4 * 1024 * 1024, 4 * 1024, 0, 500
  31. virtual bool Create(const wchar_t* wszFileName);
  32. virtual const wchar_t* GetFileName();
  33. bool AddFrame(const wchar_t* wszFrameDisp, DIOS_DataElement::CDataElementGroup* opGroup);
  34. bool UpdateFrame(unsigned int nFrameId, const wchar_t* wszFrameDisp, DIOS_DataElement::CDataElementGroup* opGroup);
  35. //更新文件头描述
  36. bool UpdateFile(const wchar_t* wszFileHeaderDisp);
  37. virtual bool OpenFile(const wchar_t* wszFileName);
  38. virtual bool ReadFrame(unsigned int nFrameId);
  39. virtual void Close();
  40. //获取文件数据帧信息,需要先调用ReadFrame
  41. virtual DIOS_DataElement::CDataElementGroup* GetFrame();
  42. //文件帧头描述,需要先调用ReadFrame
  43. virtual const wchar_t* GetFrameDisp();
  44. //文件头描述
  45. virtual const wchar_t* GetFileDisp();
  46. //文件存储的有效总帧数
  47. virtual unsigned int GetNumberofFrames() const;
  48. //文件存储的实际总帧数
  49. virtual unsigned int GetStoredNumberofFrames() const;
  50. //每个文件分块的最大帧数
  51. virtual unsigned int GetFileMaxNumberofFrames() const;
  52. private:
  53. CStdECOMFileHolder* m_pStdECOMFileHolder;
  54. std::wstring* poFrameDisp;
  55. std::wstring* poFileDisp;
  56. DIOS_Kernel::CLogClient* m_pLogClient;
  57. bool m_bInit;
  58. };
  59. }