AdvancedFunctionDataElement.h 4.1 KB

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