[asterisk-scf-commits] asterisk-scf/release/ice.git branch "unsliceable_patch" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Nov 29 10:52:01 CST 2010


branch "unsliceable_patch" has been updated
       via  cfd35498bdb1893155159520f62391420af1c020 (commit)
       via  0a902683747b02c1579723ec78a6ad5e2d7901aa (commit)
      from  55423a40ce533acd1e04744663754de219637ec6 (commit)

Summary of changes:
 cpp/include/Slice/Parser.h            |    3 --
 cpp/src/Ice/BasicStream.cpp           |   54 ++------------------------------
 cpp/src/Slice/Parser.cpp              |   35 ---------------------
 cpp/src/slice2cpp/Gen.cpp             |    2 -
 cs/src/Ice/BasicStream.cs             |   54 ++-------------------------------
 java/src/IceInternal/BasicStream.java |   54 ++-------------------------------
 6 files changed, 10 insertions(+), 192 deletions(-)


- Log -----------------------------------------------------------------
commit cfd35498bdb1893155159520f62391420af1c020
Author: Brent Eagles <beagles at digium.com>
Date:   Mon Nov 29 13:21:18 2010 -0330

    Remove scanParentsMetaData function.

diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
index 4c93c60..016121a 100644
--- a/cpp/include/Slice/Parser.h
+++ b/cpp/include/Slice/Parser.h
@@ -178,9 +178,6 @@ public:
 SLICE_API bool derivedToBaseCompare(const ExceptionPtr&, const ExceptionPtr&);
 #endif
 
-SLICE_API bool scanParentsMetaData(const ClassDefPtr&, const std::string&, std::string&);
-SLICE_API bool scanParentsMetaData(const ExceptionPtr&, const std::string&, std::string&);
-
 // ----------------------------------------------------------------------
 // ParserVisitor
 // ----------------------------------------------------------------------
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 17abd15..bfd40a7 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -5877,38 +5877,3 @@ Slice::derivedToBaseCompare(const ExceptionPtr& e1, const ExceptionPtr& e2)
 }
 #endif
 
-//
-// Checks to see if the metadata string appears somewhere in the hierarchy.
-//
-bool 
-Slice::scanParentsMetaData(const ClassDefPtr& p, const std::string& tag, std::string& result)
-{
-    ClassList parents = p->allBases();
-    std::string value;
-    for(ClassList::const_iterator i = parents.begin(); i != parents.end(); ++i)
-    {
-	if((*i)->findMetaData(tag, value))
-	{
-	    result = value;
-	    return true;
-	}
-    }
-    return false;
-}
-
-bool 
-Slice::scanParentsMetaData(const ExceptionPtr& p, const std::string& tag, std::string& result)
-{
-    ExceptionList parents = p->allBases();
-    std::string value;
-    for(ExceptionList::const_iterator i = parents.begin(); i != parents.end(); ++i)
-    {
-	if((*i)->findMetaData(tag, value))
-	{
-	    result = value;
-	    return true;
-	}
-    }
-    return false;
-}
-

commit 0a902683747b02c1579723ec78a6ad5e2d7901aa
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Nov 26 13:38:31 2010 -0330

    Add refactorings for addPendingObject/writeObject in the BasicStream
    implementations.
    
    Removed leftover variable in the C++ generator.

diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 6dd2f41..a265e4a 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -1732,55 +1732,9 @@ IceInternal::BasicStream::read(ObjectPrx& v)
 Ice::Int
 IceInternal::BasicStream::write(const ObjectPtr& v)
 {
-    if(!_currentWriteEncaps) // Lazy initialization.
-    {
-        _currentWriteEncaps = &_preAllocatedWriteEncaps;
-        _currentWriteEncaps->start = b.size();
-    }
-
-    if(!_currentWriteEncaps->toBeMarshaledMap) // Lazy initialization.
-    {
-        _currentWriteEncaps->toBeMarshaledMap = new PtrToIndexMap;
-        _currentWriteEncaps->marshaledMap = new PtrToIndexMap;
-        _currentWriteEncaps->typeIdMap = new TypeIdWriteMap;
-    }
-
-    if(v)
-    {
-        //
-        // Look for this instance in the to-be-marshaled map.
-        //
-        PtrToIndexMap::iterator p = _currentWriteEncaps->toBeMarshaledMap->find(v);
-        if(p == _currentWriteEncaps->toBeMarshaledMap->end())
-        {
-            //
-            // Didn't find it, try the marshaled map next.
-            //
-            PtrToIndexMap::iterator q = _currentWriteEncaps->marshaledMap->find(v);
-            if(q == _currentWriteEncaps->marshaledMap->end())
-            {
-                //
-                // We haven't seen this instance previously, create a
-                // new index, and insert it into the to-be-marshaled
-                // map.
-                //
-                q = _currentWriteEncaps->toBeMarshaledMap->insert(
-                    _currentWriteEncaps->toBeMarshaledMap->end(),
-                    pair<const ObjectPtr, Int>(v, ++_currentWriteEncaps->writeIndex));
-            }
-            p = q;
-        }
-        //
-        // Write the index for the instance.
-        //
-        write(-(p->second));
-	return p->second;
-    }
-    else
-    {
-        write(0); // Write null pointer.
-    }
-    return 0;
+    Ice::Int index = addPendingObject(v);
+    write(-index);
+    return index;
 }
 
 void
