[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Mar 21 17:17:51 CDT 2012


branch "retry_deux" has been updated
       via  688d564b2ca9657fbaf32e4d4984505e49531de8 (commit)
      from  abdc8b55b462e1c827d005a961fef00dc7af42c0 (commit)

Summary of changes:
 src/BridgeImpl.cpp     |    1 +
 src/OperationMonitor.h |  113 ++++++++++++++++++++++-------------------------
 2 files changed, 54 insertions(+), 60 deletions(-)


- Log -----------------------------------------------------------------
commit 688d564b2ca9657fbaf32e4d4984505e49531de8
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Mar 21 19:47:28 2012 -0230

    Fix the OperationMonitor related build errors on Linux (testing pending).

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index ccb2454..4038df3 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -912,6 +912,7 @@ private:
     SessionsTrackerPtr mTracker;
 };
 
+typedef ContextResultData<AsteriskSCF::Media::V1::StreamInformationDict> StreamInformationContextData;
 typedef AMDContextResultData<
     AsteriskSCF::Media::V1::StreamInformationDict,
     AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr> AddStreamsContextData;
diff --git a/src/OperationMonitor.h b/src/OperationMonitor.h
index 0bf2dfa..bbc63d2 100755
--- a/src/OperationMonitor.h
+++ b/src/OperationMonitor.h
@@ -21,6 +21,7 @@
 #include <string>
 #include <boost/shared_ptr.hpp>
 #include <boost/enable_shared_from_this.hpp>
+#include <AsteriskSCF/Operations/OperationContext.h>
 #include <AsteriskSCF/Operations/OperationContextCache.h>
 #include "ExceptionWrapper.h"
 
@@ -84,7 +85,8 @@ private:
 };
 typedef IceUtil::Handle<ContextMonitor> ContextMonitorPtr;
 
-class ContextData : public AsteriskSCF::Operations::OperationContextCookie
+class ContextData : virtual public AsteriskSCF::Operations::OperationContextCookie,
+                    virtual public boost::enable_shared_from_this<ContextData>
 {
 public:
     ContextData() :
@@ -114,17 +116,17 @@ public:
      */
     bool isCompleted();
 
-protected:
-    IceUtil::Mutex mLock;
-    
-    ContextMonitorPtr mMonitor;
-    ExceptionWrapperPtr mExceptionResult;
-
     virtual void setCompleted()
     {
         mMonitor->setCompleted();
         onSetCompleted();
     }
+   
+protected:
+    IceUtil::Mutex mLock;
+    
+    ContextMonitorPtr mMonitor;
+    ExceptionWrapperPtr mExceptionResult;
 
     virtual void onSetException()
     {
@@ -146,13 +148,18 @@ typedef boost::shared_ptr<ContextData> ContextDataPtr;
  */
 
 template <typename RT>
-class ContextResultData : public ContextData
+class ContextResultData : virtual public ContextData
 {
 public:
     void setResult(const RT& val);
 
 protected:
     virtual void onSetResult() {}
+
+    RT getResult()
+    {
+        return mResult;
+    }
     RT mResult;
 };
 
@@ -174,8 +181,7 @@ void ContextResultData<RT>::setResult(const RT& val)
  * Not every AMD type operation has a result value.
  */
 template <class CB>
-class AMDContextData : public ContextData,
-    public virtual boost::enable_shared_from_this<AMDContextData<CB> >
+class AMDContextData : virtual public ContextData
 {
 public:
     template<class T >
@@ -224,18 +230,13 @@ public:
             }
         }
 
-        AMDProxy(const boost::shared_ptr<AMDContextData<T> >& d) :
+        AMDProxy(const boost::shared_ptr<ContextData>& d) :
             mParent(d)
         {
         }
 
-        void setCompleted()
-        {
-            ContextData::setCompleted();
-        }
-
     private:
-        boost::shared_ptr<AMDContextData<T> > mParent;
+        boost::shared_ptr<ContextData> mParent;
     };
 
     AMDContextData() {}
@@ -320,8 +321,7 @@ void AMDContextData<CB>::onSetCompleted()
  *
  **/
 template <typename RT, class CB>
