#pragma once #include #include "FunctionDataTypeCommon.h" using namespace std; #define MAX_ELEMENTNAME 64 #define CLASSINDLL_CLASS_DECL class CFunctionInfomation; class CLASSINDLL_CLASS_DECL CFunctionInfo { public: CFunctionInfo(); virtual ~CFunctionInfo(){}; unsigned int CreateFunction(const string& strFunctionName); void ClearInfo(); void AddInputInfo(unsigned int nFunctionId, const FUNCIO_DISP& eInputType); void AddOutputInfo(unsigned int nFunctionId, const FUNCIO_DISP& eOutputType); void AddFunctionParam(unsigned int nFunctionId, const MICRO_DISP& param); void SetCacheCount(unsigned int nFunctionId, unsigned int nCount); bool GetFunctionInfo(CFunctionInfomation& info); bool IsFunctionNameExist(const string& strFunctionName); void GetFunctionNames(vector& vecFunctionNames); unsigned int GetFuntionCount(){ return m_vecFunctionInfoCount; }; private: CFunctionInfomation* m_vecFunctionInfo[100]; unsigned int m_vecFunctionInfoCount; }; class CFuncDataFactory; class CFunctionDataElement; class CLASSINDLL_CLASS_DECL CBaseFunctionDataElement { public: CBaseFunctionDataElement(); virtual ~CBaseFunctionDataElement(); void GetElementName(wstring& strName) const; FUNCTION_DATATYPE GetDataType() const; void* GetData(unsigned int& nLen) const; void* GetInfo(unsigned int& nLen) const; unsigned int GetInfoLen() const; bool Lock(); void UnLock(); bool IsValid() const; bool Clone(const CBaseFunctionDataElement* const DataElement); void ReleaseData(); protected: bool SetElementName(const wstring& strName); CFunctionDataElement* m_pFunctionDataElement; friend CFuncDataFactory; }; class CFunctionDataMgr; class CLASSINDLL_CLASS_DECL CFuncDataFactory { public: CFuncDataFactory(); virtual ~CFuncDataFactory(); CBaseFunctionDataElement* CreateDataElement(FUNCTION_DATATYPE eDataType); CBaseFunctionDataElement* CreateDataElement(const wstring& strName, FUNCTION_DATATYPE eDataType); bool RemoveDataElement(CBaseFunctionDataElement* pDataElement); private: void Clear(bool bForce); CFunctionDataMgr* m_pFunctionDataMgr; }; class CLASSINDLL_CLASS_DECL C2DGrayImageData : public CBaseFunctionDataElement { public: C2DGrayImageData(CFunctionDataMgr& DataMgr); virtual ~C2DGrayImageData(); bool GetInfo(IMG2DGRAYINFO& stInfo) const; void* GetData(unsigned int& nLen) const; bool CreateImageData(const IMG2DGRAYINFO& stInfo, MEM_STATUS eMemStatus); void SetFrameId(unsigned int nFrameId); }; class CLASSINDLL_CLASS_DECL CRGBImageData : public CBaseFunctionDataElement { public: typedef struct _stRGBData { unsigned char cR; unsigned char cG; unsigned char cB; _stRGBData() { memset(this, 0, sizeof(_stRGBData)); } _stRGBData& operator= (const _stRGBData& fh) { memcpy(this, &fh, sizeof(_stRGBData)); return *this; } } RGBDATA; CRGBImageData(CFunctionDataMgr& DataMgr); virtual ~CRGBImageData(); bool GetInfo(IMG2DRGBINFO& stInfo) const; void* GetData(unsigned int& nLen) const; RGBDATA* GetRGBData(unsigned int& nLen) const; bool CreateImageData(const IMG2DRGBINFO& stInfo, MEM_STATUS eMemStatus); void SetFrameId(unsigned int nFrameId); }; class CLASSINDLL_CLASS_DECL CFloatListData : public CBaseFunctionDataElement { public: CFloatListData(CFunctionDataMgr& DataMgr); virtual ~CFloatListData(){}; bool GetInfo(LISTINFO& stInfo) const; float* GetData(unsigned int& nLen) const; bool CreateFloatListData(const LISTINFO& stInfo, MEM_STATUS eMemStatus); }; class CLASSINDLL_CLASS_DECL CMemoryData : public CBaseFunctionDataElement { public: CMemoryData(CFunctionDataMgr& DataMgr); virtual ~CMemoryData(){}; bool GetInfo(MEMORYINFO& stInfo) const; void* GetData(unsigned int& nLen) const; bool CreateMemoryData(const MEMORYINFO& stInfo, MEM_STATUS eMemStatus); };