Browse Source

[2206] Add ZoneTableHeader::getTable() method

Mukund Sivaraman 12 years ago
parent
commit
d25bb8d27c

+ 12 - 0
src/lib/datasrc/memory/zone_table_segment.h

@@ -34,6 +34,18 @@ namespace memory {
 /// implementation. It contains an offset pointer to the zone table (a
 /// implementation. It contains an offset pointer to the zone table (a
 /// map from domain names to zone locators) in memory.
 /// map from domain names to zone locators) in memory.
 struct ZoneTableHeader {
 struct ZoneTableHeader {
+public:
+    /// \brief Returns a pointer to the underlying zone table.
+    ZoneTable* getTable() {
+        return (table.get());
+    }
+
+    /// \brief const version of getTable().
+    const ZoneTable* getTable() const {
+        return (getTable());
+    }
+
+private:
     boost::interprocess::offset_ptr<ZoneTable> table;
     boost::interprocess::offset_ptr<ZoneTable> table;
 };
 };
 
 

+ 1 - 1
src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc

@@ -40,7 +40,7 @@ TEST(ZoneTableSegment, getHeader) {
     EXPECT_NE(static_cast<void*>(NULL), header);
     EXPECT_NE(static_cast<void*>(NULL), header);
 
 
     // The zone table is unset.
     // The zone table is unset.
-    ZoneTable* table = header->table.get();
+    ZoneTable* table = header->getTable();
     EXPECT_EQ(static_cast<void*>(NULL), table);
     EXPECT_EQ(static_cast<void*>(NULL), table);
 }
 }