diff options
| author | Ted Ross <tross@apache.org> | 2010-06-25 17:55:46 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2010-06-25 17:55:46 +0000 |
| commit | cff7dc046568b207c9a08dea221427c54706c747 (patch) | |
| tree | 95e7d49125ad4d552a1be163352fd4e04f62152a /cpp/bindings/qpid/dotnet/src | |
| parent | c3a6e87c3f21009135b5826de6917586477e0589 (diff) | |
| download | qpid-python-cff7dc046568b207c9a08dea221427c54706c747.tar.gz | |
QPID-2589 - Patch from Chuck Rolke
* Convert c-style Get() functions to c#-style properties.
* Add powershell helloworld example.
* Fix message SetContent to accept byte array or byte array slice.
* Re-code Session GetReceiver and GetSender not to malloc new objects but to create the objects on the stack.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@958052 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src')
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Address.cpp | 81 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Address.h | 90 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Connection.cpp | 5 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Connection.h | 9 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Message.cpp | 194 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Message.h | 254 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Receiver.cpp | 32 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Receiver.h | 66 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Sender.cpp | 7 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Sender.h | 11 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Session.cpp | 22 | ||||
| -rw-r--r-- | cpp/bindings/qpid/dotnet/src/Session.h | 9 |
12 files changed, 426 insertions, 354 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Address.cpp b/cpp/bindings/qpid/dotnet/src/Address.cpp index f0bbe13bbb..2da40e6416 100644 --- a/cpp/bindings/qpid/dotnet/src/Address.cpp +++ b/cpp/bindings/qpid/dotnet/src/Address.cpp @@ -58,10 +58,10 @@ namespace Messaging { System::String ^, System::Object ^> ^ options) :
addressp(new ::qpid::messaging::Address())
{
- SetName(name);
- SetSubject(subject);
- SetOptions(options);
- SetType("");
+ Name = name;
+ Subject = subject;
+ Options = options;
+ Type = "";
}
@@ -72,10 +72,10 @@ namespace Messaging { System::String ^ type) :
addressp(new ::qpid::messaging::Address())
{
- SetName(name);
- SetSubject(subject);
- SetOptions(options);
- SetType(type);
+ Name = name;
+ Subject = subject;
+ Options = options;
+ Type = type;
}
@@ -112,71 +112,6 @@ namespace Messaging { //
- // name
- //
- System::String ^ Address::GetName()
- {
- return gcnew System::String(addressp->getName().c_str());
- }
-
- void Address::SetName(System::String ^ name)
- {
- addressp->::qpid::messaging::Address::setName(QpidMarshal::ToNative(name));
- }
-
- //
- // subject
- //
- System::String ^ Address::GetSubject()
- {
- return gcnew System::String(addressp->getSubject().c_str());
- }
-
- void Address::SetSubject(System::String ^ subject)
- {
- addressp->setSubject(QpidMarshal::ToNative(subject));
- }
-
- //
- // options
- //
- System::Collections::Generic::Dictionary<
- System::String ^, System::Object ^> ^ Address::GetOptions()
- {
- ::qpid::types::Variant::Map map;
- System::Collections::Generic::Dictionary<
- System::String ^, System::Object ^> ^ newMap =
- gcnew System::Collections::Generic::Dictionary<
- System::String ^, System::Object ^>;
- map = addressp->getOptions();
- TypeTranslator::NativeToManaged(map, newMap);
- return newMap;
- }
-
-
- void Address::SetOptions(System::Collections::Generic::Dictionary<
- System::String ^, System::Object ^> ^ options)
- {
- ::qpid::types::Variant::Map map;
- TypeTranslator::ManagedToNative(options, map);
- addressp->setOptions(map);
- }
-
- //
- // type
- //
- System::String ^ Address::GetType()
- {
- return gcnew System::String(addressp->getType().c_str());
- }
-
-
- void Address::SetType(System::String ^ type)
- {
- addressp->setName(QpidMarshal::ToNative(type));
- }
-
- //
// ToString
//
System::String ^ Address::ToStr()
diff --git a/cpp/bindings/qpid/dotnet/src/Address.h b/cpp/bindings/qpid/dotnet/src/Address.h index 60e24da2f0..9f940d67ea 100644 --- a/cpp/bindings/qpid/dotnet/src/Address.h +++ b/cpp/bindings/qpid/dotnet/src/Address.h @@ -27,6 +27,10 @@ #include "qpid/messaging/Address.h"
+#include "QpidMarshal.h"
+#include "QpidTypeCheck.h"
+#include "TypeTranslator.h"
+
namespace Org {
namespace Apache {
namespace Qpid {
@@ -73,20 +77,86 @@ namespace Messaging { ::qpid::messaging::Address * get () { return addressp; }
}
- System::String ^ GetName();
- void SetName(System::String ^ name);
+ //
+ // name
+ //
+ property System::String ^ Name
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(addressp->getName().c_str());
+ }
+
+ void set (System::String ^ name)
+ {
+ addressp->::qpid::messaging::Address::setName(QpidMarshal::ToNative(name));
+ }
+ }
+
+
+ //
+ // subject
+ //
+ property System::String ^ Subject
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(addressp->getSubject().c_str());
+ }
+
+ void set (System::String ^ subject)
+ {
+ addressp->setSubject(QpidMarshal::ToNative(subject));
+ }
+ }
+
- System::String ^ GetSubject();
- void SetSubject(System::String ^ subject);
+ //
+ // options
+ //
+ property System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ Options
+ {
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ get ()
+ {
+ ::qpid::types::Variant::Map map;
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ newMap =
+ gcnew System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^>;
+ map = addressp->getOptions();
+ TypeTranslator::NativeToManaged(map, newMap);
+ return newMap;
+ }
+
+
+ void set (System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options)
+ {
+ ::qpid::types::Variant::Map map;
+ TypeTranslator::ManagedToNative(options, map);
+ addressp->setOptions(map);
+ }
+ }
- System::Collections::Generic::Dictionary<
- System::String ^, System::Object ^> ^ GetOptions();
- void SetOptions(System::Collections::Generic::Dictionary<
- System::String ^, System::Object ^> ^ options);
+ //
+ // type
+ //
+ property System::String ^ Type
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(addressp->getType().c_str());
+ }
+
- System::String ^ GetType();
- void SetType(System::String ^ type);
+ void set (System::String ^ type)
+ {
+ addressp->setName(QpidMarshal::ToNative(type));
+ }
+ }
System::String ^ ToStr();
};
diff --git a/cpp/bindings/qpid/dotnet/src/Connection.cpp b/cpp/bindings/qpid/dotnet/src/Connection.cpp index 590cc5e69a..0e59c4196e 100644 --- a/cpp/bindings/qpid/dotnet/src/Connection.cpp +++ b/cpp/bindings/qpid/dotnet/src/Connection.cpp @@ -107,11 +107,6 @@ namespace Messaging { connectionp->open();
}
- System::Boolean Connection::IsOpen()
- {
- return connectionp->isOpen();
- }
-
void Connection::Close()
{
connectionp->close();
diff --git a/cpp/bindings/qpid/dotnet/src/Connection.h b/cpp/bindings/qpid/dotnet/src/Connection.h index e93e0781f3..8e0f40f803 100644 --- a/cpp/bindings/qpid/dotnet/src/Connection.h +++ b/cpp/bindings/qpid/dotnet/src/Connection.h @@ -62,9 +62,16 @@ namespace Messaging { void SetOption(System::String ^ name, System::Object ^ value);
void Open();
- System::Boolean IsOpen();
void Close();
+ property System::Boolean IsOpen
+ {
+ System::Boolean get ()
+ {
+ return connectionp->isOpen();
+ }
+ }
+
// CreateTransactionalSession()
Session ^ CreateTransactionalSession();
Session ^ CreateTransactionalSession(System::String ^ name);
diff --git a/cpp/bindings/qpid/dotnet/src/Message.cpp b/cpp/bindings/qpid/dotnet/src/Message.cpp index 743afce964..f620a099ca 100644 --- a/cpp/bindings/qpid/dotnet/src/Message.cpp +++ b/cpp/bindings/qpid/dotnet/src/Message.cpp @@ -158,190 +158,36 @@ namespace Messaging { }
}
-
- //
- // ReplyTo
- //
- void Message::SetReplyTo(Address ^ address)
- {
- messagep->setReplyTo(*(address->NativeAddress));
- }
-
- Address ^ Message::GetReplyTo()
- {
- const ::qpid::messaging::Address & addrp =
- messagep->::qpid::messaging::Message::getReplyTo();
-
- return gcnew Address(const_cast<::qpid::messaging::Address *>(&addrp));
- }
-
-
- //
- // Subject
- //
- void Message::SetSubject(System::String ^ subject)
- {
- messagep->setSubject(QpidMarshal::ToNative(subject));
- }
-
- System::String ^ Message::GetSubject()
- {
- return gcnew String(messagep->getSubject().c_str());
- }
-
-
- //
- // ContentType
- //
- void Message::SetContentType(System::String ^ ct)
- {
- messagep->setContentType(QpidMarshal::ToNative(ct));
- }
-
- System::String ^ Message::GetContentType()
- {
- return gcnew String(messagep->::qpid::messaging::Message::getContentType().c_str());
- }
-
-
- //
- // MessageId
- //
- void Message::SetMessageId(System::String ^ messageId)
- {
- messagep->setMessageId(QpidMarshal::ToNative(messageId));
- }
-
- System::String ^ Message::GetMessageId()
- {
- return gcnew String(messagep->getMessageId().c_str());
- }
-
-
- //
- // UserId
- //
- void Message::SetUserId(System::String ^ uId)
- {
- messagep->setUserId(QpidMarshal::ToNative(uId));
- }
-
- System::String ^ Message::GetUserId()
- {
- return gcnew String(messagep->getUserId().c_str());
- }
-
-
- //
- // CorrelationId
- //
- void Message::SetCorrelationId(System::String ^ correlationId)
- {
- messagep->setCorrelationId(QpidMarshal::ToNative(correlationId));
- }
-
- System::String ^ Message::GetCorrelationId()
- {
- return gcnew String(messagep->getCorrelationId().c_str());
- }
-
-
- //
- // Priority
- //
- void Message::SetPriority(unsigned char priority)
- {
- messagep->setPriority(priority);
- }
-
- unsigned char Message::GetPriority()
- {
- return messagep->getPriority();
- }
-
-
- //
- // Ttl
- //
- void Message::SetTtl(Duration ^ ttl)
- {
- ::qpid::messaging::Duration dur(ttl->Milliseconds);
-
- messagep->setTtl(dur);
- }
-
- Duration ^ Message::GetTtl()
+ // Property
+ void Message::SetProperty(System::String ^ name, System::Object ^ value)
{
- Duration ^ dur = gcnew Duration(messagep->getTtl().getMilliseconds());
+ ::qpid::types::Variant entryValue;
+ TypeTranslator::ManagedToNativeObject(value, entryValue);
- return dur;
+ messagep->getProperties()[QpidMarshal::ToNative(name)] = entryValue;
}
- void Message::SetDurable(bool durable)
- {
- messagep->setDurable(durable);
- }
-
- bool Message::GetDurable()
+ // Content
+ void Message::SetContent(System::String ^ content)
{
- return messagep->getDurable();
+ messagep->setContent(QpidMarshal::ToNative(content));
}
- bool Message::GetRedelivered()
+ void Message::SetContent(cli::array<System::Byte> ^ bytes)
{
- return messagep->getRedelivered();
+ pin_ptr<unsigned char> pBytes = &bytes[0];
+ messagep->setContent((char *)pBytes, bytes->Length);
}
- void Message::SetRedelivered(bool redelivered)
- {
- messagep->setRedelivered(redelivered);
- }
- // Properties
- System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ^ Message::GetProperties()
+ void Message::SetContent(cli::array<System::Byte> ^ bytes, int offset, int size)
{
- ::qpid::types::Variant::Map map;
-
- map = messagep->getProperties();
-
- System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ^ dict =
- gcnew System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ;
-
- TypeTranslator::NativeToManaged(map, dict);
-
- return dict;
- }
-
-
- void Message::SetProperty(System::String ^ name, System::Object ^ value)
- {
- ::qpid::types::Variant entryValue;
- TypeTranslator::ManagedToNativeObject(value, entryValue);
-
- messagep->getProperties()[QpidMarshal::ToNative(name)] = entryValue;
- }
-
-
- void Message::SetProperties(System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ^ properties)
- {
- for each (System::Collections::Generic::KeyValuePair
- <System::String^, System::Object^> kvp in properties)
- {
- SetProperty(kvp.Key, kvp.Value);
- }
- }
-
+ if ((offset + size) > bytes->Length)
+ throw gcnew QpidException("Message::SetContent from byte array slice: buffer length exceeded");
-
- // Content
- void Message::SetContent(System::String ^ content)
- {
- messagep->setContent(QpidMarshal::ToNative(content));
+ pin_ptr<unsigned char> pBytes = &bytes[offset];
+ messagep->setContent((char *)pBytes, size);
}
@@ -388,7 +234,7 @@ namespace Messaging { // On entry message size must not be zero and
// caller's byte array must be equal to message size.
//
- void Message::GetRaw(array<System::Byte> ^ arr)
+ void Message::GetContent(array<System::Byte> ^ arr)
{
System::UInt32 size = messagep->getContentSize();
@@ -404,12 +250,6 @@ namespace Messaging { }
- System::UInt64 Message::GetContentSize()
- {
- return messagep->getContentSize();
- }
-
-
System::String ^ Message::MapAsString(System::Collections::Generic::Dictionary<
System::String^, System::Object^> ^ dict)
{
diff --git a/cpp/bindings/qpid/dotnet/src/Message.h b/cpp/bindings/qpid/dotnet/src/Message.h index 99d0b8667e..d5b4beb406 100644 --- a/cpp/bindings/qpid/dotnet/src/Message.h +++ b/cpp/bindings/qpid/dotnet/src/Message.h @@ -26,6 +26,11 @@ #include "qpid/messaging/Message.h"
+#include "QpidMarshal.h"
+#include "Address.h"
+#include "Duration.h"
+#include "TypeTranslator.h"
+
namespace Org {
namespace Apache {
namespace Qpid {
@@ -78,46 +83,227 @@ namespace Messaging { ::qpid::messaging::Message * get () { return messagep; }
}
- void SetReplyTo(Address ^ address);
- Address ^ GetReplyTo();
+ //
+ // ReplyTo
+ //
+ property Address ^ ReplyTo
+ {
+ void set (Address ^ address)
+ {
+ messagep->setReplyTo(*(address->NativeAddress));
+ }
+
+ Address ^ get ()
+ {
+ const ::qpid::messaging::Address & addrp =
+ messagep->::qpid::messaging::Message::getReplyTo();
+
+ return gcnew Address(const_cast<::qpid::messaging::Address *>(&addrp));
+ }
+ }
+
+ //
+ // Subject
+ //
+ property System::String ^ Subject
+ {
+ void set (System::String ^ subject)
+ {
+ messagep->setSubject(QpidMarshal::ToNative(subject));
+ }
+
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getSubject().c_str());
+ }
+ }
- void SetSubject(System::String ^ subject);
- System::String ^ GetSubject();
- void SetContentType(System::String ^ ct);
- System::String ^ GetContentType();
-
- void SetMessageId(System::String ^ messageId);
- System::String ^ GetMessageId();
-
- void SetUserId(System::String ^ uId);
- System::String ^ GetUserId();
+ //
+ // ContentType
+ //
+ property System::String ^ ContentType
+ {
+ void set (System::String ^ ct)
+ {
+ messagep->setContentType(QpidMarshal::ToNative(ct));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->::qpid::messaging::Message::getContentType().c_str());
+ }
+ }
+
+
+ //
+ // MessageId
+ //
+ property System::String ^ MessageId
+ {
+ void set (System::String ^ messageId)
+ {
+ messagep->setMessageId(QpidMarshal::ToNative(messageId));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getMessageId().c_str());
+ }
+ }
+
- void SetCorrelationId(System::String ^ correlationId);
- System::String ^ GetCorrelationId();
+ //
+ // UserId
+ //
+ property System::String ^ UserId
+ {
+ void set (System::String ^ uId)
+ {
+ messagep->setUserId(QpidMarshal::ToNative(uId));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getUserId().c_str());
+ }
+ }
- void SetPriority(unsigned char priority);
- unsigned char GetPriority();
+
+ //
+ // CorrelationId
+ //
+ property System::String ^ CorrelationId
+ {
+ void set (System::String ^ correlationId)
+ {
+ messagep->setCorrelationId(QpidMarshal::ToNative(correlationId));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getCorrelationId().c_str());
+ }
+ }
- void SetTtl(Duration ^ ttl);
- Duration ^ GetTtl();
- void SetDurable(bool durable);
- bool GetDurable();
+ //
+ // Priority
+ //
+ property unsigned char Priority
+ {
+ void set (unsigned char priority)
+ {
+ messagep->setPriority(priority);
+ }
+
+ unsigned char get ()
+ {
+ return messagep->getPriority();
+ }
+ }
+
+
+ //
+ // Ttl
+ //
+ property Duration ^ Ttl
+ {
+ void set (Duration ^ ttl)
+ {
+ ::qpid::messaging::Duration dur(ttl->Milliseconds);
+
+ messagep->setTtl(dur);
+ }
+
+ Duration ^ get ()
+ {
+ Duration ^ dur = gcnew Duration(messagep->getTtl().getMilliseconds());
+
+ return dur;
+ }
+ }
+
+ //
+ // Durable
+ //
+ property bool Durable
+ {
+ void set (bool durable)
+ {
+ messagep->setDurable(durable);
+ }
+
+ bool get ()
+ {
+ return messagep->getDurable();
+ }
+ }
+
+ //
+ // Redelivered
+ //
+ property bool Redelivered
+ {
+ bool get ()
+ {
+ return messagep->getRedelivered();
+ }
+
+ void set (bool redelivered)
+ {
+ messagep->setRedelivered(redelivered);
+ }
+ }
+
+ //
+ // Property
+ //
+ void Message::SetProperty(System::String ^ name, System::Object ^ value);
+
+ //
+ // Properties
+ //
+ property System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ Properties
+ {
+ System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ get ()
+ {
+ ::qpid::types::Variant::Map map;
- bool GetRedelivered();
- void SetRedelivered(bool redelivered);
+ map = messagep->getProperties();
- System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ^ GetProperties();
+ System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ dict =
+ gcnew System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ;
- void SetProperty(System::String ^ name, System::Object ^ value);
+ TypeTranslator::NativeToManaged(map, dict);
+
+ return dict;
+ }
+
+
+ void set (System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ properties)
+ {
+ for each (System::Collections::Generic::KeyValuePair
+ <System::String^, System::Object^> kvp in properties)
+ {
+ SetProperty(kvp.Key, kvp.Value);
+ }
+ }
+ }
- void SetProperties(System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ^ properties);
void SetContent(System::String ^ content);
+ void SetContent(cli::array<System::Byte> ^ bytes);
+
+ void SetContent(cli::array<System::Byte> ^ bytes, int offset, int size);
+
//TODO:: void setContent(Bytes{} bytes, offset, length);
// get content as string
@@ -133,9 +319,19 @@ namespace Messaging { System::Object^> ^);
// get content as bytes
- void GetRaw(cli::array<System::Byte> ^ arr);
+ void GetContent(cli::array<System::Byte> ^ arr);
+
+ //
+ // ContentSize
+ //
+ property System::UInt64 ContentSize
+ {
+ System::UInt64 get ()
+ {
+ return messagep->getContentSize();
+ }
+ }
- System::UInt64 GetContentSize();
// A message has been returned to managed code through GetContent().
// Display the content of that System::Object as a string.
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/cpp/bindings/qpid/dotnet/src/Receiver.cpp index 15f8572a53..96df8cc53d 100644 --- a/cpp/bindings/qpid/dotnet/src/Receiver.cpp +++ b/cpp/bindings/qpid/dotnet/src/Receiver.cpp @@ -44,7 +44,7 @@ namespace Messaging { /// </summary>
Receiver::Receiver(::qpid::messaging::Receiver * r,
- Session ^ sessRef) :
+ Org::Apache::Qpid::Messaging::Session ^ sessRef) :
receiverp(r),
parentSession(sessRef)
{
@@ -227,38 +227,8 @@ namespace Messaging { return newMessage;
}
- void Receiver::SetCapacity(System::UInt32 capacity)
- {
- receiverp->setCapacity(capacity);
- }
-
- System::UInt32 Receiver::GetCapacity()
- {
- return receiverp->getCapacity();
- }
-
- System::UInt32 Receiver::GetAvailable()
- {
- return receiverp->getAvailable();
- }
-
- System::UInt32 Receiver::GetUnsettled()
- {
- return receiverp->getUnsettled();
- }
-
void Receiver::Close()
{
receiverp->close();
}
-
- System::String ^ Receiver::GetName()
- {
- return gcnew System::String(receiverp->getName().c_str());
- }
-
- Session ^ Receiver::GetSession()
- {
- return parentSession;
- }
}}}}
diff --git a/cpp/bindings/qpid/dotnet/src/Receiver.h b/cpp/bindings/qpid/dotnet/src/Receiver.h index 0dc2f6120f..436f3f2668 100644 --- a/cpp/bindings/qpid/dotnet/src/Receiver.h +++ b/cpp/bindings/qpid/dotnet/src/Receiver.h @@ -88,12 +88,66 @@ namespace Messaging { Message ^ Fetch();
Message ^ Fetch(Duration ^ durationp);
- void SetCapacity(System::UInt32 capacity);
- System::UInt32 GetCapacity();
- System::UInt32 GetAvailable();
- System::UInt32 GetUnsettled();
+ //
+ // Capacity
+ //
+ property System::UInt32 Capacity
+ {
+ void set (System::UInt32 capacity)
+ {
+ receiverp->setCapacity(capacity);
+ }
+
+ System::UInt32 get ()
+ {
+ return receiverp->getCapacity();
+ }
+ }
+
+ //
+ // Available
+ //
+ property System::UInt32 Available
+ {
+ System::UInt32 get ()
+ {
+ return receiverp->getAvailable();
+ }
+ }
+
+ //
+ // Unsettled
+ //
+ property System::UInt32 Unsettled
+ {
+ System::UInt32 get ()
+ {
+ return receiverp->getUnsettled();
+ }
+ }
+
void Close();
- System::String ^ GetName();
- Session ^ GetSession();
+
+ //
+ // Name
+ //
+ property System::String ^ Name
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(receiverp->getName().c_str());
+ }
+ }
+
+ //
+ // Session
+ //
+ property Org::Apache::Qpid::Messaging::Session ^ Session
+ {
+ Org::Apache::Qpid::Messaging::Session ^ get ()
+ {
+ return parentSession;
+ }
+ }
};
}}}}
diff --git a/cpp/bindings/qpid/dotnet/src/Sender.cpp b/cpp/bindings/qpid/dotnet/src/Sender.cpp index e0911b38db..0d394f8ef9 100644 --- a/cpp/bindings/qpid/dotnet/src/Sender.cpp +++ b/cpp/bindings/qpid/dotnet/src/Sender.cpp @@ -40,7 +40,7 @@ namespace Messaging { /// </summary>
Sender::Sender(::qpid::messaging::Sender * s,
- Session ^ sessRef) :
+ Org::Apache::Qpid::Messaging::Session ^ sessRef) :
senderp(s),
parentSession(sessRef)
{
@@ -96,9 +96,4 @@ namespace Messaging { {
senderp->close();
}
-
- Session ^ Sender::GetSession()
- {
- return parentSession;
- }
}}}}
diff --git a/cpp/bindings/qpid/dotnet/src/Sender.h b/cpp/bindings/qpid/dotnet/src/Sender.h index 705c7d5b65..de114ab2f1 100644 --- a/cpp/bindings/qpid/dotnet/src/Sender.h +++ b/cpp/bindings/qpid/dotnet/src/Sender.h @@ -95,6 +95,15 @@ namespace Messaging { }
}
- Session ^ GetSession();
+ //
+ // Session
+ //
+ property Org::Apache::Qpid::Messaging::Session ^ Session
+ {
+ Org::Apache::Qpid::Messaging::Session ^ get ()
+ {
+ return parentSession;
+ }
+ }
};
}}}}
diff --git a/cpp/bindings/qpid/dotnet/src/Session.cpp b/cpp/bindings/qpid/dotnet/src/Session.cpp index 04fbb61e87..d5f4584a70 100644 --- a/cpp/bindings/qpid/dotnet/src/Session.cpp +++ b/cpp/bindings/qpid/dotnet/src/Session.cpp @@ -46,7 +46,8 @@ namespace Messaging { /// </summary>
// constructor
- Session::Session(::qpid::messaging::Session * sp, Connection ^ connRef) :
+ Session::Session(::qpid::messaging::Session * sp,
+ Org::Apache::Qpid::Messaging::Connection ^ connRef) :
sessionp(sp),
parentConnectionp(connRef)
{
@@ -444,11 +445,10 @@ namespace Messaging { Sender ^ Session::GetSender(System::String ^ name)
{
- ::qpid::messaging::Sender * sender = new ::qpid::messaging::Sender;
+ ::qpid::messaging::Sender sender = ::qpid::messaging::Sender(
+ sessionp->::qpid::messaging::Session::getSender(QpidMarshal::ToNative(name)) );
- *sender = sessionp->::qpid::messaging::Session::getSender(QpidMarshal::ToNative(name));
-
- Sender ^ newSender = gcnew Sender(sender, this);
+ Sender ^ newSender = gcnew Sender(&sender, this);
return newSender;
}
@@ -457,22 +457,16 @@ namespace Messaging { Receiver ^ Session::GetReceiver(System::String ^ name)
{
- ::qpid::messaging::Receiver * receiver = new ::qpid::messaging::Receiver;
-
- *receiver = sessionp->::qpid::messaging::Session::getReceiver(QpidMarshal::ToNative(name));
+ ::qpid::messaging::Receiver receiver = ::qpid::messaging::Receiver(
+ sessionp->::qpid::messaging::Session::getReceiver(QpidMarshal::ToNative(name)) );
- Receiver ^ newReceiver = gcnew Receiver(receiver, this);
+ Receiver ^ newReceiver = gcnew Receiver(&receiver, this);
return newReceiver;
}
- Connection ^ Session::GetConnection()
- {
- return parentConnectionp;
- }
-
void Session::CheckError()
{
sessionp->checkError();
diff --git a/cpp/bindings/qpid/dotnet/src/Session.h b/cpp/bindings/qpid/dotnet/src/Session.h index 4b84eec55f..a5affc67b6 100644 --- a/cpp/bindings/qpid/dotnet/src/Session.h +++ b/cpp/bindings/qpid/dotnet/src/Session.h @@ -110,7 +110,14 @@ namespace Messaging { Sender ^ GetSender(System::String ^ name);
Receiver ^ GetReceiver(System::String ^ name);
- Connection ^ GetConnection();
+ property Org::Apache::Qpid::Messaging::Connection ^ Connection
+ {
+ Org::Apache::Qpid::Messaging::Connection ^ get ()
+ {
+ return parentConnectionp;
+ }
+ }
+
property System::Boolean HasError
{
|
