[asterisk-scf-commits] asterisk-scf/release/ice-util-cpp.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Aug 10 20:12:48 CDT 2011


branch "master" has been updated
       via  a5fe978beeaeff3362834fbf4a9210106988f6d8 (commit)
      from  aa7afeacd622f141bb97c70c40a983243491433c (commit)

Summary of changes:
 include/AsteriskSCF/Collections/Set.h |   76 +++++++++++++++++----------------
 1 files changed, 39 insertions(+), 37 deletions(-)


- Log -----------------------------------------------------------------
commit a5fe978beeaeff3362834fbf4a9210106988f6d8
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Aug 10 20:09:45 2011 -0500

    Some minor gcc template requirements addressed.

diff --git a/include/AsteriskSCF/Collections/Set.h b/include/AsteriskSCF/Collections/Set.h
index ce250c3..78f7f21 100644
--- a/include/AsteriskSCF/Collections/Set.h
+++ b/include/AsteriskSCF/Collections/Set.h
@@ -64,7 +64,7 @@ public:
     {
     }
 
-    int size()
+    size_t size()
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         return mMap.size();
@@ -102,7 +102,7 @@ public:
     void add(const std::vector<T>& items)
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
-        for (std::vector<T>::const_iterator i = items.begin(); i != items.end(); ++i)
+        for (typename std::vector<T>::const_iterator i = items.begin(); i != items.end(); ++i)
         {
             if ((*i) == 0)
             {
@@ -129,11 +129,11 @@ public:
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         std::vector<K> idsNotFound; 
 
-        for (std::vector<T>::const_iterator i = items.begin(); i != items.end(); ++i)
+        for (typename std::vector<T>::const_iterator i = items.begin(); i != items.end(); ++i)
         {
             K id = getIdentity(*i);
 
-            std::map<K, T>::iterator searchResult = mMap.find(id);
+            typename std::map<K, T>::iterator searchResult = mMap.find(id);
             if (searchResult != mMap.end())
             {
                 mMap.erase(searchResult);
@@ -144,7 +144,7 @@ public:
             }
         }
 
-        for(std::vector<K>::const_iterator s = idsNotFound.begin(); s != idsNotFound.end(); ++s)
+        for(typename std::vector<K>::const_iterator s = idsNotFound.begin(); s != idsNotFound.end(); ++s)
         {
             mLogger(AsteriskSCF::System::Logging::Warning) << "Attempted to remove non-existent member " << (*s);
         }
@@ -157,7 +157,7 @@ public:
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         K id = getIdentity(item);
-        std::map<K, T>::iterator searchResult = mMap.find(id);
+        typename std::map<K, T>::iterator searchResult = mMap.find(id);
 
         if (searchResult != mMap.end())
         {
@@ -180,7 +180,7 @@ public:
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         std::vector<T> result;
 
-        for (std::map<K,T>::const_iterator pair = mMap.begin(); pair != mMap.end(); ++pair)
+        for (typename std::map<K,T>::const_iterator pair = mMap.begin(); pair != mMap.end(); ++pair)
         {
             result.push_back(pair->second);
         }
@@ -198,9 +198,9 @@ public:
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         std::vector<T> result;
 
-        for (std::vector<T>::const_iterator i = toRetrieve.begin(); i != toRetrieve.end(); ++i)
+        for (typename std::vector<T>::const_iterator i = toRetrieve.begin(); i != toRetrieve.end(); ++i)
         {
-            std::map<K,T>::const_iterator pair = mMap.find(getIdentity(*i));
+            typename std::map<K,T>::const_iterator pair = mMap.find(getIdentity(*i));
             if (pair != mMap.end())
             {
                 result.push_back(pair->second);
@@ -213,7 +213,7 @@ public:
     T get(const K& key)
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
-        std::map<K, T>::const_iterator pair = mMap.find(key);
+        typename std::map<K, T>::const_iterator pair = mMap.find(key);
          
         if (pair != mMap.end())
         {
@@ -231,7 +231,7 @@ public:
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
 
-        std::map<K, T>::const_iterator search = mMap.find(key);
+        typename std::map<K, T>::const_iterator search = mMap.find(key);
         return (search != mMap.end());
     }
 
@@ -239,7 +239,7 @@ public:
 
 protected:
 
-    virtual K getIdentity(const T& item) = 0;
+    virtual K getIdentity(const T & item) = 0;
 
     AsteriskSCF::System::Logging::Logger mLogger;
     std::string mLoggingLabel;
@@ -261,7 +261,7 @@ protected:
               const AsteriskSCF::System::Logging::Logger& logger,
               const std::string& loggingLabel,
               bool doesThrow = true)
-                  : Set(adapter,
+                  : Set<S, std::string, AsteriskSCF::System::V1::NullHandleException>(adapter,
                         logger,
                         loggingLabel,
                         doesThrow)
@@ -271,15 +271,15 @@ protected:
     HandleSet(const Ice::ObjectAdapterPtr& adapter,
               const std::string& loggingLabel,
               bool doesThrow = true)
-                 : Set(adapter,
+                 : Set<S, std::string, AsteriskSCF::System::V1::NullHandleException>(adapter,
                        loggingLabel,
                        doesThrow)
                
     {
     }
 
- protected:
-     virtual std::string getIdentity(const S& item)
+protected:
+     virtual std::string getIdentity(const S & item)
      {
          return item->ice_id();
      }
@@ -293,31 +293,33 @@ template <typename S>
 class ProxySet : public Set<S, std::string, AsteriskSCF::System::V1::NullProxyException>
 {
 public:
-ProxySet(const Ice::ObjectAdapterPtr& adapter,
-         const AsteriskSCF::System::Logging::Logger& logger,
-         const std::string& loggingLabel,
-         bool doesThrow = true)
-            : Set(adapter,
-                  logger,
-                  loggingLabel,
-                  doesThrow)
-{
-}
-
-ProxySet(const Ice::ObjectAdapterPtr& adapter,
-         const std::string& loggingLabel,
-         bool doesThrow = true)
-            : Set(adapter,
-                  loggingLabel,
-                  doesThrow)
+    ProxySet(const Ice::ObjectAdapterPtr& adapter,
+             const AsteriskSCF::System::Logging::Logger& logger,
+             const std::string& loggingLabel,
+             bool doesThrow = true)
+                : Set<S, std::string, AsteriskSCF::System::V1::NullProxyException>(adapter,
+                      logger,
+                      loggingLabel,
+                      doesThrow)
+    {
+    }
+
+    ProxySet(const Ice::ObjectAdapterPtr& adapter,
+             const std::string& loggingLabel,
+             bool doesThrow = true)
+                : Set<S, std::string, AsteriskSCF::System::V1::NullProxyException>(adapter,
+                      loggingLabel,
+                      doesThrow)
                
-{
-}
+    {
+    }
 
 protected:
-    virtual std::string getIdentity(const S& item)
+    virtual std::string getIdentity(const S & item)
     {
-        return mAdapter->getCommunicator()->identityToString(item->ice_getIdentity());
+        // Note: In referencing a member of a base template class, gcc requires the "this" 
+        // to know where to look for the member variable.
+        return this->mAdapter->getCommunicator()->identityToString(item->ice_getIdentity());
     }
 };
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/ice-util-cpp.git



More information about the asterisk-scf-commits mailing list