You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2011/04/07 22:40:11 UTC

svn commit: r1089995 - in /qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src: Address.cpp Address.h Connection.cpp Connection.h Message.cpp Message.h Receiver.cpp Receiver.h Sender.cpp Sender.h Session.cpp Session.h

Author: chug
Date: Thu Apr  7 20:40:10 2011
New Revision: 1089995

URL: http://svn.apache.org/viewvc?rev=1089995&view=rev
Log:
QPID-3192 .NET Binding for Messaging classes are missing intrinsic copy constructors.

The existing 'T(const T ^)' constructor is useful for C# code but fails for Cpp/clr.
This commit adds the 'T(const T %)' intrinsic copy constructor for Cpp/clr.

Modified:
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp Thu Apr  7 20:40:10 2011
@@ -141,7 +141,7 @@ namespace Messaging {
 		}
     }
 
-    // copy constructor
+    // Copy constructor look-alike (C#)
     Address::Address(const Address ^ address)
     {
         System::Exception ^ newException = nullptr;
@@ -163,6 +163,28 @@ namespace Messaging {
 		}
     }
 
+    // Copy constructor implicitly dereferenced (C++)
+    Address::Address(const Address % address)
+    {
+        System::Exception ^ newException = nullptr;
+
+        try 
+		{
+            addressp = new ::qpid::messaging::Address(
+                        *(const_cast<Address %>(address).NativeAddress));
+        } 
+        catch (const ::qpid::types::Exception & error) 
+		{
+            String ^ errmsg = gcnew String(error.what());
+            newException    = gcnew QpidException(errmsg);
+        }
+
+		if (newException != nullptr) 
+		{
+	        throw newException;
+		}
+    }
+
     // unmanaged clone
     Address::Address(const ::qpid::messaging::Address & addrp)
     {

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h Thu Apr  7 20:40:10 2011
@@ -64,6 +64,7 @@ namespace Messaging {
 
         // copy constructor
         Address(const Address ^ address);
+        Address(const Address % address);
 
         // unmanaged clone
         Address(const ::qpid::messaging::Address & addrp);

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp Thu Apr  7 20:40:10 2011
@@ -114,7 +114,7 @@ namespace Messaging {
     }
 
 
-    // Copy constructor
+    // Copy constructor look-alike (C#)
     Connection::Connection(const Connection ^ connection)
     {
         System::Exception ^ newException = nullptr;
@@ -136,6 +136,28 @@ namespace Messaging {
 		}
     }
 
+    // Copy constructor implicitly dereferenced (C++)
+    Connection::Connection(const Connection % connection)
+    {
+        System::Exception ^ newException = nullptr;
+
+        try 
+		{
+            connectionp = new ::qpid::messaging::Connection(
+                        *(const_cast<Connection %>(connection).NativeConnection));
+        } 
+        catch (const ::qpid::types::Exception & error) 
+		{
+            String ^ errmsg = gcnew String(error.what());
+            newException    = gcnew QpidException(errmsg);
+        }
+
+		if (newException != nullptr) 
+		{
+	        throw newException;
+		}
+    }
+
 
     // Destructor
     Connection::~Connection()

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h Thu Apr  7 20:40:10 2011
@@ -56,6 +56,7 @@ namespace Messaging {
 
         // copy constructor
         Connection(const Connection ^ connection);
+        Connection(const Connection % connection);
 
 		// unmanaged clone
 		// not defined

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp Thu Apr  7 20:40:10 2011
@@ -235,7 +235,7 @@ namespace Messaging {
         }
     }
 
-    // Copy constructor
+    // Copy constructor look-alike (C#)
     Message::Message(const Message ^ message)
     {
         System::Exception ^ newException = nullptr;
@@ -257,7 +257,29 @@ namespace Messaging {
 		}
     }
 
-	// Property
+    // Copy constructor implicitly dereferenced (C++)
+    Message::Message(const Message % message)
+    {
+        System::Exception ^ newException = nullptr;
+
+        try 
+		{
+            messagep = new ::qpid::messaging::Message(
+                        *(const_cast<Message %>(message).NativeMessage));
+        } 
+        catch (const ::qpid::types::Exception & error) 
+		{
+            String ^ errmsg = gcnew String(error.what());
+            newException    = gcnew QpidException(errmsg);
+        }
+
+		if (newException != nullptr) 
+		{
+	        throw newException;
+		}
+    }
+
+    // Property
     void Message::SetProperty(System::String ^ name, System::Object ^ value)
     {
         System::Exception ^ newException = nullptr;

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h Thu Apr  7 20:40:10 2011
@@ -71,6 +71,7 @@ namespace Messaging {
 
         // Copy constructor
         Message(const Message ^ message);
+        Message(const Message % message);
 
 	    // unmanaged clone
         Message(const ::qpid::messaging::Message & msgp);

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp Thu Apr  7 20:40:10 2011
@@ -89,7 +89,7 @@ namespace Messaging {
     }
 
 
-    // Copy constructor
+    // Copy constructor look-alike (C#)
     Receiver::Receiver(const Receiver ^ receiver) :
         parentSession(receiver->parentSession)
     {
@@ -112,6 +112,29 @@ namespace Messaging {
 		}
     }
 
+    // Copy constructor implicitly dereferenced (C++)
+    Receiver::Receiver(const Receiver % receiver) :
+        parentSession(receiver.parentSession)
+    {
+        System::Exception ^ newException = nullptr;
+
+        try 
+		{
+            receiverp = new ::qpid::messaging::Receiver(
+                        *(const_cast<Receiver %>(receiver).NativeReceiver));
+        } 
+        catch (const ::qpid::types::Exception & error) 
+		{
+            String ^ errmsg = gcnew String(error.what());
+            newException    = gcnew QpidException(errmsg);
+        }
+
+		if (newException != nullptr) 
+		{
+	        throw newException;
+		}
+    }
+
 
     //
     // Get(message)

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h Thu Apr  7 20:40:10 2011
@@ -65,6 +65,7 @@ namespace Messaging {
 
         // copy constructor
         Receiver(const Receiver ^ receiver);
+        Receiver(const Receiver % receiver);
 
         // unmanaged clone
         // undefined

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp Thu Apr  7 20:40:10 2011
@@ -84,7 +84,7 @@ namespace Messaging {
     }
 
 
-    // Copy constructor
+    // Copy constructor look-alike (C#)
     Sender::Sender(const Sender ^ sender)
         : parentSession(sender->parentSession)
     {
@@ -107,6 +107,29 @@ namespace Messaging {
 		}
     }
 
+    // Copy constructor implicitly dereferenced (C++)
+    Sender::Sender(const Sender % sender)
+        : parentSession(sender.parentSession)
+    {
+        System::Exception ^ newException = nullptr;
+
+        try 
+		{
+            senderp = new ::qpid::messaging::Sender(
+                        *(const_cast<Sender %>(sender).NativeSender));
+        } 
+        catch (const ::qpid::types::Exception & error) 
+		{
+            String ^ errmsg = gcnew String(error.what());
+            newException    = gcnew QpidException(errmsg);
+        }
+
+		if (newException != nullptr) 
+		{
+	        throw newException;
+		}
+    }
+
 
     //
     // Send(msg)

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h Thu Apr  7 20:40:10 2011
@@ -62,6 +62,7 @@ namespace Messaging {
         
         // copy constructor
         Sender(const Sender ^ sender);
+        Sender(const Sender % sender);
 
         ~Sender();
         !Sender();

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp Thu Apr  7 20:40:10 2011
@@ -89,7 +89,7 @@ namespace Messaging {
     }
 
 
-    // Copy constructor
+    // Copy constructor look-alike (C#)
     Session::Session(const Session ^ session)
         : parentConnectionp(session->parentConnectionp)
     {
@@ -113,6 +113,30 @@ namespace Messaging {
 		}
     }
 
+    // Copy constructor implicitly dereferenced (C++)
+    Session::Session(const Session % session)
+        : parentConnectionp(session.parentConnectionp)
+    {
+        System::Exception ^ newException = nullptr;
+
+        try 
+		{
+            sessionp = new ::qpid::messaging::Session(
+                        *(const_cast<Session %>(session).NativeSession));
+          
+        } 
+        catch (const ::qpid::types::Exception & error) 
+		{
+            String ^ errmsg = gcnew String(error.what());
+            newException    = gcnew QpidException(errmsg);
+        }
+
+		if (newException != nullptr) 
+		{
+	        throw newException;
+		}
+    }
+
 
     void Session::Close()
     {

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h?rev=1089995&r1=1089994&r2=1089995&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h Thu Apr  7 20:40:10 2011
@@ -69,6 +69,7 @@ namespace Messaging {
 
         // copy constructor
         Session(const Session ^ session);
+        Session(const Session % session);
 
         ~Session();
         !Session();



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org