summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src/Duration.h
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2010-05-28 18:09:10 +0000
committerTed Ross <tross@apache.org>2010-05-28 18:09:10 +0000
commit947b1491d7a39c87c4560126a6e50646aa2a2b24 (patch)
tree19a5c7ac347d807125f8352ef5f2d41810d79281 /cpp/bindings/qpid/dotnet/src/Duration.h
parent8d317104053b8258380c47af8d792517c4da10b7 (diff)
downloadqpid-python-947b1491d7a39c87c4560126a6e50646aa2a2b24.tar.gz
QPID-2628 - Patch from Chuck Rolke
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@949245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src/Duration.h')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Duration.h65
1 files changed, 44 insertions, 21 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Duration.h b/cpp/bindings/qpid/dotnet/src/Duration.h
index 9b763a7fdf..b7d2bf147e 100644
--- a/cpp/bindings/qpid/dotnet/src/Duration.h
+++ b/cpp/bindings/qpid/dotnet/src/Duration.h
@@ -25,8 +25,6 @@
#include <string>
#include <limits>
-#include "qpid/messaging/Duration.h"
-
namespace org {
namespace apache {
namespace qpid {
@@ -34,34 +32,59 @@ namespace messaging {
/// <summary>
/// Duration is a time interval in milliseconds.
- /// It is a managed wrapper for a ::qpid::messaging::Duration
+ /// It is a managed equivalent of ::qpid::messaging::Duration
/// </summary>
public ref class Duration
{
private:
- // Experimental constructor
- Duration(const ::qpid::messaging::Duration *);
-
- // Kept object deletion code
- void Cleanup();
+ System::UInt64 milliseconds;
public:
- Duration(System::UInt64 milliseconds);
- ~Duration();
- !Duration();
- // The kept object in the Messaging C++ DLL
- const ::qpid::messaging::Duration * durationp;
+ Duration(const Duration % rhs) :
+ milliseconds(rhs.milliseconds)
+ {
+ };
+
+ explicit Duration(System::UInt64 mS) :
+ milliseconds(mS) {};
+
+ Duration() :
+ milliseconds(System::UInt64::MaxValue) {};
+
+ property System::UInt64 Milliseconds
+ {
+ System::UInt64 get () { return milliseconds; }
+ }
+
+ static Duration ^ operator * (Duration ^ dur, const System::UInt64 multiplier)
+ {
+ Duration ^ result = gcnew Duration(dur->Milliseconds * multiplier);
+ return result;
+ }
- System::UInt64 getMilliseconds();
+ static Duration ^ operator * (const System::UInt64 multiplier, Duration ^ dur)
+ {
+ Duration ^ result = gcnew Duration(multiplier * dur->Milliseconds);
+ return result;
+ }
+ };
+
+ public ref class DurationConstants
+ {
+ public:
+ static Duration ^ FORVER;
+ static Duration ^ IMMEDIATE;
+ static Duration ^ SECOND;
+ static Duration ^ MINUTE;
- // Return value(s) for constant durations
- // NOTE: These return the duration mS and not a Duration
- // object like the C++ code gets.
- System::UInt64 FOREVER();
- System::UInt64 IMMEDIATE();
- System::UInt64 SECOND();
- System::UInt64 MINUTE();
+ static DurationConstants()
+ {
+ FORVER = gcnew Duration();
+ IMMEDIATE = gcnew Duration(0);
+ SECOND = gcnew Duration(1000);
+ MINUTE = gcnew Duration(60000);
+ }
};
}}}}