BIND 10 trac1604b, updated. b9aed5e8c47dd0e44981e6a7c40b5b3c8e403e53 [1604b] Convert arguments to addRRsig to "const Xxx&"

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Feb 2 17:54:21 UTC 2012


The branch, trac1604b has been updated
       via  b9aed5e8c47dd0e44981e6a7c40b5b3c8e403e53 (commit)
       via  f5a196c2aaa02ab50f8bb50f9e23cdff7e945559 (commit)
      from  6afe3a0422647e7e6973857bed9c657366f10674 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b9aed5e8c47dd0e44981e6a7c40b5b3c8e403e53
Author: Stephen Morris <stephen at isc.org>
Date:   Thu Feb 2 17:34:36 2012 +0000

    [1604b] Convert arguments to addRRsig to "const Xxx&"
    
    addRRsig does not change its arguments, so there is no reason why
    they cannont be declared "const Xxxx&", thereby saving the overhead
    of a copy when the method is called.

commit f5a196c2aaa02ab50f8bb50f9e23cdff7e945559
Author: Stephen Morris <stephen at isc.org>
Date:   Thu Feb 2 16:11:07 2012 +0000

    [1604b] BasicRRset::getRRsig() now returns empty RRset
    
    ... instead of throwing an exception.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/rrset.h |   87 ++++++++++++---------------------------------------
 1 files changed, 20 insertions(+), 67 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rrset.h b/src/lib/dns/rrset.h
index 601355b..e43c1f0 100644
--- a/src/lib/dns/rrset.h
+++ b/src/lib/dns/rrset.h
@@ -426,7 +426,7 @@ public:
     /// RRset.  If one does not exist, it is created using the data given.
     ///
     /// \param rdata Pointer to RRSIG rdata to be added.
-    virtual void addRRsig(const rdata::ConstRdataPtr rdata) = 0;
+    virtual void addRRsig(const rdata::ConstRdataPtr& rdata) = 0;
 
     /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
     ///
@@ -437,7 +437,7 @@ public:
     /// conversion from shared_ptr<X> to shared_ptr<const X>.)
     ///
     /// \param rdata Pointer to RRSIG rdata to be added.
-    virtual void addRRsig(const rdata::RdataPtr rdata) = 0;
+    virtual void addRRsig(const rdata::RdataPtr& rdata) = 0;
 
     /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
     ///
@@ -457,7 +457,7 @@ public:
     ///
     /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
     ///             to the RRSIG RRset associated with this class.
-    virtual void addRRsig(ConstRRsetPtr sigs) = 0;
+    virtual void addRRsig(const ConstRRsetPtr& sigs) = 0;
 
     /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
     ///
@@ -470,7 +470,7 @@ public:
     ///
     /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
     ///             to the RRSIG RRset associated with this class.
-    virtual void addRRsig(RRsetPtr sigs) = 0;
+    virtual void addRRsig(const RRsetPtr& sigs) = 0;
 
     /// \brief Clear the RRSIGs for this RRset
     virtual void removeRRsig() = 0;
@@ -740,94 +740,47 @@ public:
     ///
     /// \name Associated RRSIG methods
     ///
-    /// The associated RRSIG RRset is not supported in BasicRRset, so these
-    /// methods throw a NotImplemented exception.
+    /// The associated RRSIG RRset is not supported in BasicRRset.  For
+    /// ease of use, getRRsig() returns a null pointer (indicating no RRset).
+    /// The addRRsig()/removeRRsig() methods throw a "NotImplemented"
+    /// exception - if you are using a BasicRRset, you should not be trying
+    /// to modify signatures on it.
     //@{
     /// \brief Return pointer to this RRset's RRSIG RRset
     ///
     /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
     ///            not supported in this class.
     ///
-    /// \return Never returns normally - always throws a NotImplemented
-    ///         exception.
+    /// \return Null pointer, as this class does not support RRSIG records.
     virtual RRsetPtr getRRsig() const {
-        isc_throw(NotImplemented,
-                  "BasicRRset does not implement the getRRsig() method");
+        return (RRsetPtr());
     }
 
