summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2011-04-07 20:40:10 +0000
committerCharles E. Rolke <chug@apache.org>2011-04-07 20:40:10 +0000
commitf2c8742b00581c787eb937d7484e6086153cb21a (patch)
treeaa1ede1fc767cf20a3b455a2e167ca64d12e7dc8
parent9b29e21052f718e6f80fd35b32e9d06bd327cb07 (diff)
downloadqpid-python-f2c8742b00581c787eb937d7484e6086153cb21a.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1089995 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Address.cpp24
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Address.h1
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp24
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Connection.h1
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Message.cpp26
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Message.h1
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp25
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Receiver.h1
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp25
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Sender.h1
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Session.cpp26
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Session.h1
12 files changed, 149 insertions, 7 deletions
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
index b688d973ed..79a8021d9a 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
@@ -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)
{
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Address.h b/qpid/cpp/bindings/qpid/dotnet/src/Address.h
index e5a00d8f11..8bbc207d4e 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Address.h
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Address.h
@@ -64,6 +64,7 @@ namespace Messaging {
// copy constructor
Address(const Address ^ address);
+ Address(const Address % address);
// unmanaged clone
Address(const ::qpid::messaging::Address & addrp);
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
index 69ace7db52..12c0e29f74 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
@@ -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()
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Connection.h b/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
index f9b62d4a08..0788f5d225 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
@@ -56,6 +56,7 @@ namespace Messaging {
// copy constructor
Connection(const Connection ^ connection);
+ Connection(const Connection % connection);
// unmanaged clone
// not defined
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
index fe7825134d..e5dbf845b3 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
@@ -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;
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Message.h b/qpid/cpp/bindings/qpid/dotnet/src/Message.h
index b92cc4200b..ac7f285fe5 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Message.h
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.h
@@ -71,6 +71,7 @@ namespace Messaging {
// Copy constructor
Message(const Message ^ message);
+ Message(const Message % message);
// unmanaged clone
Message(const ::qpid::messaging::Message & msgp);
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
index 3c0d79b393..8aa77effbd 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -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)
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
index e9912a61dd..8ddcc9ac01 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
@@ -65,6 +65,7 @@ namespace Messaging {
// copy constructor
Receiver(const Receiver ^ receiver);
+ Receiver(const Receiver % receiver);
// unmanaged clone
// undefined
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
index 584075ef5f..3225f1a6e1 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
@@ -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)
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Sender.h b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
index 0e90a9f4a4..4054e87316 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
@@ -62,6 +62,7 @@ namespace Messaging {
// copy constructor
Sender(const Sender ^ sender);
+ Sender(const Sender % sender);
~Sender();
!Sender();
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
index 880331c588..4a6199f108 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
@@ -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()
{
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Session.h b/qpid/cpp/bindings/qpid/dotnet/src/Session.h
index 7eaad8a0a5..4d4cad75c4 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Session.h
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Session.h
@@ -69,6 +69,7 @@ namespace Messaging {
// copy constructor
Session(const Session ^ session);
+ Session(const Session % session);
~Session();
!Session();