• 数据类的设计


    **info.h

    #pragma once
    
    _MB_DATABASE_BEGIN
    
    class MB_DATABASE_EXT CBeamSection:public CSection
    {
    public:
    	CBeamSection();
    	CBeamSection(const CBeamSection* pBeamSection);
    	virtual ~CBeamSection(void);
    	virtual CSection* Clone() const { return new CBeamSection(this);}
    	virtual void Copy(const CSection* pSection);
    	virtual BOOL Compare(const CSection* pSection) const;
    	CBeamSection & operator = (const CBeamSection &BeamSection){ Copy(&BeamSection);return *this; }
    	BOOL operator == (const CBeamSection &BeamSection) const { return Compare(&BeamSection); }
    	virtual BOOL Import(const CSection* pSection);
    	virtual void Serialize(CArchive& ar);
    }
    _MB_DATABASE_END


    **info.cpp

    _MB_DATABASE_BEGIN
    
    CBeamSection::CBeamSection()
    {
    	m_enType=BST_STANDARD;
    	m_enSectionType=ST_SPC001;
    	m_dGrade = 0;
    	m_dH = 1.5;
    }
    CBeamSection::CBeamSection(const CBeamSection* pBeamSection)
    {
    	Copy(pBeamSection);
    }
    CBeamSection::~CBeamSection(void)
    {
    }
    
    void CBeamSection::Copy(const CSection* pSection)
    {
      if (this == pSection) return;
    	Import(pSection);
    	CSection::Copy(pSection);
    }
    
    BOOL CBeamSection::Compare(const CSection* pSection) const
    {
    	_ASSERTE_RT_BL(pSection);
    	if(!CSection::Compare(pSection))		return FALSE;
    	const CBeamSection* pBeamSection = dynamic_cast<const CBeamSection*>(pSection);
    	_ASSERTE_RT_BL(pBeamSection);
    
    	if(m_enType != pBeamSection->m_enType)	return FALSE;
    	if(m_enSectionType != pBeamSection->m_enSectionType)	return FALSE;
    	if(!Equal2Dbl(m_dGrade, pBeamSection->m_dGrade))	return FALSE;
    	if(!Equal2Dbl(m_dH, pBeamSection->m_dH))	return FALSE;
    
    	return TRUE;
    }
    
    BOOL CBeamSection::Import(const CSection* pSection)
    {
    	const CBeamSection* pBeamSection = dynamic_cast<const CBeamSection*>(pSection);
    	_ASSERTE_RT_BL(pBeamSection);
    	m_enType       = pBeamSection->m_enType;
    	m_bSingleSlope = pBeamSection->m_bSingleSlope;
    	m_dGrade       = pBeamSection->m_dGrade;
    	m_dH           = pBeamSection->m_dH;
    	return TRUE;
    }
    
    void CBeamSection::Serialize(CArchive& ar)
    {
    	CSection::Serialize(ar);
    
    	if(ar.IsStoring())
    	{
    		_PRESAVE(_T("CBeamSection"))
    		{
    			_BEGINESAVE(DATABASE_VERSION1)
    			ar<< m_bSingleSlope;
    			ar<< m_dGrade;
    			ar<< m_dH;   
    			MBasic::Serialize(ar,m_enType);
    			_ENDSAVE
    		}
    		_POSTSAVE
    	}
    	else
    	{
    		_PREOPEN(_T("CBeamSection"))
    		{
    		  case DATABASE_VERSION1:	
    			  ar>> m_bSingleSlope;
    			  ar>> m_dGrade;
    			  ar>> m_dH;
    			  MBasic::Serialize(ar,m_enType);
    			  break;
    		}
    		_POSTOPEN
    	}
    }
    _MB_DATABASE_END




  • 相关阅读:
    硬盘分区、格式化及文件系统的管理一
    系统监控
    系统的初始化和服务
    正文处理命令及tar命令
    Salesforce: getContentAsPDF()在lightning mode下报错
    Salesforce: 无法在trigger中取到Country或State的更新
    Salesforce: Safe Navigation Operator
    Salesforce: INVALID_QUERY_LOCATOR简析
    Salesforce: Trigger使用注意事项
    Salesforce: 设置用户默认访问Lightning Mode
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/3766321.html
Copyright © 2020-2023  润新知