#include <cassert>
#include "am.h"
#include "dnsutil.h"
#include "mindlog.h"
template <class H>
RRT<H>::RRT() {
AMCTOR(RRT<H>);
m_ty = (RRType)0;
m_cl = (RRClass)0;
}
template <class H> inline RRClass RRT<H>::GetClass() const { return m_cl; }
template <class H> inline RDataConstPtr RRT<H>::GetRData() const { return m_rdp; }
template <class H> inline RRType RRT<H>::GetType() const { return m_ty; }
template <class H> inline void RRT<H>::SetClass(RRClass i_cl) { m_cl = i_cl; }
template <class H> inline void RRT<H>::SetRData(RDataPtr &i_rdpr) { m_rdp = i_rdpr; i_rdpr = NULL; }
template <class H> inline void RRT<H>::SetType(RRType i_ty) { m_ty = i_ty; }
template <class H> template <class T> bool RRT<H>::Compare(const T ci_xrp) const {
if (this->GetType()!=ci_xrp->GetType()) return false;
if (this->GetClass()!=ci_xrp->GetClass()) return false;
return m_rdp->Compare(*(ci_xrp->GetRData()));
}
template <class H> inline bool RRT<H>::IsTypeClass(RRType i_ty, RRClass i_cl) const {
if (MatchType(m_ty,i_ty)==false) return false;
if (MatchClass(m_cl,i_cl)==false) return false;
return true;
}
template <class H> RRT<H>::~RRT() {
AMDTOR(RRT<H>);
SoftDelete(m_rdp);
}
template <class H> ostream& operator<<(ostream& io_smr, const RRT<H> &ci_rrr) {
io_smr << &ci_rrr;
return io_smr;
}
template <class H> ostream& operator<<(ostream& io_smr, const RRT<H> *ci_rrp) {
io_smr << static_cast<const H*>(ci_rrp) << " "
<< GetClassName(ci_rrp->GetClass()) << " "
<< GetTypeName(ci_rrp->GetType()) << " ";
ci_rrp->GetRData()->Dump(io_smr);
return io_smr;
}