[svn] commit: r876 - in /branches/each-ds/src/lib/dns/cpp: message.cc rrset.cc rrset.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Feb 19 03:50:19 UTC 2010
Author: each
Date: Fri Feb 19 03:50:19 2010
New Revision: 876
Log:
RRset->rrsig_ is now another RRset instead of a BasicRRset; this
allows us to avoid an unnecessary copy/cast when copying rdata into
a message.
Modified:
branches/each-ds/src/lib/dns/cpp/message.cc
branches/each-ds/src/lib/dns/cpp/rrset.cc
branches/each-ds/src/lib/dns/cpp/rrset.h
Modified: branches/each-ds/src/lib/dns/cpp/message.cc
==============================================================================
--- branches/each-ds/src/lib/dns/cpp/message.cc (original)
+++ branches/each-ds/src/lib/dns/cpp/message.cc Fri Feb 19 03:50:19 2010
@@ -271,10 +271,9 @@
impl_->rrsets_[sectionCodeToId(section)].push_back(rrset);
impl_->counts_[section.getCode()] += rrset->getRdataCount();
- BasicRRsetPtr sp = rrset->getRRsig();
+ RRsetPtr sp = rrset->getRRsig();
if (sign && sp) {
- RRset* sigs = new RRset(*sp);
- impl_->rrsets_[sectionCodeToId(section)].push_back(RRsetPtr(sigs));
+ impl_->rrsets_[sectionCodeToId(section)].push_back(sp);
impl_->counts_[section.getCode()] += sp->getRdataCount();
}
}
Modified: branches/each-ds/src/lib/dns/cpp/rrset.cc
==============================================================================
--- branches/each-ds/src/lib/dns/cpp/rrset.cc (original)
+++ branches/each-ds/src/lib/dns/cpp/rrset.cc Fri Feb 19 03:50:19 2010
@@ -189,7 +189,7 @@
const RRType& rrtype, const RRTTL& ttl) :
BasicRRset(name, rrclass, rrtype, ttl)
{
- rrsig_ = BasicRRsetPtr();
+ rrsig_ = RRsetPtr();
}
RRset::~RRset() {}
Modified: branches/each-ds/src/lib/dns/cpp/rrset.h
==============================================================================
--- branches/each-ds/src/lib/dns/cpp/rrset.h (original)
+++ branches/each-ds/src/lib/dns/cpp/rrset.h Fri Feb 19 03:50:19 2010
@@ -41,7 +41,6 @@
class RRset;
class BasicRRset;
typedef boost::shared_ptr<RRset> RRsetPtr;
-typedef boost::shared_ptr<BasicRRset> BasicRRsetPtr;
class BasicRRsetImpl;
class RdataIterator;
@@ -172,30 +171,38 @@
};
class RRset : public BasicRRset {
-private:
- typedef boost::shared_ptr<BasicRRset> BasicRRsetPtr;
-public:
- RRset(const BasicRRset& source) : BasicRRset(source) {};
+public:
explicit RRset(const Name& name, const RRClass& rrclass,
const RRType& rrtype, const RRTTL& ttl);
virtual ~RRset();
+ virtual void addRRsig(const rdata::RdataPtr rdata) {
+ if (!rrsig_) {
+ rrsig_ = RRsetPtr(new RRset(this->getName(), this->getClass(),
+ RRType::RRSIG(), this->getTTL()));
+ }
+ rrsig_->addRdata(rdata);
+ }
+
void addRRsig(AbstractRRset& sigs) {
RdataIteratorPtr it = sigs.getRdataIterator();
- rrsig_ = BasicRRsetPtr(new BasicRRset(this->getName(), this->getClass(),
- RRType::RRSIG(), this->getTTL()));
+ if (!rrsig_) {
+ rrsig_ = RRsetPtr(new RRset(this->getName(), this->getClass(),
+ RRType::RRSIG(), this->getTTL()));
+ }
+
for (it->first(); !it->isLast(); it->next()) {
rrsig_->addRdata(it->getCurrent());
}
}
void addRRsig(RRsetPtr sigs) { addRRsig(*sigs); }
- void removeRRsig() { rrsig_ = BasicRRsetPtr(); }
- BasicRRsetPtr getRRsig() { return (rrsig_); }
+ void removeRRsig() { rrsig_ = RRsetPtr(); }
+ RRsetPtr getRRsig() { return (rrsig_); }
private:
- BasicRRsetPtr rrsig_;
+ RRsetPtr rrsig_;
};
std::ostream& operator<<(std::ostream& os, const AbstractRRset& rrset);
More information about the bind10-changes
mailing list