AdvancedFunctionDataElement.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #pragma once
  2. #include <vector>
  3. #include "FunctionDataTypeCommon.h"
  4. using namespace std;
  5. #define MAX_ELEMENTNAME 64
  6. #define CLASSINDLL_CLASS_DECL
  7. class CFunctionInfomation;
  8. class CLASSINDLL_CLASS_DECL CFunctionInfo
  9. {
  10. public:
  11. CFunctionInfo();
  12. virtual ~CFunctionInfo(){};
  13. unsigned int CreateFunction(const string& strFunctionName);
  14. void ClearInfo();
  15. void AddInputInfo(unsigned int nFunctionId, const FUNCIO_DISP& eInputType);
  16. void AddOutputInfo(unsigned int nFunctionId, const FUNCIO_DISP& eOutputType);
  17. void AddFunctionParam(unsigned int nFunctionId, const MICRO_DISP& param);
  18. void SetCacheCount(unsigned int nFunctionId, unsigned int nCount);
  19. bool GetFunctionInfo(CFunctionInfomation& info);
  20. bool IsFunctionNameExist(const string& strFunctionName);
  21. void GetFunctionNames(vector<string>& vecFunctionNames);
  22. unsigned int GetFuntionCount(){ return m_vecFunctionInfoCount; };
  23. private:
  24. CFunctionInfomation* m_vecFunctionInfo[100];
  25. unsigned int m_vecFunctionInfoCount;
  26. };
  27. class CFuncDataFactory;
  28. class CFunctionDataElement;
  29. class CLASSINDLL_CLASS_DECL CBaseFunctionDataElement
  30. {
  31. public:
  32. CBaseFunctionDataElement();
  33. virtual ~CBaseFunctionDataElement();
  34. void GetElementName(wstring& strName) const;
  35. FUNCTION_DATATYPE GetDataType() const;
  36. void* GetData(unsigned int& nLen) const;
  37. void* GetInfo(unsigned int& nLen) const;
  38. unsigned int GetInfoLen() const;
  39. bool Lock();
  40. void UnLock();
  41. bool IsValid() const;
  42. bool Clone(const CBaseFunctionDataElement* const DataElement);
  43. void ReleaseData();
  44. protected:
  45. bool SetElementName(const wstring& strName);
  46. CFunctionDataElement* m_pFunctionDataElement;
  47. friend CFuncDataFactory;
  48. };
  49. class CFunctionDataMgr;
  50. class CLASSINDLL_CLASS_DECL CFuncDataFactory
  51. {
  52. public:
  53. CFuncDataFactory();
  54. virtual ~CFuncDataFactory();
  55. CBaseFunctionDataElement* CreateDataElement(FUNCTION_DATATYPE eDataType);
  56. CBaseFunctionDataElement* CreateDataElement(const wstring& strName, FUNCTION_DATATYPE eDataType);
  57. bool RemoveDataElement(CBaseFunctionDataElement* pDataElement);
  58. private:
  59. void Clear(bool bForce);
  60. CFunctionDataMgr* m_pFunctionDataMgr;
  61. };
  62. class CLASSINDLL_CLASS_DECL C2DGrayImageData : public CBaseFunctionDataElement
  63. {
  64. public:
  65. C2DGrayImageData(CFunctionDataMgr& DataMgr);
  66. virtual ~C2DGrayImageData();
  67. bool GetInfo(IMG2DGRAYINFO& stInfo) const;
  68. void* GetData(unsigned int& nLen) const;
  69. bool CreateImageData(const IMG2DGRAYINFO& stInfo, MEM_STATUS eMemStatus);
  70. void SetFrameId(unsigned int nFrameId);
  71. };
  72. class CLASSINDLL_CLASS_DECL CRGBImageData : public CBaseFunctionDataElement
  73. {
  74. public:
  75. typedef struct _stRGBData
  76. {
  77. unsigned char cR;
  78. unsigned char cG;
  79. unsigned char cB;
  80. _stRGBData()
  81. {
  82. memset(this, 0, sizeof(_stRGBData));
  83. }
  84. _stRGBData& operator= (const _stRGBData& fh)
  85. {
  86. memcpy(this, &fh, sizeof(_stRGBData));
  87. return *this;
  88. }
  89. }
  90. RGBDATA;
  91. CRGBImageData(CFunctionDataMgr& DataMgr);
  92. virtual ~CRGBImageData();
  93. bool GetInfo(IMG2DRGBINFO& stInfo) const;
  94. void* GetData(unsigned int& nLen) const;
  95. RGBDATA* GetRGBData(unsigned int& nLen) const;
  96. bool CreateImageData(const IMG2DRGBINFO& stInfo, MEM_STATUS eMemStatus);
  97. void SetFrameId(unsigned int nFrameId);
  98. };
  99. class CLASSINDLL_CLASS_DECL CFloatListData : public CBaseFunctionDataElement
  100. {
  101. public:
  102. CFloatListData(CFunctionDataMgr& DataMgr);
  103. virtual ~CFloatListData(){};
  104. bool GetInfo(LISTINFO& stInfo) const;
  105. float* GetData(unsigned int& nLen) const;
  106. bool CreateFloatListData(const LISTINFO& stInfo, MEM_STATUS eMemStatus);
  107. };
  108. class CLASSINDLL_CLASS_DECL CMemoryData : public CBaseFunctionDataElement
  109. {
  110. public:
  111. CMemoryData(CFunctionDataMgr& DataMgr);
  112. virtual ~CMemoryData(){};
  113. bool GetInfo(MEMORYINFO& stInfo) const;
  114. void* GetData(unsigned int& nLen) const;
  115. bool CreateMemoryData(const MEMORYINFO& stInfo, MEM_STATUS eMemStatus);
  116. };