**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