@@ -2248,7 +2202,7 @@ IceInternal::BasicStream::addPendingObject(const Ice::ObjectPtr& v)
             p = q;
         }
         //
-        // Write the index for the instance.
+        // Return the index for the instance. 
         //
 	return p->second;
     }
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index cfe94e0..b042c2f 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -26,8 +26,6 @@ using namespace Slice;
 using namespace IceUtil;
 using namespace IceUtilInternal;
 
-const std::string preserveTag("preserve");
-
 static string
 getDeprecateSymbol(const ContainedPtr& p1, const ContainedPtr& p2)
 {
diff --git a/cs/src/Ice/BasicStream.cs b/cs/src/Ice/BasicStream.cs
index e01d04e..f681abe 100644
--- a/cs/src/Ice/BasicStream.cs
+++ b/cs/src/Ice/BasicStream.cs
@@ -2056,57 +2056,9 @@ namespace IceInternal
 
         public virtual int writeObject(Ice.Object v)
         {
-            if(_writeEncapsStack == null) // Lazy initialization
-            {
-                _writeEncapsStack = _writeEncapsCache;
-                if(_writeEncapsStack != null)
-                {
-                    _writeEncapsCache = _writeEncapsCache.next;
-                }
-                else
-                {
-                    _writeEncapsStack = new WriteEncaps();
-                }
-            }
-
-            if(_writeEncapsStack.toBeMarshaledMap == null) // Lazy initialization
-            {
-                _writeEncapsStack.toBeMarshaledMap = new Hashtable();
-                _writeEncapsStack.marshaledMap = new Hashtable();
-                _writeEncapsStack.typeIdMap = new Hashtable();
-            }
-            if(v != null)
-            {
-                //
-                // Look for this instance in the to-be-marshaled map.
-                //
-                object p = _writeEncapsStack.toBeMarshaledMap[v];
-                if(p == null)
-                {
-                    //
-                    // Didn't find it, try the marshaled map next.
-                    //
-                    object q = _writeEncapsStack.marshaledMap[v];
-                    if(q == null)
-                    {
-                        //
-                        // We haven't seen this instance previously,
-                        // create a new index, and insert it into the
-                        // to-be-marshaled map.
-                        //
-                        q = ++_writeEncapsStack.writeIndex;
-                        _writeEncapsStack.toBeMarshaledMap[v] = q;
-                    }
-                    p = q;
-                }
-                writeInt(-((int)p));
-		return (int)p;
-            }
-            else
-            {
-                writeInt(0); // Write null reference
-            }
-	    return 0;
+            int index = addPendingObject(v);
+            writeInt(-(index));
+            return index;
         }
 
         public virtual void readObject(IPatcher patcher)
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java
index ee0f81b..c7f81b0 100644
--- a/java/src/IceInternal/BasicStream.java
+++ b/java/src/IceInternal/BasicStream.java
@@ -1369,57 +1369,9 @@ public class BasicStream
     public int
     writeObject(Ice.Object v)
     {
-        if(_writeEncapsStack == null) // Lazy initialization
-        {
-            _writeEncapsStack = _writeEncapsCache;
-            if(_writeEncapsStack != null)
-            {
-                _writeEncapsCache = _writeEncapsCache.next;
-            }
-            else
-            {
-                _writeEncapsStack = new WriteEncaps();
-            }
-        }
-
-        if(_writeEncapsStack.toBeMarshaledMap == null)  // Lazy initialization
-        {
-            _writeEncapsStack.toBeMarshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>();
-            _writeEncapsStack.marshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>();
-            _writeEncapsStack.typeIdMap = new java.util.TreeMap<String, Integer>();
-        }
-        if(v != null)
-        {
-            //
-            // Look for this instance in the to-be-marshaled map.
-            //
-            Integer p = _writeEncapsStack.toBeMarshaledMap.get(v);
-            if(p == null)
-            {
-                //
-                // Didn't find it, try the marshaled map next.
-                //
-                Integer q = _writeEncapsStack.marshaledMap.get(v);
-                if(q == null)
-                {
-                    //
-                    // We haven't seen this instance previously,
-                    // create a new index, and insert it into the
-                    // to-be-marshaled map.
-                    //
-                    q = Integer.valueOf(++_writeEncapsStack.writeIndex);
-                    _writeEncapsStack.toBeMarshaledMap.put(v, q);
-                }
-                p = q;
-            }
-            writeInt(-p.intValue());
-	    return p.intValue();
-        }
-        else
-        {
-            writeInt(0); // Write null reference
-        }
-	return 0;
+        int index = addPendingObject(v);
+        writeInt(-index);
+        return index;
     }
 
     public void

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


-- 
asterisk-scf/release/ice.git



More information about the asterisk-scf-commits mailing list