]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2850] Constify getNamedAddress()
authorMukund Sivaraman <muks@isc.org>
Mon, 6 May 2013 06:07:14 +0000 (11:37 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 6 May 2013 06:07:14 +0000 (11:37 +0530)
src/lib/util/memory_segment.h
src/lib/util/memory_segment_local.cc
src/lib/util/memory_segment_local.h
src/lib/util/memory_segment_mapped.cc
src/lib/util/memory_segment_mapped.h

index e83c3e0c262fa8c0173afbc5837ff18ac2ad5247..f94372a7cd43606639e9ecb8eca9c44ddc0f35c8 100644 (file)
@@ -254,7 +254,7 @@ public:
     /// \return An std::pair containing a bool (set to true if the name
     /// was found, or false otherwise) and the address associated with
     /// the name (which is undefined if the name was not found).
-    NamedAddressResult getNamedAddress(const char* name) {
+    NamedAddressResult getNamedAddress(const char* name) const {
         // This public method implements common validation.  The actual
         // work specific to the derived segment is delegated to the
         // corresponding protected method.
@@ -296,7 +296,7 @@ protected:
     virtual bool setNamedAddressImpl(const char* name, void* addr) = 0;
 
     /// \brief Implementation of getNamedAddress beyond common validation.
-    virtual NamedAddressResult getNamedAddressImpl(const char* name) = 0;
+    virtual NamedAddressResult getNamedAddressImpl(const char* name) const = 0;
 
     /// \brief Implementation of clearNamedAddress beyond common validation.
     virtual bool clearNamedAddressImpl(const char* name) = 0;
index e68db2792bcaec9ca4b51945100e13a8123b3af3..b81fe5e915f10004e8c4dab1e191618cb023a8b6 100644 (file)
@@ -52,8 +52,9 @@ MemorySegmentLocal::allMemoryDeallocated() const {
 }
 
 MemorySegment::NamedAddressResult
-MemorySegmentLocal::getNamedAddressImpl(const char* name) {
-    std::map<std::string, void*>::iterator found = named_addrs_.find(name);
+MemorySegmentLocal::getNamedAddressImpl(const char* name) const {
+    std::map<std::string, void*>::const_iterator found =
+        named_addrs_.find(name);
     if (found != named_addrs_.end()) {
         return (NamedAddressResult(true, found->second));
     }
index 90d4907c056febf4d8ba4aebb02e5deaeff64076..de7249e448709caeee6156f32085e37f0aa09fa2 100644 (file)
@@ -70,7 +70,7 @@ public:
     ///
     /// There's a small chance this method could throw std::bad_alloc.
     /// It should be considered a fatal error.
-    virtual NamedAddressResult getNamedAddressImpl(const char* name);
+    virtual NamedAddressResult getNamedAddressImpl(const char* name) const;
 
     /// \brief Local segment version of setNamedAddress.
     ///
index ca9c9c6cee8fefb594c0060c79794f7ffce467c6..f53306b3536aadc136e1c2e52a6106ea8d06d5b8 100644 (file)
@@ -280,7 +280,7 @@ MemorySegmentMapped::allMemoryDeallocated() const {
 }
 
 MemorySegment::NamedAddressResult
-MemorySegmentMapped::getNamedAddressImpl(const char* name) {
+MemorySegmentMapped::getNamedAddressImpl(const char* name) const {
     offset_ptr<void>* storage =
         impl_->base_sgmt_->find<offset_ptr<void> >(name).first;
     if (storage) {
index 679821069da239bbf834cd97280f40d35575de14..492cf866f111b7532457a39e527ba75a2b18e954 100644 (file)
@@ -195,7 +195,7 @@ public:
     /// \brief Mapped segment version of getNamedAddress.
     ///
     /// This version never throws.
-    virtual NamedAddressResult getNamedAddressImpl(const char* name);
+    virtual NamedAddressResult getNamedAddressImpl(const char* name) const;
 
     /// \brief Mapped segment version of clearNamedAddress.
     ///