#pragma once class CDataContainer { public: enum DataType { eInt = 0, // 整型 eDouble = 1, // 浮点型 ePoint = 2, // 点 eVector = 3, // 向量 eTchar = 4, // 字符串 eId = 5, // AcDbObjectId }; typedef struct { int nVt; // 所保存数据的类型 int npszLen; union { double dVal[3]; short nVal; TCHAR *pszVal; LONG_PTR nId; }; }TParam; public: bool GetData(LPCTSTR pszKey, double &dVal); bool SetData(LPCTSTR pszKey, double dVal); bool GetData(LPCTSTR pszKey, int &nVal); bool SetData(LPCTSTR pszKey, int nVal); bool GetData(LPCTSTR pszKey, CString &strVal); bool SetData(LPCTSTR pszKey, const CString &strVal); bool GetData(LPCTSTR pszKey, AcGePoint3d &pt); bool SetData(LPCTSTR pszKey, const AcGePoint3d &pt); bool GetData(LPCTSTR pszKey, AcGeVector3d &vt); bool SetData(LPCTSTR pszKey, const AcGeVector3d &vt); bool GetData(LPCTSTR pszKey, AcDbObjectId &id); bool SetData(LPCTSTR pszKey, const AcDbObjectId &id); typedef std::map::iterator It; private: std::map m_mapDParam; };