[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "replication-visitor" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Dec 30 22:53:12 UTC 2010


branch "replication-visitor" has been updated
       via  8053dab526443105e44d902ab795a8252834d1fe (commit)
      from  c3f55bb7a358def51806d8bb5b06e9eefbd58500 (commit)

Summary of changes:
 local-slice/CMakeLists.txt              |    2 +-
 local-slice/RtpStateItemHelpers.ice     |   54 -------------
 local-slice/RtpStateItemHelpersImpl.cpp |  119 ----------------------------
 local-slice/RtpStateItemHelpersImpl.h   |   84 --------------------
 local-slice/RtpStateReplicationIf.ice   |  131 +++++++++++++++----------------
 src/MediaRTPpjmedia.cpp                 |    3 +-
 src/RTPSession.cpp                      |    3 +-
 src/RTPSink.cpp                         |    3 +-
 src/RTPSource.cpp                       |    3 +-
 test/TestRTPpjmedia.cpp                 |    1 -
 10 files changed, 67 insertions(+), 336 deletions(-)
 delete mode 100644 local-slice/RtpStateItemHelpers.ice
 delete mode 100644 local-slice/RtpStateItemHelpersImpl.cpp
 delete mode 100644 local-slice/RtpStateItemHelpersImpl.h


- Log -----------------------------------------------------------------
commit 8053dab526443105e44d902ab795a8252834d1fe
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Thu Dec 30 16:47:34 2010 -0600

    Use new translator support for visitors

diff --git a/local-slice/CMakeLists.txt b/local-slice/CMakeLists.txt
index 4f25cf4..bc354ab 100644
--- a/local-slice/CMakeLists.txt
+++ b/local-slice/CMakeLists.txt
@@ -1,2 +1,2 @@
 asterisk_scf_slice_include_directories("${CMAKE_SOURCE_DIR}/slice")
-asterisk_scf_compile_slice(RtpStateReplicationIf lib "RTP State Replicator" media_rtp_pjmedia SOURCES RtpStateReplicationIf.ice RtpStateItemHelpers.ice RtpStateItemHelpersImpl.h RtpStateItemHelpersImpl.cpp)
+asterisk_scf_compile_slice(RtpStateReplicationIf.ice lib "RTP State Replicator" media_rtp_pjmedia)
diff --git a/local-slice/RtpStateItemHelpers.ice b/local-slice/RtpStateItemHelpers.ice
deleted file mode 100644
index 455869c..0000000
--- a/local-slice/RtpStateItemHelpers.ice
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-
-#pragma once
-
-#include "RtpStateReplicationIf.ice"
-
-[["cpp:include:RtpStateItemHelpersImpl.h"]]
-
-module AsteriskSCF
-{
-
-module Media
-{
-
-module RTP
-{
-
-["suppress"]
-module V1
-{
-
-module StateItemHelpers
-{
-    // This module is intentionally left empty, as its contents
-    // cannot be defined in the Slice language. However, its
-    // contents should be provided to all users of the RTPStateItem
-    // mechanism, written in each language that is supported. Those
-    // implementations will be available in companion files in the
-    // same directory as this one. For C++, the helpers will be
-    // automatically brought into the program by the inclusion
-    // of the RtpStateItemHelpers.h file above.
-}; // module StateItemHelpers
-
-}; // module V1
-
-}; // module RTP
-
-}; // module Media
-
-}; // module Asterisk SCF
diff --git a/local-slice/RtpStateItemHelpersImpl.cpp b/local-slice/RtpStateItemHelpersImpl.cpp
deleted file mode 100644
index 5acc233..0000000
--- a/local-slice/RtpStateItemHelpersImpl.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-
-#include <Ice/Ice.h>
-
-#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
-
-using namespace AsteriskSCF::Media::RTP::V1;
-
-namespace AsteriskSCF
-{
-
-namespace Media
-{
-
-namespace RTP
-{
-
-namespace V1
-{
-
-namespace StateItemHelpers
-{
-
-template <typename T>
-class factory : public Ice::ObjectFactory
-{
-public:
-	virtual Ice::ObjectPtr create(const std::string &)
-	{
-		return new T();
-	}
-
-	virtual void destroy()
-	{
-	}
-};
-
-void registerObjectFactory(const Ice::CommunicatorPtr &communicator)
-{
-	communicator->addObjectFactory(new factory<RtpStateItemImpl>(), RtpStateItem::ice_staticId());
-	communicator->addObjectFactory(new factory<RtpGeneralStateItemImpl>(), RtpGeneralStateItem::ice_staticId());
-	communicator->addObjectFactory(new factory<RtpSessionStateItemImpl>(), RtpSessionStateItem::ice_staticId());
-	communicator->addObjectFactory(new factory<RtpStreamSourceStateItemImpl>(), RtpStreamSourceStateItem::ice_staticId());
-	communicator->addObjectFactory(new factory<RtpStreamSinkStateItemImpl>(), RtpStreamSinkStateItem::ice_staticId());
-}
-
-void RtpStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
-}
-
-RtpStateItemPtr newRtpStateItem(void)
-{
-	return new RtpStateItemImpl();
-}
-
-void RtpGeneralStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
-	visitor->visitGeneral(this);
-}
-
-RtpGeneralStateItemPtr newRtpGeneralStateItem(void)
-{
-	return new RtpGeneralStateItemImpl();
-}
-
-void RtpSessionStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
-	visitor->visitSession(this);
-}
-
-RtpSessionStateItemPtr newRtpSessionStateItem(void)
-{
-	return new RtpSessionStateItemImpl();
-}
-
-void RtpStreamSourceStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
-	visitor->visitStreamSource(this);
-}
-
-RtpStreamSourceStateItemPtr newRtpStreamSourceStateItem(void)
-{
-	return new RtpStreamSourceStateItemImpl();
-}
-
-void RtpStreamSinkStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
-	visitor->visitStreamSink(this);
-}
-
-RtpStreamSinkStateItemPtr newRtpStreamSinkStateItem(void)
-{
-	return new RtpStreamSinkStateItemImpl();
-}
-
-} // namespace StateItemHelpers
-
-} // namespace V1
-
-} // namespace RTP
-
-} // namespace Media
-
-} // namespace AsteriskSCF
diff --git a/local-slice/RtpStateItemHelpersImpl.h b/local-slice/RtpStateItemHelpersImpl.h
deleted file mode 100644
index 5621760..0000000
--- a/local-slice/RtpStateItemHelpersImpl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-
-#pragma once
-
-namespace AsteriskSCF
-{
-
-namespace Media
-{
-
-namespace RTP
-{
-
-namespace V1
-{
-
-namespace StateItemHelpers
-{
-
-void registerObjectFactory(const Ice::CommunicatorPtr &communicator);
-
-class RtpStateItemImpl : public RtpStateItem
-{
-public:
-	void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpStateItemPtr newRtpStateItem(void);
-
-class RtpGeneralStateItemImpl : public RtpGeneralStateItem
-{
-public:
-	void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpGeneralStateItemPtr newRtpGeneralStateItem(void);
-
-class RtpSessionStateItemImpl : public RtpSessionStateItem
-{
-public:
-	void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpSessionStateItemPtr newRtpSessionStateItem(void);
-
-class RtpStreamSourceStateItemImpl : public RtpStreamSourceStateItem
-{
-public:
-	void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpStreamSourceStateItemPtr newRtpStreamSourceStateItem(void);
-
-class RtpStreamSinkStateItemImpl : public RtpStreamSinkStateItem
-{
-public:
-	void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpStreamSinkStateItemPtr newRtpStreamSinkStateItem(void);
-
-} // namespace StateItemHelpers
-
-} // namespace V1
-
-} // namespace RTP
-
-} // namespace Media
-
-} // namespace AsteriskSCF
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index 49d2dc5..2dbbeed 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -34,75 +34,68 @@ module RTP
 ["suppress"]
 module V1
 {
-   const string StateReplicatorComponentCategory = "RtpStateReplicatorComponent";
-   const string StateReplicatorDiscoveryCategory = "RtpStateReplicator";
-
-   class RtpStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
-   {
-      string mName;
-   };
-
-   interface RtpStateItemVisitor;
-
-   class RtpStateItem
-   {
-      string key;
-      string mSessionId;
-      void visit(RtpStateItemVisitor visitor);
-   };
-
-   sequence<RtpStateItem> RtpStateItemSeq;
-
-   interface RtpStateReplicatorListener
-   {
-	   void stateRemoved(Ice::StringSeq itemKeys);
-	   void stateSet(RtpStateItemSeq items);
-   };
-
-   interface RtpStateReplicator
-   {
-	   void addListener(RtpStateReplicatorListener *listener);
-	   void removeListener(RtpStateReplicatorListener *listener);
-	   void setState (RtpStateItemSeq items);
-	   void removeState(Ice::StringSeq items);
-	   idempotent RtpStateItemSeq getState(Ice::StringSeq itemKeys);
-	   idempotent RtpStateItemSeq getAllState();
-   };
-
-   class RtpGeneralStateItem extends RtpStateItem
-   {
-       AsteriskSCF::Core::Discovery::V1::ServiceManagement *mServiceManagement;
-   };
-
-   class RtpSessionStateItem extends RtpStateItem
-   {
-       Ice::Identity mSessionIdentity;
-       int mPort;
-       Ice::Identity mSinkIdentity;
-       Ice::Identity mSourceIdentity;
-       AsteriskSCF::Media::V1::FormatSeq mFormats;
-       PayloadMap mPayloadstoFormats;
-   };
-
-   class RtpStreamSinkStateItem extends RtpStateItem
-   {
-       AsteriskSCF::Media::V1::StreamSource *mSource;
-       string mRemoteAddress;
-       int mRemotePort;
-   };
-
-   class RtpStreamSourceStateItem extends RtpStateItem
-   {
-       AsteriskSCF::Media::V1::StreamSink *mSink;
-   };
-
-   interface RtpStateItemVisitor
-   {
-       void visitGeneral(RtpGeneralStateItem item);
-       void visitSession(RtpSessionStateItem item);
-       void visitStreamSink(RtpStreamSinkStateItem item);
-       void visitStreamSource(RtpStreamSourceStateItem item);
-   };
+    const string StateReplicatorComponentCategory = "RtpStateReplicatorComponent";
+    const string StateReplicatorDiscoveryCategory = "RtpStateReplicator";
+    
+    class RtpStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
+    {
+	string mName;
+    };
+    
+    ["visitor"] local class RtpStateItemVisitor
+    {
+    };
+
+    ["visitor:::AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor"] class RtpStateItem
+    {
+	string key;
+	string mSessionId;
+    };
+
+    sequence<RtpStateItem> RtpStateItemSeq;
+
+    interface RtpStateReplicatorListener
+    {
+	void stateRemoved(Ice::StringSeq itemKeys);
+	void stateSet(RtpStateItemSeq items);
+    };
+
+    interface RtpStateReplicator
+    {
+	void addListener(RtpStateReplicatorListener *listener);
+	void removeListener(RtpStateReplicatorListener *listener);
+	void setState (RtpStateItemSeq items);
+	void removeState(Ice::StringSeq items);
+	idempotent RtpStateItemSeq getState(Ice::StringSeq itemKeys);
+	idempotent RtpStateItemSeq getAllState();
+    };
+
+    class RtpGeneralStateItem extends RtpStateItem
+    {
+	AsteriskSCF::Core::Discovery::V1::ServiceManagement *mServiceManagement;
+    };
+
+    class RtpSessionStateItem extends RtpStateItem
+    {
+	Ice::Identity mSessionIdentity;
+	int mPort;
+	Ice::Identity mSinkIdentity;
+	Ice::Identity mSourceIdentity;
+	AsteriskSCF::Media::V1::FormatSeq mFormats;
+	PayloadMap mPayloadstoFormats;
+    };
+
+    class RtpStreamSinkStateItem extends RtpStateItem
+    {
+	AsteriskSCF::Media::V1::StreamSource *mSource;
+	string mRemoteAddress;
+	int mRemotePort;
+    };
+
+    class RtpStreamSourceStateItem extends RtpStateItem
+    {
+	AsteriskSCF::Media::V1::StreamSink *mSink;
+    };
 }; // module V1
 
 }; // module RTP
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 1af4b00..1e7c30b 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -30,7 +30,6 @@
 #include "IceLogger.h"
 #include "logger.h"
 #include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
 #include "ReplicaIf.h"
 #include "SmartProxy.h"
 
@@ -161,7 +160,7 @@ private:
 class MediaRTPpjmediaApp : public IceBox::Service
 {
 public:
-    MediaRTPpjmediaApp() : mGeneralState(StateItemHelpers::newRtpGeneralStateItem()) { mGeneralState->key = IceUtil::generateUUID(); };
+    MediaRTPpjmediaApp() : mGeneralState(new RtpGeneralStateItem()) { mGeneralState->key = IceUtil::generateUUID(); };
     void start(const std::string&, const Ice::CommunicatorPtr&, const Ice::StringSeq&);
     void stop();
 
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index e91824d..15633ef 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -23,7 +23,6 @@
 #include "Media/MediaIf.h"
 #include "Media/RTP/MediaRTPIf.h"
 #include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
 #include "ReplicaIf.h"
 #include "SmartProxy.h"
 
@@ -55,7 +54,7 @@ class RTPSessionImplPriv
 {
 public:
     RTPSessionImplPriv(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats, ReplicaPtr replicaService, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> stateReplicator) :
-	mAdapter(adapter), mFormats(formats), mSessionStateItem(StateItemHelpers::newRtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
+	mAdapter(adapter), mFormats(formats), mSessionStateItem(new RtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
     ~RTPSessionImplPriv();
 
     /**
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index a14b87d..ed63b32 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -23,7 +23,6 @@
 #include "Media/MediaIf.h"
 #include "Media/RTP/MediaRTPIf.h"
 #include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
 #include "ReplicaIf.h"
 #include "SmartProxy.h"
 
@@ -65,7 +64,7 @@ public:
 /**
  * Constructor for the StreamSinkRTPImplPriv class.
  */
-StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(StateItemHelpers::newRtpStreamSinkStateItem())
+StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(new RtpStreamSinkStateItem())
 {
     pjmedia_rtp_session_init(&mOutgoingSession, 0, pj_rand());
     mSinkStateItem->mSessionId = sessionId;
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index bbc3ab1..3747677 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -23,7 +23,6 @@
 #include "Media/MediaIf.h"
 #include "Media/RTP/MediaRTPIf.h"
 #include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
 #include "ReplicaIf.h"
 #include "SmartProxy.h"
 
@@ -72,7 +71,7 @@ public:
 /**
  * Constructor for the StreamSourceRTPImplPriv class.
  */
-StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(StateItemHelpers::newRtpStreamSourceStateItem())
+StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(new RtpStreamSourceStateItem())
 {
     pjmedia_rtp_session_init(&mIncomingSession, 0, 0);
     mSourceStateItem->mSessionId = sessionId;
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index 1c71863..1efa138 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -27,7 +27,6 @@
 #include "Media/MediaIf.h"
 #include "Media/RTP/MediaRTPIf.h"
 #include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
 
 using namespace std;
 using namespace AsteriskSCF::Core::Discovery::V1;

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list