Browse Source

[2138] changed the return type of getStatistics to const pointer.

so we can consistently use const versions.
JINMEI Tatuya 12 years ago
parent
commit
caa70d6b85
4 changed files with 8 additions and 10 deletions
  1. 1 1
      src/bin/auth/auth_srv.cc
  2. 1 1
      src/bin/auth/auth_srv.h
  3. 5 7
      src/bin/auth/statistics.cc
  4. 1 1
      src/bin/auth/statistics.h

+ 1 - 1
src/bin/auth/auth_srv.cc

@@ -846,7 +846,7 @@ AuthSrv::updateConfig(ConstElementPtr new_config) {
     }
 }
 
-ElementPtr AuthSrv::getStatistics() const {
+ConstElementPtr AuthSrv::getStatistics() const {
     return (impl_->counters_.getStatistics());
 }
 

+ 1 - 1
src/bin/auth/auth_srv.h

@@ -208,7 +208,7 @@ public:
     /// AuthCounters::getStatistics().
     ///
     /// \return JSON format statistics data.
-    isc::data::ElementPtr getStatistics() const;
+    isc::data::ConstElementPtr getStatistics() const;
 
     /// \brief Get the value of counter in the AuthCounters.
     ///

+ 5 - 7
src/bin/auth/statistics.cc

@@ -55,7 +55,7 @@ public:
     }
     void inc(const std::string& zone,
              const AuthCounters::PerZoneCounterType type);
-    isc::data::ElementPtr getStatistics() const;
+    isc::data::ConstElementPtr getStatistics() const;
     void registerStatisticsValidator
     (AuthCounters::validator_type validator);
     // Currently for testing purpose only
@@ -102,7 +102,7 @@ AuthCountersImpl::inc(const std::string& zone,
     per_zone_counter_[zone].inc(type);
 }
 
-isc::data::ElementPtr
+isc::data::ConstElementPtr
 AuthCountersImpl::getStatistics() const {
     std::stringstream statistics_string;
     statistics_string << "{ \"queries.udp\": "
@@ -137,13 +137,11 @@ AuthCountersImpl::getStatistics() const {
     }
     statistics_string << "}";
 
-    isc::data::ElementPtr statistics_element =
+    isc::data::ConstElementPtr statistics_element =
         isc::data::Element::fromJSON(statistics_string);
     // validate the statistics data before send
     if (validator_) {
-        if (!validator_(
-                 static_cast<isc::data::ConstElementPtr>(statistics_element)))
-        {
+        if (!validator_(statistics_element)) {
             LOG_ERROR(auth_logger, AUTH_INVALID_STATISTICS_DATA);
             return (isc::data::ElementPtr());
         }
@@ -184,7 +182,7 @@ AuthCounters::inc(const Rcode rcode) {
     impl_->inc(rcode);
 }
 
-isc::data::ElementPtr
+isc::data::ConstElementPtr
 AuthCounters::getStatistics() const {
     return (impl_->getStatistics());
 }

+ 1 - 1
src/bin/auth/statistics.h

@@ -114,7 +114,7 @@ public:
     ///
     /// \return statistics data
     ///
-    isc::data::ElementPtr getStatistics() const;
+    isc::data::ConstElementPtr getStatistics() const;
 
     /// \brief Get the value of a counter in the AuthCounters.
     ///