1: // $Id: rrt.i,v 1.2 2001/10/31 16:44:03 jdw Exp $
2:
3:
4: /**********************
5: * *
6: * COMPILER INCLUDES *
7: * *
8: **********************/
9:
10:
11: #include <cassert>
12:
13:
14: /*********************
15: * *
16: * PROJECT INCLUDES *
17: * *
18: *********************/
19:
20:
21: #include "am.h"
22: #include "dnsutil.h"
23: #include "mindlog.h"
24:
25:
26: /*******************
27: * *
28: * RR CONSTRUCTOR *
29: * *
30: *******************/
31:
32:
33: template <class H>
34: RRT<H>::RRT() {
35: AMCTOR(RRT<H>);
36: m_ty = (RRType)0;
37: m_cl = (RRClass)0;
38: }
39:
40:
41: /****************
42: * *
43: * GET METHODS *
44: * *
45: ****************/
46:
47:
48: template <class H> inline RRClass RRT<H>::GetClass() const { return m_cl; }
49: template <class H> inline RDataConstPtr RRT<H>::GetRData() const { return m_rdp; }
50: template <class H> inline RRType RRT<H>::GetType() const { return m_ty; }
51:
52:
53: /****************
54: * *
55: * SET METHODS *
56: * *
57: ****************/
58:
59:
60: template <class H> inline void RRT<H>::SetClass(RRClass i_cl) { m_cl = i_cl; }
61: template <class H> inline void RRT<H>::SetRData(RDataPtr &i_rdpr) { m_rdp = i_rdpr; i_rdpr = NULL; }
62: template <class H> inline void RRT<H>::SetType(RRType i_ty) { m_ty = i_ty; }
63:
64:
65:
66: /*******************
67: * *
68: * METHOD COMPARE *
69: * *
70: *******************/
71:
72:
73: template <class H> template <class T> bool RRT<H>::Compare(const T ci_xrp) const {
74: if (this->GetType()!=ci_xrp->GetType()) return false;
75: if (this->GetClass()!=ci_xrp->GetClass()) return false;
76: return m_rdp->Compare(*(ci_xrp->GetRData()));
77: }
78:
79:
80: /***********************
81: * *
82: * METHOD ISTYPECLASS *
83: * *
84: ***********************/
85:
86:
87: template <class H> inline bool RRT<H>::IsTypeClass(RRType i_ty, RRClass i_cl) const {
88: if (MatchType(m_ty,i_ty)==false) return false;
89: if (MatchClass(m_cl,i_cl)==false) return false;
90: return true;
91: }
92:
93:
94: /******************
95: * *
96: * RR DESTRUCTOR *
97: * *
98: ******************/
99:
100:
101: template <class H> RRT<H>::~RRT() {
102: AMDTOR(RRT<H>);
103: SoftDelete(m_rdp);
104: }
105:
106:
107: /*************************
108: * *
109: * FUNCTIONS OPERATOR<< *
110: * *
111: *************************/
112:
113:
114: template <class H> ostream& operator<<(ostream& io_smr, const RRT<H> &ci_rrr) {
115: io_smr << &ci_rrr;
116: return io_smr;
117: }
118:
119:
120: template <class H> ostream& operator<<(ostream& io_smr, const RRT<H> *ci_rrp) {
121: io_smr << static_cast<const H*>(ci_rrp) << " "
122: << GetClassName(ci_rrp->GetClass()) << " "
123: << GetTypeName(ci_rrp->GetType()) << " ";
124: ci_rrp->GetRData()->Dump(io_smr);
125: return io_smr;
126: }
127:
128:
129: