| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 | #pragma once#include <string>#include <vector>#include "element.h"#include <map>using namespace std;using namespace OTSDATA;class MaxEDSRule :public xmls::ISlo{public:	virtual void Serialize(bool isStoring, tinyxml2::XMLDocument *classDoc, tinyxml2::XMLElement *rootNode) override;	CElementsList m_elementList;	std::vector<std::string> m_ImgPropertyList;	std::vector<std::string> m_OtherpropertyList;	std::vector<std::string> m_usingConstants;	std::string m_expressionStr;	double m_MaxEDSTime;};typedef std::shared_ptr<MaxEDSRule>  MaxEDSRulePtr;typedef std::vector<MaxEDSRulePtr> MaxEDSRuleList;class ZeroElementRule :public xmls::ISlo{public:	virtual void Serialize(bool isStoring, tinyxml2::XMLDocument *classDoc, tinyxml2::XMLElement *rootNode) override;	CElementsList GetUsingElementList() const { return m_UsingelementList; }	void SetUsingElementList(CElementsList val) { m_UsingelementList = val; }	std::vector<std::string> GetImgPropertyList() const { return m_ImgPropertyList; }	void SetImgPropertyList(std::vector<std::string> val) { m_ImgPropertyList = val; }	std::vector<std::string> GetOtherpropertyList() const { return m_OtherpropertyList; }	void SetOtherpropertyList(std::vector<std::string> val) { m_OtherpropertyList = val; }	std::vector<std::string> GetUsingConstants() const { return m_usingConstants; }	void SetUsingConstants(std::vector<std::string> val) { m_usingConstants = val; }	std::string GetExpressionStr() const { return m_expressionStr; }	void SetExpressionStr(std::string val) { m_expressionStr = val; }		std::string GetZeroElementName() const { return m_ZeroElementName; }	void SetZeroElementName(std::string val) { m_ZeroElementName = val; }	private:	CElementsList m_UsingelementList;		std::vector<std::string> m_ImgPropertyList;	std::vector<std::string> m_OtherpropertyList;	std::vector<std::string> m_usingConstants;	std::string m_expressionStr;	std::string m_ZeroElementName;};typedef std::shared_ptr<ZeroElementRule>  ZeroElementRulePtr;typedef std::vector<ZeroElementRulePtr> ZeroElementRuleList;class PartSTDItem :public xmls::ISlo{public:		std::map<std::string, CElementPtr>& GetMapElements();	virtual void Serialize(bool isStoring, tinyxml2::XMLDocument *classDoc, tinyxml2::XMLElement *rootNode) override;	std::string  GetHardness() const { return m_Hardness; }	void SetHardness(std::string val) { m_Hardness = val; }	std::string  GetDensity() const { return m_Density; }	void SetDensity(std::string val) { m_Density = val; }	std::string GetElectrical_conductivity() const { return m_Electrical_conductivity; }	void SetElectrical_conductivity(std::string val) { m_Electrical_conductivity = val; }	int GetID() const { return ID; }	void SetID(int val) { ID = val; }	std::string GetName() const { return m_name; }	void SetName(std::string val) { m_name = val; }	std::string GetColor() const { return m_color; }	void SetColor(std::string val) { m_color = val; }	int GetGrpID() const { return m_grpId; }	void SetGrpID(int val) { m_grpId = val; }	std::string GetGrpName() const { return m_grpName; }	void SetGrpName(std::string val) { m_grpName = val; }	std::string GetGrpColor() const { return m_grpColor; }	void SetGrpColor(std::string val) { m_grpColor = val; }	std::vector<std::string> GetUsingImgPropertyNameList()  { return m_ImgPropertyList; }	void SetUsingImgPropertyNameList(std::vector<std::string> val) { m_ImgPropertyList= val; }	std::vector<std::string> GetUsingOtherpropertyList()  { return m_OtherpropertyList; }	void SetUsingOtherpropertyList(std::vector<std::string> val) { m_OtherpropertyList = val; }	std::vector<std::string> GetUsingConstants() const { return m_usingConstants; }	std::string GetExpressionStr() const { return m_expressionStr; }	void SetExpressionStr(std::string val) { m_expressionStr = val; }	CElementsList GetKeyElementList() const { return m_KeyelementList; }	void SetKeyElementList(CElementsList val) { m_KeyelementList=val; }	CElementsList GetSubElementList() const { return m_SubelementList; }	void SetSubElementList(CElementsList val) { m_SubelementList = val; }	CElementsList GetAllSortedEleList()	{		std::multimap<int, CElementPtr> mapEles;// sorted all the using elements by the name's length,so that we can always handle the longer name element first.		//because if we handle short name element first ,we may treat "Cu" as "C" or other have the same character in name element.		for (auto ele : m_KeyelementList)		{			mapEles.insert(std::pair<int, CElementPtr>(ele->GetName().GetLength(), ele));		}		for (auto ele : m_SubelementList)		{			mapEles.insert(std::pair<int, CElementPtr>(ele->GetName().GetLength(), ele));		}		CElementsList eleList;		for (auto itr = mapEles.rbegin(); itr != mapEles.rend(); itr++)		{			eleList.push_back(itr->second);		}		return eleList;		}	/*CElementsList m_SubelementList;*/	std::string GetFormula() const { return m_Formula; }	void SetFormula(std::string val) { m_Formula = val; }	std::string GetElement() const { return m_Element; }	void SetElement(std::string val) { m_Element = val; }	double GetBSE() const { return m_BSE; }	void SetBSE(double val) { m_BSE = val; }private:	int ID;	std::string m_name;	std::string m_color;	int m_grpId;	std::string m_grpName;	std::string m_grpColor;	CElementsList m_KeyelementList;	CElementsList m_SubelementList;	std::vector<std::string> m_ImgPropertyList;	std::vector<std::string> m_OtherpropertyList;	std::vector<std::string> m_usingConstants;	std::string m_expressionStr;	std::map <std::string, CElementPtr> m_mapEleItems;	std::string m_Hardness;	std::string m_Density;	std::string  m_Electrical_conductivity;	double m_BSE;	std::string m_Formula;	std::string m_Element;};typedef std::shared_ptr<PartSTDItem>  PartSTDItemPtr;typedef std::vector<PartSTDItemPtr> PartSTDItemList;class ParticleSTD:public xmls::ISlo{public:	ParticleSTD() {};	~ParticleSTD() {};	//void AddItem();	std::vector<PartSTDItemPtr> GetSTDItems();	ZeroElementRuleList GetZeroRules();	MaxEDSRuleList GetMaxEDSRules();	bool LoadItemsFromFile();	void PartSTDItemListClear();	void ZeroElementRuleListClear();	void MaxEDSRuleListClear();	void ConstantsMapClear();	void setSTDList(PartSTDItemList listSTDItem);	void setZeroElementRuleList(ZeroElementRuleList listZeroElementRuleItem);	void setMaxEDSRuleList(MaxEDSRuleList listMaxEDSRuleItem);	void setConstantsMap(map<std::string, double> listConstantsItem);	std::map<std::string, double>& GetMapConstants();	virtual void Serialize(bool isStoring, tinyxml2::XMLDocument *classDoc, tinyxml2::XMLElement *rootNode) override;	PartSTDItemPtr GetSTDItemById(int id);	PartSTDItemList m_stdItems;	ZeroElementRuleList m_zeroRules;	std::map<std::string, double> m_mapConstants;	MaxEDSRuleList m_MaxRules;};typedef std::shared_ptr<ParticleSTD>  ParticleSTDPtr;typedef std::vector<ParticleSTDPtr> ParticleSTDList;
 |