BIND 10 trac2432, updated. dd444334eb873bd925639e3141c3a863fad1e47a [2432] Remove RRsetCollection::find() that returns an AbstractRRset
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Jan 3 12:35:49 UTC 2013
The branch, trac2432 has been updated
via dd444334eb873bd925639e3141c3a863fad1e47a (commit)
via 5d3af5f896df69f42590921a44650745411673fa (commit)
from bbb8a8f0ed42862b7e5b54e7611cb0d0e364203b (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 dd444334eb873bd925639e3141c3a863fad1e47a
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Jan 3 18:04:56 2013 +0530
[2432] Remove RRsetCollection::find() that returns an AbstractRRset
Instead, make the one that returns ConstRRsetPtr virtual.
commit 5d3af5f896df69f42590921a44650745411673fa
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Jan 3 17:46:56 2013 +0530
[2432] Add some more API doc
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/rrset_collection.cc | 11 -------
src/lib/dns/rrset_collection.h | 23 +++++++-------
src/lib/dns/rrset_collection_base.h | 12 ++++----
src/lib/dns/tests/rrset_collection_unittest.cc | 38 +++---------------------
4 files changed, 21 insertions(+), 63 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/rrset_collection.cc b/src/lib/dns/rrset_collection.cc
index 0c804a7..f8cfbc3 100644
--- a/src/lib/dns/rrset_collection.cc
+++ b/src/lib/dns/rrset_collection.cc
@@ -74,17 +74,6 @@ RRsetCollection::RRsetCollection(std::istream& input_stream, const Name& origin,
constructHelper<std::istream&>(input_stream, origin, rrclass);
}
-const AbstractRRset*
-RRsetCollection::find(const Name& name, const RRType& rrtype,
- const RRClass& rrclass) const {
- const CollectionKey key(rrclass, rrtype, name);
- CollectionMap::const_iterator it = rrsets_.find(key);
- if (it != rrsets_.end()) {
- return (&(*it->second));
- }
- return (NULL);
-}
-
RRsetPtr
RRsetCollection::find(const Name& name, const RRClass& rrclass,
const RRType& rrtype) {
diff --git a/src/lib/dns/rrset_collection.h b/src/lib/dns/rrset_collection.h
index bc1d185..49dc820 100644
--- a/src/lib/dns/rrset_collection.h
+++ b/src/lib/dns/rrset_collection.h
@@ -97,26 +97,25 @@ public:
/// \brief Find a matching RRset in the collection.
///
/// Returns the RRset in the collection that exactly matches the
- /// given \c name and \c rrtype. If no matching RRset is found,
- /// \c NULL is returned.
+ /// given \c name, \c rrclass and \c rrtype. If no matching RRset
+ /// is found, \c NULL is returned.
///
/// \param name The name of the RRset to search for.
- /// \param rrtype The type of the RRset to search for.
/// \param rrclass The class of the RRset to search for.
- /// \returns A pointer to the RRset if found, \c NULL otherwise.
- virtual const isc::dns::AbstractRRset* find
- (const isc::dns::Name& name, const isc::dns::RRType& rrtype,
- const isc::dns::RRClass& rrclass)
- const;
+ /// \param rrtype The type of the RRset to search for.
+ /// \returns The RRset if found, \c NULL otherwise.
+ virtual isc::dns::ConstRRsetPtr find(const isc::dns::Name& name,
+ const isc::dns::RRClass& rrclass,
+ const isc::dns::RRType& rrtype) const;
+ /// \brief Find a matching RRset in the collection (non-const
+ /// variant).
+ ///
+ /// See above for a description of the method and arguments.
isc::dns::RRsetPtr find(const isc::dns::Name& name,
const isc::dns::RRClass& rrclass,
const isc::dns::RRType& rrtype);
- isc::dns::ConstRRsetPtr find(const isc::dns::Name& name,
- const isc::dns::RRClass& rrclass,
- const isc::dns::RRType& rrtype) const;
-
private:
template<typename T>
void constructHelper(T source, const isc::dns::Name& origin,
diff --git a/src/lib/dns/rrset_collection_base.h b/src/lib/dns/rrset_collection_base.h
index 20849cc..38dc76c 100644
--- a/src/lib/dns/rrset_collection_base.h
+++ b/src/lib/dns/rrset_collection_base.h
@@ -41,16 +41,16 @@ public:
/// \brief Find a matching RRset in the collection.
///
/// Returns the RRset in the collection that exactly matches the
- /// given \c name and \c rrtype. If no matching RRset is found,
- /// \c NULL is returned.
+ /// given \c name, \c rrclass and \c rrtype. If no matching RRset
+ /// is found, \c NULL is returned.
///
/// \param name The name of the RRset to search for.
/// \param rrtype The type of the RRset to search for.
/// \param rrclass The class of the RRset to search for.
- /// \returns A pointer to the RRset if found, \c NULL otherwise.
- virtual const isc::dns::AbstractRRset* find
- (const isc::dns::Name& name, const isc::dns::RRType& rrtype,
- const isc::dns::RRClass& rrclass)
+ /// \returns The RRset if found, \c NULL otherwise.
+ virtual isc::dns::ConstRRsetPtr find
+ (const isc::dns::Name& name, const isc::dns::RRClass& rrclass,
+ const isc::dns::RRType& rrtype)
const = 0;
/// \brief Destructor
diff --git a/src/lib/dns/tests/rrset_collection_unittest.cc b/src/lib/dns/tests/rrset_collection_unittest.cc
index 5c0caed..183ec51 100644
--- a/src/lib/dns/tests/rrset_collection_unittest.cc
+++ b/src/lib/dns/tests/rrset_collection_unittest.cc
@@ -55,34 +55,6 @@ TEST_F(RRsetCollectionTest, istreamConstructor) {
EXPECT_TRUE(iter2 == collection2.end());
}
-TEST_F(RRsetCollectionTest, findBase) {
- // Test the find() that returns isc::dns::AbstractRRset*
- const AbstractRRset* rrset = collection.find(Name("www.example.org"),
- RRType::A(), rrclass);
- EXPECT_NE(static_cast<AbstractRRset*>(NULL), rrset);
- EXPECT_EQ(RRType::A(), rrset->getType());
- EXPECT_EQ(RRTTL(3600), rrset->getTTL());
- EXPECT_EQ(RRClass("IN"), rrset->getClass());
- EXPECT_EQ(Name("www.example.org"), rrset->getName());
-
- // foo.example.org doesn't exist
- rrset = collection.find(Name("foo.example.org"), RRType::A(), rrclass);
- EXPECT_EQ(static_cast<AbstractRRset*>(NULL), rrset);
-
- // www.example.org exists, but not with MX
- rrset = collection.find(Name("www.example.org"), RRType::MX(), rrclass);
- EXPECT_EQ(static_cast<AbstractRRset*>(NULL), rrset);
-
- // www.example.org exists, with AAAA
- rrset = collection.find(Name("www.example.org"), RRType::AAAA(), rrclass);
- EXPECT_NE(static_cast<AbstractRRset*>(NULL), rrset);
-
- // www.example.org with AAAA does not exist in RRClass::CH()
- rrset = collection.find(Name("www.example.org"), RRType::AAAA(),
- RRClass::CH());
- EXPECT_EQ(static_cast<AbstractRRset*>(NULL), rrset);
-}
-
template <typename T, typename TP>
void doFind(T& collection, const RRClass& rrclass) {
// Test the find() that returns ConstRRsetPtr
@@ -211,12 +183,10 @@ public:
MyRRsetCollection()
{}
- virtual const isc::dns::AbstractRRset* find
- (const isc::dns::Name&, const isc::dns::RRType&,
- const isc::dns::RRClass&)
- const
- {
- return (NULL);
+ virtual isc::dns::ConstRRsetPtr find(const isc::dns::Name&,
+ const isc::dns::RRClass&,
+ const isc::dns::RRType&) const {
+ return (ConstRRsetPtr());
}
typedef std::list<isc::dns::RRset> MyCollection;
More information about the bind10-changes
mailing list