mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 22:45:18 +00:00
[2206] Change getHeader() to return a reference
This commit is contained in:
@@ -71,14 +71,10 @@ public:
|
|||||||
virtual ~ZoneTableSegment() {}
|
virtual ~ZoneTableSegment() {}
|
||||||
|
|
||||||
/// \brief Return the ZoneTableHeader for the zone table segment.
|
/// \brief Return the ZoneTableHeader for the zone table segment.
|
||||||
///
|
virtual ZoneTableHeader& getHeader() = 0;
|
||||||
/// NOTE: This method should never return \c NULL.
|
|
||||||
virtual ZoneTableHeader* getHeader() = 0;
|
|
||||||
|
|
||||||
/// \brief const version of \c getHeader().
|
/// \brief const version of \c getHeader().
|
||||||
///
|
virtual const ZoneTableHeader& getHeader() const = 0;
|
||||||
/// NOTE: This method should never return \c NULL.
|
|
||||||
virtual const ZoneTableHeader* getHeader() const = 0;
|
|
||||||
|
|
||||||
/// \brief Return the MemorySegment for the zone table segment.
|
/// \brief Return the MemorySegment for the zone table segment.
|
||||||
virtual isc::util::MemorySegment& getMemorySegment() = 0;
|
virtual isc::util::MemorySegment& getMemorySegment() = 0;
|
||||||
|
@@ -20,14 +20,14 @@ namespace isc {
|
|||||||
namespace datasrc {
|
namespace datasrc {
|
||||||
namespace memory {
|
namespace memory {
|
||||||
|
|
||||||
ZoneTableHeader*
|
ZoneTableHeader&
|
||||||
ZoneTableSegmentLocal::getHeader() {
|
ZoneTableSegmentLocal::getHeader() {
|
||||||
return (&header_);
|
return (header_);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZoneTableHeader*
|
const ZoneTableHeader&
|
||||||
ZoneTableSegmentLocal::getHeader() const {
|
ZoneTableSegmentLocal::getHeader() const {
|
||||||
return (&header_);
|
return (header_);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemorySegment&
|
MemorySegment&
|
||||||
|
@@ -45,14 +45,10 @@ public:
|
|||||||
|
|
||||||
/// \brief Return the ZoneTableHeader for the local zone table
|
/// \brief Return the ZoneTableHeader for the local zone table
|
||||||
/// segment implementation.
|
/// segment implementation.
|
||||||
///
|
virtual ZoneTableHeader& getHeader();
|
||||||
/// NOTE: This method will never return \c NULL.
|
|
||||||
virtual ZoneTableHeader* getHeader();
|
|
||||||
|
|
||||||
/// \brief const version of \c getHeader().
|
/// \brief const version of \c getHeader().
|
||||||
///
|
virtual const ZoneTableHeader& getHeader() const;
|
||||||
/// NOTE: This method will never return \c NULL.
|
|
||||||
virtual const ZoneTableHeader* getHeader() const;
|
|
||||||
|
|
||||||
/// \brief Return the MemorySegment for the local zone table segment
|
/// \brief Return the MemorySegment for the local zone table segment
|
||||||
/// implementation (a MemorySegmentLocal instance).
|
/// implementation (a MemorySegmentLocal instance).
|
||||||
|
@@ -55,23 +55,20 @@ TEST_F(ZoneTableSegmentTest, create) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ZoneTableSegmentTest, getHeader) {
|
TEST_F(ZoneTableSegmentTest, getHeader) {
|
||||||
// getHeader() should never return NULL.
|
ZoneTableHeader& header = segment_->getHeader();
|
||||||
ZoneTableHeader* header = segment_->getHeader();
|
|
||||||
EXPECT_NE(static_cast<void*>(NULL), header);
|
|
||||||
|
|
||||||
// The zone table is unset.
|
// The zone table is unset.
|
||||||
ZoneTable* table = header->getTable();
|
ZoneTable* table = header.getTable();
|
||||||
EXPECT_EQ(static_cast<void*>(NULL), table);
|
EXPECT_EQ(static_cast<void*>(NULL), table);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ZoneTableSegmentTest, getHeaderConst) {
|
TEST_F(ZoneTableSegmentTest, getHeaderConst) {
|
||||||
// getHeader() should never return NULL.
|
// Test const methods
|
||||||
const ZoneTableHeader* header =
|
const ZoneTableHeader& header =
|
||||||
static_cast<const ZoneTableSegment*>(segment_)->getHeader();
|
static_cast<const ZoneTableSegment*>(segment_)->getHeader();
|
||||||
EXPECT_NE(static_cast<void*>(NULL), header);
|
|
||||||
|
|
||||||
// The zone table is unset.
|
// The zone table is unset.
|
||||||
const ZoneTable* table = header->getTable();
|
const ZoneTable* table = header.getTable();
|
||||||
EXPECT_EQ(static_cast<void*>(NULL), table);
|
EXPECT_EQ(static_cast<void*>(NULL), table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user