BIND 10 trac2206, updated. 37fd8a72b131d5de9a6fbe612d3dc3d19bafdf83 [2206] Add comment about moving methods to the header later
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Oct 3 05:46:08 UTC 2012
The branch, trac2206 has been updated
via 37fd8a72b131d5de9a6fbe612d3dc3d19bafdf83 (commit)
via 1fb24f540ade83926d311316e77e1a6c8bef8432 (commit)
via c4c3946bad5bf1e9be0f375ac1029e1f95e94d94 (commit)
via 5c975417200358c916a62415caf51a1a73e0d470 (commit)
from 538a160ef48f7dbe927f75cafc335e470a82db33 (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 37fd8a72b131d5de9a6fbe612d3dc3d19bafdf83
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Oct 3 11:15:52 2012 +0530
[2206] Add comment about moving methods to the header later
commit 1fb24f540ade83926d311316e77e1a6c8bef8432
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Oct 3 11:11:02 2012 +0530
[2206] Change getHeader() to return a reference
commit c4c3946bad5bf1e9be0f375ac1029e1f95e94d94
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Oct 3 11:04:51 2012 +0530
[2206] Remove redundant return descriptions
commit 5c975417200358c916a62415caf51a1a73e0d470
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Oct 3 11:02:16 2012 +0530
[2206] Fix doc comment
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/zone_table_segment.h | 14 ++------------
src/lib/datasrc/memory/zone_table_segment_local.cc | 11 +++++++----
src/lib/datasrc/memory/zone_table_segment_local.h | 17 +++--------------
.../tests/memory/zone_table_segment_unittest.cc | 13 +++++--------
4 files changed, 17 insertions(+), 38 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_table_segment.h b/src/lib/datasrc/memory/zone_table_segment.h
index 10457f7..24aed3f 100644
--- a/src/lib/datasrc/memory/zone_table_segment.h
+++ b/src/lib/datasrc/memory/zone_table_segment.h
@@ -71,22 +71,12 @@ public:
virtual ~ZoneTableSegment() {}
/// \brief Return the ZoneTableHeader for the zone table segment.
- ///
- /// NOTE: This method should never return \c NULL.
- ///
- /// \return Returns the ZoneTableHeader for this zone table segment.
- virtual ZoneTableHeader* getHeader() = 0;
+ virtual ZoneTableHeader& getHeader() = 0;
/// \brief const version of \c getHeader().
- ///
- /// NOTE: This method should never return \c NULL.
- ///
- /// \return Returns the ZoneTableHeader for this zone table segment.
- virtual const ZoneTableHeader* getHeader() const = 0;
+ virtual const ZoneTableHeader& getHeader() const = 0;
/// \brief Return the MemorySegment for the zone table segment.
- ///
- /// \return Returns the ZoneTableHeader for this zone table segment.
virtual isc::util::MemorySegment& getMemorySegment() = 0;
/// \brief Create an instance depending on the memory segment model
diff --git a/src/lib/datasrc/memory/zone_table_segment_local.cc b/src/lib/datasrc/memory/zone_table_segment_local.cc
index 80f2606..589c9af 100644
--- a/src/lib/datasrc/memory/zone_table_segment_local.cc
+++ b/src/lib/datasrc/memory/zone_table_segment_local.cc
@@ -20,14 +20,17 @@ namespace isc {
namespace datasrc {
namespace memory {
-ZoneTableHeader*
+// After more methods' definitions are added here, it would be a good
+// idea to move getHeader() and getMemorySegment() definitions to the
+// header file.
+ZoneTableHeader&
ZoneTableSegmentLocal::getHeader() {
- return (&header_);
+ return (header_);
}
-const ZoneTableHeader*
+const ZoneTableHeader&
ZoneTableSegmentLocal::getHeader() const {
- return (&header_);
+ return (header_);
}
MemorySegment&
diff --git a/src/lib/datasrc/memory/zone_table_segment_local.h b/src/lib/datasrc/memory/zone_table_segment_local.h
index f0e147e..de776a9 100644
--- a/src/lib/datasrc/memory/zone_table_segment_local.h
+++ b/src/lib/datasrc/memory/zone_table_segment_local.h
@@ -45,24 +45,13 @@ public:
/// \brief Return the ZoneTableHeader for the local zone table
/// segment implementation.
- ///
- /// NOTE: This method will never return \c NULL.
- ///
- /// \return Returns the ZoneTableHeader for this zone table segment.
- virtual ZoneTableHeader* getHeader();
+ virtual ZoneTableHeader& getHeader();
/// \brief const version of \c getHeader().
- ///
- /// NOTE: This method will never return \c NULL.
- ///
- /// \return Returns the ZoneTableHeader for this zone table segment.
- virtual const ZoneTableHeader* getHeader() const;
+ virtual const ZoneTableHeader& getHeader() const;
/// \brief Return the MemorySegment for the local zone table segment
- /// implementation.
- ///
- /// \return Returns the MemorySegment for this zone table segment (a
- /// MemorySegmentLocal instance).
+ /// implementation (a MemorySegmentLocal instance).
virtual isc::util::MemorySegment& getMemorySegment();
private:
diff --git a/src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc b/src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc
index 3dead7a..e6a8a97 100644
--- a/src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc
@@ -55,23 +55,20 @@ TEST_F(ZoneTableSegmentTest, create) {
}
TEST_F(ZoneTableSegmentTest, getHeader) {
- // getHeader() should never return NULL.
- ZoneTableHeader* header = segment_->getHeader();
- EXPECT_NE(static_cast<void*>(NULL), header);
+ ZoneTableHeader& header = segment_->getHeader();
// The zone table is unset.
- ZoneTable* table = header->getTable();
+ ZoneTable* table = header.getTable();
EXPECT_EQ(static_cast<void*>(NULL), table);
}
TEST_F(ZoneTableSegmentTest, getHeaderConst) {
- // getHeader() should never return NULL.
- const ZoneTableHeader* header =
+ // Test const methods
+ const ZoneTableHeader& header =
static_cast<const ZoneTableSegment*>(segment_)->getHeader();
- EXPECT_NE(static_cast<void*>(NULL), header);
// The zone table is unset.
- const ZoneTable* table = header->getTable();
+ const ZoneTable* table = header.getTable();
EXPECT_EQ(static_cast<void*>(NULL), table);
}
More information about the bind10-changes
mailing list