From f83677056891e436bf5ba99e79240df2a44528cd Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Fri, 21 Oct 2011 14:42:12 +0000 Subject: Merged out from trunk git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1187375 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qpid/dotnet/src/Address.cpp | 24 +++++++++++- cpp/bindings/qpid/dotnet/src/Address.h | 1 + cpp/bindings/qpid/dotnet/src/Connection.cpp | 24 +++++++++++- cpp/bindings/qpid/dotnet/src/Connection.h | 1 + cpp/bindings/qpid/dotnet/src/Duration.h | 12 +++++- cpp/bindings/qpid/dotnet/src/FailoverUpdates.h | 1 + cpp/bindings/qpid/dotnet/src/Message.cpp | 26 ++++++++++++- cpp/bindings/qpid/dotnet/src/Message.h | 1 + cpp/bindings/qpid/dotnet/src/Receiver.cpp | 25 ++++++++++++- cpp/bindings/qpid/dotnet/src/Receiver.h | 1 + cpp/bindings/qpid/dotnet/src/Sender.cpp | 25 ++++++++++++- cpp/bindings/qpid/dotnet/src/Sender.h | 1 + cpp/bindings/qpid/dotnet/src/Session.cpp | 51 +++++++++++++++++++++++++- cpp/bindings/qpid/dotnet/src/Session.h | 3 ++ 14 files changed, 188 insertions(+), 8 deletions(-) (limited to 'cpp/bindings/qpid/dotnet/src') diff --git a/cpp/bindings/qpid/dotnet/src/Address.cpp b/cpp/bindings/qpid/dotnet/src/Address.cpp index b688d973ed..79a8021d9a 100644 --- a/cpp/bindings/qpid/dotnet/src/Address.cpp +++ b/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).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/cpp/bindings/qpid/dotnet/src/Address.h b/cpp/bindings/qpid/dotnet/src/Address.h index e5a00d8f11..8bbc207d4e 100644 --- a/cpp/bindings/qpid/dotnet/src/Address.h +++ b/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/cpp/bindings/qpid/dotnet/src/Connection.cpp b/cpp/bindings/qpid/dotnet/src/Connection.cpp index 69ace7db52..12c0e29f74 100644 --- a/cpp/bindings/qpid/dotnet/src/Connection.cpp +++ b/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).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/cpp/bindings/qpid/dotnet/src/Connection.h b/cpp/bindings/qpid/dotnet/src/Connection.h index f9b62d4a08..0788f5d225 100644 --- a/cpp/bindings/qpid/dotnet/src/Connection.h +++ b/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/cpp/bindings/qpid/dotnet/src/Duration.h b/cpp/bindings/qpid/dotnet/src/Duration.h index 213c338a59..d4239fae88 100644 --- a/cpp/bindings/qpid/dotnet/src/Duration.h +++ b/cpp/bindings/qpid/dotnet/src/Duration.h @@ -81,7 +81,17 @@ namespace Messaging { Duration ^ result = gcnew Duration(multiplier * dur->Milliseconds); return result; } - }; + + static bool operator == (Duration ^ a, Duration ^ b) + { + return a->Milliseconds == b->Milliseconds; + } + + static bool operator != (Duration ^ a, Duration ^ b) + { + return a->Milliseconds != b->Milliseconds; + } +}; public ref class DurationConstants sealed { diff --git a/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h b/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h index 1dd92b8688..d82e276fc8 100644 --- a/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h +++ b/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h @@ -54,6 +54,7 @@ namespace Messaging { // copy constructor FailoverUpdates(const FailoverUpdates ^ failoverUpdates) {} + FailoverUpdates(const FailoverUpdates % failoverUpdates) {} // assignment operator FailoverUpdates % operator=(const FailoverUpdates % rhs) diff --git a/cpp/bindings/qpid/dotnet/src/Message.cpp b/cpp/bindings/qpid/dotnet/src/Message.cpp index fe7825134d..e5dbf845b3 100644 --- a/cpp/bindings/qpid/dotnet/src/Message.cpp +++ b/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).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/cpp/bindings/qpid/dotnet/src/Message.h b/cpp/bindings/qpid/dotnet/src/Message.h index b92cc4200b..ac7f285fe5 100644 --- a/cpp/bindings/qpid/dotnet/src/Message.h +++ b/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/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp index 3c0d79b393..8aa77effbd 100644 --- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp +++ b/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).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/cpp/bindings/qpid/dotnet/src/Receiver.h b/cpp/bindings/qpid/dotnet/src/Receiver.h index e9912a61dd..8ddcc9ac01 100644 --- a/cpp/bindings/qpid/dotnet/src/Receiver.h +++ b/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/cpp/bindings/qpid/dotnet/src/Sender.cpp b/cpp/bindings/qpid/dotnet/src/Sender.cpp index 584075ef5f..3225f1a6e1 100644 --- a/cpp/bindings/qpid/dotnet/src/Sender.cpp +++ b/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).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/cpp/bindings/qpid/dotnet/src/Sender.h b/cpp/bindings/qpid/dotnet/src/Sender.h index 0e90a9f4a4..4054e87316 100644 --- a/cpp/bindings/qpid/dotnet/src/Sender.h +++ b/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/cpp/bindings/qpid/dotnet/src/Session.cpp b/cpp/bindings/qpid/dotnet/src/Session.cpp index 880331c588..0e918769a3 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).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() { @@ -224,6 +248,31 @@ namespace Messaging { } } + void Session::AcknowledgeUpTo(Message ^ message) + { + AcknowledgeUpTo(message, false); + } + + void Session::AcknowledgeUpTo(Message ^ message, bool sync) + { + System::Exception ^ newException = nullptr; + + try + { + sessionp->acknowledgeUpTo(*(message->NativeMessage), sync); + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + + if (newException != nullptr) + { + throw newException; + } + } + void Session::Reject(Message ^ message) { System::Exception ^ newException = nullptr; diff --git a/cpp/bindings/qpid/dotnet/src/Session.h b/cpp/bindings/qpid/dotnet/src/Session.h index 7eaad8a0a5..4b98a37f18 100644 --- a/cpp/bindings/qpid/dotnet/src/Session.h +++ b/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(); @@ -103,6 +104,8 @@ namespace Messaging { void Acknowledge(bool sync); void Acknowledge(Message ^ message); void Acknowledge(Message ^ message, bool sync); + void AcknowledgeUpTo(Message ^ message); + void AcknowledgeUpTo(Message ^ message, bool sync); void Reject(Message ^); void Release(Message ^); void Sync(); -- cgit v1.2.1