ECMInterface.h 2.9 KB

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