summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src/Session.cpp
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
commitaba5b6b5ec8afab62f670a540a4ca2d61b76dc22 (patch)
tree75e14a73b5c71707c91d87bd4099e1dc412d1b34 /cpp/bindings/qpid/dotnet/src/Session.cpp
parent459748418ef7f64b62921934fc284840074f066d (diff)
downloadqpid-python-aba5b6b5ec8afab62f670a540a4ca2d61b76dc22.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/qpid@1089995 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src/Session.cpp')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Session.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Session.cpp b/cpp/bindings/qpid/dotnet/src/Session.cpp
index 880331c588..4a6199f108 100644
--- a/cpp/bindings/qpid/dotnet/src/Session.cpp
+++ b/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()
{