-class AMDContextResultData : public ContextResultData<RT>, 
-    public virtual boost::enable_shared_from_this<AMDContextResultData<RT, CB> >
+class AMDContextResultData : virtual public ContextResultData<RT>, virtual public ContextData
 {
 public:
     template< typename RTi, class CBi >
@@ -396,61 +396,54 @@ public:
             // between the AMD proxy and this object instance *after* this object instance
             // has been fully constructed. Otherwise we can get into some nasty stuff.
             //
-            IceUtil::LockT<IceUtil::Mutex> lock(mLock);
+            IceUtil::Mutex::Lock lock(mLock);
             if (!mAMDProxy)
             {
-                mAMDProxy = new AMDProxy<RT, CB>(shared_from_this());
+//                mAMDProxy = new AMDProxy<RT, CB>(ed_from_this());
             }
         }
         return mAMDProxy;
     }
     
-    void addCB(const CB& cbPtr);
-
-private:
-    void onSetResult();
-    void onSetException();
-    CB mAMDProxy;
-    std::vector<CB> mCallbacks;
-};
-
-template <typename RT, class CB>
-void AMDContextResultData<RT, CB>::addCB(const CB& cbPtr)
-{
-    IceUtil::LockT<IceUtil::Mutex> lock(mLock);
-    if (isCompleted())
+    void addCB(const CB& cbPtr)
     {
-        if (mExceptionResult)
+        IceUtil::LockT<IceUtil::Mutex> lock(mLock);
+        if (ContextData::isCompleted())
         {
-            cbPtr->ice_exception(*(mExceptionResult->exception()));
+            if (mExceptionResult)
+            {
+                cbPtr->ice_exception(*(mExceptionResult->exception()));
+            }
+            else
+            {
+                cbPtr->ice_response(ContextResultData<RT>::getResult());
+            }
+            return;
         }
-        else
+        mCallbacks.push_back(cbPtr);
+    }
+    
+private:
+    void onSetResult()
+    {
+        for (typename std::vector<CB>::const_iterator iter = mCallbacks.begin();
+             iter != mCallbacks.end(); ++iter)
         {
-            cbPtr->ice_response(mResult);
+            (*iter)->ice_response(ContextResultData<RT>::getResult());
         }
-        return;
     }
-    mCallbacks.push_back(cbPtr);
-}
 
-template <typename RT, class CB>
-void AMDContextResultData<RT, CB>::onSetResult()
-{
-    for (typename std::vector<CB>::const_iterator iter = mCallbacks.begin();
-         iter != mCallbacks.end(); ++iter)
-    {
-        (*iter)->ice_response(mResult);
-    }
-}
-template <typename RT, class CB>
-void AMDContextResultData<RT, CB>::onSetException()
-{
-    for (typename std::vector<CB>::const_iterator iter= mCallbacks.begin();
-         iter != mCallbacks.end(); ++iter)
+    void onSetException()
     {
-        (*iter)->ice_exception(*(mExceptionResult->exception()));
+        for (typename std::vector<CB>::const_iterator iter= mCallbacks.begin();
+             iter != mCallbacks.end(); ++iter)
+        {
+            (*iter)->ice_exception(*(mExceptionResult->exception()));
+        }
     }
-}
+    CB mAMDProxy;
+    std::vector<CB> mCallbacks;
+};
 
 /** 
  * Simple file scope helper for the "add" methods. The signatures for
@@ -470,12 +463,12 @@ DT getContext(const AsteriskSCF::Operations::OperationContextCachePtr& cache,
     const AsteriskSCF::System::V1::OperationContextPtr& context,
     const AT& amdCallback)
 {
-    DT c(new DT::element_type);
+    DT c(new typename DT::element_type);
     AsteriskSCF::Operations::OperationContextCookiePtr o;
      
     if (!cache->addOperationContext(context, c, o))
     {
-        c = boost::dynamic_pointer_cast<DT::element_type>(o);
+        c = boost::dynamic_pointer_cast<typename DT::element_type>(o);
         assert(c);
         c->addCB(amdCallback);
         return DT();

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list