msiodelski

3171 patch

Oct 3rd, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.22 KB | None | 0 0
  1. From 7e89ade1bc38c6510e245de164bf9b76c37f54b8 Mon Sep 17 00:00:00 2001
  2. From: Marcin Siodelski <[email protected]>
  3. Date: Thu, 3 Oct 2013 12:02:34 +0200
  4. Subject: [PATCH] [3171] non-const variant of getPools is renamed and made
  5.  private.
  6.  
  7. ---
  8. src/lib/dhcpsrv/subnet.cc |  6 +++---
  9.  src/lib/dhcpsrv/subnet.h  | 11 +++++++++--
  10.  2 files changed, 12 insertions(+), 5 deletions(-)
  11.  
  12. diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc
  13. index 8e51906..4320733 100644
  14. --- a/src/lib/dhcpsrv/subnet.cc
  15. +++ b/src/lib/dhcpsrv/subnet.cc
  16. @@ -169,7 +169,7 @@ const PoolCollection& Subnet::getPools(Lease::Type type) const {
  17.      }
  18.  }
  19.  
  20. -PoolCollection& Subnet::getPools(Lease::Type type) {
  21. +PoolCollection& Subnet::getPoolsWritable(Lease::Type type) {
  22.      // check if the type is valid (and throw if it isn't)
  23.      checkType(type);
  24.  
  25. @@ -230,12 +230,12 @@ Subnet::addPool(const PoolPtr& pool) {
  26.      checkType(pool->getType());
  27.  
  28.      // Add the pool to the appropriate pools collection
  29. -    getPools(pool->getType()).push_back(pool);
  30. +    getPoolsWritable(pool->getType()).push_back(pool);
  31.  }
  32.  
  33.  void
  34.  Subnet::delPools(Lease::Type type) {
  35. -    getPools(type).clear();
  36. +    getPoolsWritable(type).clear();
  37.  }
  38.  
  39.  void
  40. diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h
  41. index 2354834..664ae4e 100644
  42. --- a/src/lib/dhcpsrv/subnet.h
  43. +++ b/src/lib/dhcpsrv/subnet.h
  44. @@ -319,13 +319,20 @@ public:
  45.      /// @return a collection of all pools
  46.      const PoolCollection& getPools(Lease::Type type) const;
  47.  
  48. -    /// @brief Returns all pools (variable variant)
  49. +private:
  50. +
  51. +    /// @brief Returns all pools (non-const variant)
  52.      ///
  53.      /// The reference is only valid as long as the object that returned it.
  54. +    /// The reference returned can be used to modify pools stored in the
  55. +    /// collection. This method is meant to be called internally from the
  56. +    /// @c Subnet class.
  57.      ///
  58.      /// @param type lease type to be set
  59.      /// @return a collection of all pools
  60. -    PoolCollection& getPools(Lease::Type type);
  61. +    PoolCollection& getPoolsWritable(Lease::Type type);
  62. +
  63. +public:
  64.  
  65.      /// @brief Sets name of the network interface for directly attached networks
  66.      ///
  67. --
  68. 1.8.1.2
Advertisement
Add Comment
Please, Sign In to add comment