#pragma once #include #include #include "element.h" #include 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 m_ImgPropertyList; std::vector m_OtherpropertyList; std::vector m_usingConstants; std::string m_expressionStr; double m_MaxEDSTime; }; typedef std::shared_ptr MaxEDSRulePtr; typedef std::vector 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 GetImgPropertyList() const { return m_ImgPropertyList; } void SetImgPropertyList(std::vector val) { m_ImgPropertyList = val; } std::vector GetOtherpropertyList() const { return m_OtherpropertyList; } void SetOtherpropertyList(std::vector val) { m_OtherpropertyList = val; } std::vector GetUsingConstants() const { return m_usingConstants; } void SetUsingConstants(std::vector 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 m_ImgPropertyList; std::vector m_OtherpropertyList; std::vector m_usingConstants; std::string m_expressionStr; std::string m_ZeroElementName; }; typedef std::shared_ptr ZeroElementRulePtr; typedef std::vector ZeroElementRuleList; class PartSTDItem :public xmls::ISlo { public: std::map& 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 GetUsingImgPropertyNameList() { return m_ImgPropertyList; } void SetUsingImgPropertyNameList(std::vector val) { m_ImgPropertyList= val; } std::vector GetUsingOtherpropertyList() { return m_OtherpropertyList; } void SetUsingOtherpropertyList(std::vector val) { m_OtherpropertyList = val; } std::vector 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 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(ele->GetName().GetLength(), ele)); } for (auto ele : m_SubelementList) { mapEles.insert(std::pair(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 m_ImgPropertyList; std::vector m_OtherpropertyList; std::vector m_usingConstants; std::string m_expressionStr; std::map 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 PartSTDItemPtr; typedef std::vector PartSTDItemList; class ParticleSTD:public xmls::ISlo { public: ParticleSTD() {}; ~ParticleSTD() {}; //void AddItem(); std::vector 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 listConstantsItem); std::map& 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 m_mapConstants; MaxEDSRuleList m_MaxRules; }; typedef std::shared_ptr ParticleSTDPtr; typedef std::vector ParticleSTDList;