-    /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
-    ///
-    /// Not implemented in this class.
-    ///
-    /// \param rdata RRSIG rdata to be added to this RRset
-    ///
-    /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
-    ///            not supported in this class.
-    virtual void addRRsig(const rdata::ConstRdataPtr) {
+    virtual void addRRsig(const rdata::ConstRdataPtr&) {
         isc_throw(NotImplemented,
                   "BasicRRset does not implement the addRRsig() method");
     }
 
-    /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
-    ///
-    /// Not implemented in this class.
-    /// (This overload is for an older version of boost that doesn't support
-    /// conversion from shared_ptr<X> to shared_ptr<const X>.)
-    ///
-    /// \param rdata RRSIG rdata to be added to this RRset
-    ///
-    /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
-    ///            not supported in this class.
-    virtual void addRRsig(const rdata::RdataPtr) {
+    virtual void addRRsig(const rdata::RdataPtr&) {
         isc_throw(NotImplemented,
                   "BasicRRset does not implement the addRRsig() method");
     }
 
-    /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
-    ///
-    /// Not implemented in this class.
-    ///
-    /// \param sigs RRSIG RRset containing signatures to be added to the
-    ///             RRSIG RRset associated with this class.
-    ///
-    /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
-    ///            not supported in this class.
     virtual void addRRsig(const AbstractRRset&) {
         isc_throw(NotImplemented,
                   "BasicRRset does not implement the addRRsig() method");
     }
 
-    /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
-    ///
-    /// Not implemented in this class.
-    ///
-    /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
-    ///             to the RRSIG RRset associated with this class.
-    ///
-    /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
-    ///            not supported in this class.
-    virtual void addRRsig(ConstRRsetPtr) {
+    virtual void addRRsig(const ConstRRsetPtr&) {
         isc_throw(NotImplemented,
                   "BasicRRset does not implement the addRRsig() method");
     }
 
-    /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
-    ///
-    /// Not implemented in this class.
-    /// (This overload is for an older version of boost that doesn't support
-    /// conversion from shared_ptr<X> to shared_ptr<const X>.)
-    ///
-    /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
-    ///             to the RRSIG RRset associated with this class.
-    ///
-    /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
-    ///            not supported in this class.
-    virtual void addRRsig(RRsetPtr) {
+    virtual void addRRsig(const RRsetPtr&) {
         isc_throw(NotImplemented,
                   "BasicRRset does not implement the addRRsig() method");
     }
 
-    /// \brief Clear the RRSIGs for this RRset
     virtual void removeRRsig() {
         isc_throw(NotImplemented,
                   "BasicRRset does not implement the removeRRsig() method");
@@ -866,7 +819,7 @@ public:
     }
 
     /// \brief Adds an RRSIG RR to this RRset's signatures
-    virtual void addRRsig(const rdata::ConstRdataPtr rdata) {
+    virtual void addRRsig(const rdata::ConstRdataPtr& rdata) {
         if (!rrsig_) {
             rrsig_ = RRsetPtr(new RRset(getName(), getClass(),
                                         RRType::RRSIG(), getTTL()));
@@ -878,8 +831,8 @@ public:
     // conversion from shared_ptr<X> to shared_ptr<const X>.  Note: we should
     // revisit the interface of managing RRset signatures, at which point this
     // problem may go away.
-    virtual void addRRsig(const rdata::RdataPtr rdata) {
-        addRRsig(static_cast<rdata::ConstRdataPtr>(rdata));
+    virtual void addRRsig(const rdata::RdataPtr& rdata) {
+        addRRsig(static_cast<const rdata::ConstRdataPtr&>(rdata));
     }
 
     /// \brief Adds an RRSIG RRset to this RRset
@@ -896,10 +849,10 @@ public:
         }
     }
 
-    virtual void addRRsig(ConstRRsetPtr sigs) { addRRsig(*sigs); }
+    virtual void addRRsig(const ConstRRsetPtr& sigs) { addRRsig(*sigs); }
 
     // Another workaround for older boost (see above)
-    virtual void addRRsig(RRsetPtr sigs) { addRRsig(*sigs); }
+    virtual void addRRsig(const RRsetPtr& sigs) { addRRsig(*sigs); }
 
     /// \brief Clear the RRSIGs for this RRset
     virtual void removeRRsig() { rrsig_ = RRsetPtr(); }




More information about the bind10-changes mailing list