summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Address.cpp10
-rw-r--r--cpp/bindings/qpid/dotnet/src/Address.h21
-rw-r--r--cpp/bindings/qpid/dotnet/src/Connection.cpp8
-rw-r--r--cpp/bindings/qpid/dotnet/src/Connection.h34
-rw-r--r--cpp/bindings/qpid/dotnet/src/Duration.h6
-rw-r--r--cpp/bindings/qpid/dotnet/src/Message.cpp6
-rw-r--r--cpp/bindings/qpid/dotnet/src/Message.h21
-rw-r--r--cpp/bindings/qpid/dotnet/src/Receiver.cpp7
-rw-r--r--cpp/bindings/qpid/dotnet/src/Receiver.h22
-rw-r--r--cpp/bindings/qpid/dotnet/src/Sender.cpp8
-rw-r--r--cpp/bindings/qpid/dotnet/src/Sender.h28
-rw-r--r--cpp/bindings/qpid/dotnet/src/Session.cpp9
-rw-r--r--cpp/bindings/qpid/dotnet/src/Session.h26
13 files changed, 183 insertions, 23 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Address.cpp b/cpp/bindings/qpid/dotnet/src/Address.cpp
index 2da40e6416..2b6dbb4647 100644
--- a/cpp/bindings/qpid/dotnet/src/Address.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Address.cpp
@@ -64,7 +64,7 @@ namespace Messaging {
Type = "";
}
-
+ // Create with options and type
Address::Address(System::String ^ name,
System::String ^ subject,
System::Collections::Generic::Dictionary<
@@ -78,8 +78,15 @@ namespace Messaging {
Type = type;
}
+ // Copy constructor
+ Address::Address(const Address ^ address)
+ : addressp(new ::qpid::messaging::Address(
+ *(const_cast<Address ^>(address)->NativeAddress)))
+ {
+ }
// Create from received address
+ // The new Address object consumes the unmanaged pointer
Address::Address(::qpid::messaging::Address * addrp) :
addressp(addrp)
{
@@ -110,7 +117,6 @@ namespace Messaging {
}
}
-
//
// ToString
//
diff --git a/cpp/bindings/qpid/dotnet/src/Address.h b/cpp/bindings/qpid/dotnet/src/Address.h
index 9f940d67ea..1f2c3fe161 100644
--- a/cpp/bindings/qpid/dotnet/src/Address.h
+++ b/cpp/bindings/qpid/dotnet/src/Address.h
@@ -65,12 +65,31 @@ namespace Messaging {
System::String ^, System::Object ^> ^ options,
System::String ^ type);
+ // copy constructor
+ Address(const Address ^ address);
+
// Create from received address
+ // The new Address object consumes the unmanaged pointer
Address(::qpid::messaging::Address * addrp);
~Address();
!Address();
-// Address(const Address % rhs);
+
+ // assignment operator
+ Address % operator=(const Address % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ delete addressp;
+ addressp = new ::qpid::messaging::Address(
+ *(const_cast<Address %>(rhs).NativeAddress) );
+ }
+ return *this;
+ }
property ::qpid::messaging::Address * NativeAddress
{
diff --git a/cpp/bindings/qpid/dotnet/src/Connection.cpp b/cpp/bindings/qpid/dotnet/src/Connection.cpp
index 0e59c4196e..50755302f3 100644
--- a/cpp/bindings/qpid/dotnet/src/Connection.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Connection.cpp
@@ -68,6 +68,14 @@ namespace Messaging {
}
+ // Copy constructor
+ Connection::Connection(const Connection ^ connection)
+ : connectionp(new ::qpid::messaging::Connection(
+ *(const_cast<Connection ^>(connection)->NativeConnection)))
+ {
+ }
+
+
// Destructor
Connection::~Connection()
{
diff --git a/cpp/bindings/qpid/dotnet/src/Connection.h b/cpp/bindings/qpid/dotnet/src/Connection.h
index 8e0f40f803..6a0caf1a16 100644
--- a/cpp/bindings/qpid/dotnet/src/Connection.h
+++ b/cpp/bindings/qpid/dotnet/src/Connection.h
@@ -56,9 +56,43 @@ namespace Messaging {
System::String ^, System::Object ^> ^ options);
Connection(System::String ^ url, System::String ^ options);
+
+ // copy constructor
+ Connection(const Connection ^ connection);
+
~Connection();
!Connection();
+ // assignment operator
+ Connection % operator=(const Connection % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ delete connectionp;
+ connectionp = new ::qpid::messaging::Connection(
+ *(const_cast<Connection %>(rhs).NativeConnection) );
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Connection * NativeConnection
+ {
+ ::qpid::messaging::Connection * get () { return connectionp; }
+ }
+
+ property System::String ^ NPAddress
+ {
+ System::String ^ get ()
+ {
+ System::IntPtr i((void *)connectionp);
+ return gcnew System::String(i.ToString());
+ }
+ }
+
void SetOption(System::String ^ name, System::Object ^ value);
void Open();
diff --git a/cpp/bindings/qpid/dotnet/src/Duration.h b/cpp/bindings/qpid/dotnet/src/Duration.h
index 8bbfa561f0..213c338a59 100644
--- a/cpp/bindings/qpid/dotnet/src/Duration.h
+++ b/cpp/bindings/qpid/dotnet/src/Duration.h
@@ -45,13 +45,13 @@ namespace Messaging {
Duration(const Duration % rhs) :
milliseconds(rhs.milliseconds)
{
- };
+ }
explicit Duration(System::UInt64 mS) :
- milliseconds(mS) {};
+ milliseconds(mS) {}
Duration() :
- milliseconds(System::UInt64::MaxValue) {};
+ milliseconds(System::UInt64::MaxValue) {}
property System::UInt64 Milliseconds
{
diff --git a/cpp/bindings/qpid/dotnet/src/Message.cpp b/cpp/bindings/qpid/dotnet/src/Message.cpp
index f620a099ca..def3051d75 100644
--- a/cpp/bindings/qpid/dotnet/src/Message.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Message.cpp
@@ -141,10 +141,10 @@ namespace Messaging {
}
// Copy constructor
- // TODO: prevent copy
- Message::Message(const Message % rhs)
+ Message::Message(const Message ^ message)
+ : messagep(new ::qpid::messaging::Message(
+ *(const_cast<Message ^>(message)->NativeMessage)))
{
- messagep = rhs.messagep;
}
// Destroys kept object
diff --git a/cpp/bindings/qpid/dotnet/src/Message.h b/cpp/bindings/qpid/dotnet/src/Message.h
index d5b4beb406..c7f6092a40 100644
--- a/cpp/bindings/qpid/dotnet/src/Message.h
+++ b/cpp/bindings/qpid/dotnet/src/Message.h
@@ -76,8 +76,27 @@ namespace Messaging {
!Message();
// Copy constructor
- Message(const Message % rhs);
+ Message(const Message ^ message);
+ // assignment operator
+ Message % operator=(const Message % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ delete messagep;
+ messagep = new ::qpid::messaging::Message(
+ *(const_cast<Message %>(rhs).NativeMessage) );
+ }
+ return *this;
+ }
+
+ //
+ // NativeMessage
+ //
property ::qpid::messaging::Message * NativeMessage
{
::qpid::messaging::Message * get () { return messagep; }
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
index 96df8cc53d..1e2f30d996 100644
--- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -66,10 +66,11 @@ namespace Messaging {
// Copy constructor
- Receiver::Receiver(const Receiver ^ rhs)
+ Receiver::Receiver(const Receiver ^ receiver)
+ : receiverp(new ::qpid::messaging::Receiver(
+ *(const_cast<Receiver ^>(receiver)->NativeReceiver))),
+ parentSession(receiver->parentSession)
{
- receiverp = rhs->receiverp;
- parentSession = rhs->parentSession;
}
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.h b/cpp/bindings/qpid/dotnet/src/Receiver.h
index 436f3f2668..68cfa6fec7 100644
--- a/cpp/bindings/qpid/dotnet/src/Receiver.h
+++ b/cpp/bindings/qpid/dotnet/src/Receiver.h
@@ -63,9 +63,29 @@ namespace Messaging {
public:
Receiver(::qpid::messaging::Receiver * r,
Session ^ sessRef);
+
+ // copy constructor
+ Receiver(const Receiver ^ receiver);
+
~Receiver();
!Receiver();
- Receiver(const Receiver ^ rhs);
+
+ // assignment operator
+ Receiver % operator=(const Receiver % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ delete receiverp;
+ receiverp = new ::qpid::messaging::Receiver(
+ *(const_cast<Receiver %>(rhs).NativeReceiver));
+ parentSession = rhs.parentSession;
+ }
+ return *this;
+ }
property ::qpid::messaging::Receiver * NativeReceiver
{
diff --git a/cpp/bindings/qpid/dotnet/src/Sender.cpp b/cpp/bindings/qpid/dotnet/src/Sender.cpp
index 0d394f8ef9..bcc2407841 100644
--- a/cpp/bindings/qpid/dotnet/src/Sender.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Sender.cpp
@@ -61,12 +61,14 @@ namespace Messaging {
}
// Copy constructor
- Sender::Sender(const Sender % rhs)
+ Sender::Sender(const Sender ^ sender)
+ : senderp(new ::qpid::messaging::Sender(
+ *(const_cast<Sender ^>(sender)->NativeSender))),
+ parentSession(sender->parentSession)
{
- senderp = rhs.senderp;
- parentSession = rhs.parentSession;
}
+
// Destroys kept object
// TODO: add lock
void Sender::Cleanup()
diff --git a/cpp/bindings/qpid/dotnet/src/Sender.h b/cpp/bindings/qpid/dotnet/src/Sender.h
index de114ab2f1..670f11fe30 100644
--- a/cpp/bindings/qpid/dotnet/src/Sender.h
+++ b/cpp/bindings/qpid/dotnet/src/Sender.h
@@ -61,9 +61,35 @@ namespace Messaging {
public:
Sender(::qpid::messaging::Sender * s,
Session ^ sessRef);
+
+ // copy constructor
+ Sender(const Sender ^ sender);
+
~Sender();
!Sender();
- Sender(const Sender % rhs);
+
+ // assignment operator
+ Sender % operator=(const Sender % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ delete senderp;
+ senderp = new ::qpid::messaging::Sender(
+ *(const_cast<Sender %>(rhs).NativeSender));
+ parentSession = rhs.parentSession;
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Sender * NativeSender
+ {
+ ::qpid::messaging::Sender * get () { return senderp; }
+ }
+
// Send(message)
void Send(Message ^ mmsgp);
diff --git a/cpp/bindings/qpid/dotnet/src/Session.cpp b/cpp/bindings/qpid/dotnet/src/Session.cpp
index bafc9b3c76..438c9c4d00 100644
--- a/cpp/bindings/qpid/dotnet/src/Session.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Session.cpp
@@ -67,11 +67,12 @@ namespace Messaging {
Cleanup();
}
- // copy constructor
- Session::Session(const Session % rhs)
+ // Copy constructor
+ Session::Session(const Session ^ session)
+ : sessionp(new ::qpid::messaging::Session(
+ *(const_cast<Session ^>(session)->NativeSession))),
+ parentConnectionp(session->parentConnectionp)
{
- sessionp = rhs.sessionp;
- parentConnectionp = rhs.parentConnectionp;
}
diff --git a/cpp/bindings/qpid/dotnet/src/Session.h b/cpp/bindings/qpid/dotnet/src/Session.h
index a5affc67b6..e07725247b 100644
--- a/cpp/bindings/qpid/dotnet/src/Session.h
+++ b/cpp/bindings/qpid/dotnet/src/Session.h
@@ -67,9 +67,33 @@ namespace Messaging {
public:
Session(::qpid::messaging::Session * sessionp,
Connection ^ connRef);
+
+ // copy constructor
+ Session(const Session ^ session);
+
~Session();
!Session();
- Session(const Session % rhs);
+
+ // assignment operator
+ Session % operator=(const Session % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ delete sessionp;
+ sessionp = new ::qpid::messaging::Session(
+ *(const_cast<Session %>(rhs).NativeSession) );
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Session * NativeSession
+ {
+ ::qpid::messaging::Session * get () { return sessionp; }
+ }
void Close();
void Commit();