From 49dfef2977f7340803c4079d60b4d29223cbeafc Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Tue, 2 Nov 2010 14:29:50 +0000 Subject: QPID-2922 Qpid Cpp Messaging .NET Binding does not implement FailoverUpdate class This checkin provides the implemtation. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1030061 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp | 94 ++++++++++++++++++++++ cpp/bindings/qpid/dotnet/src/FailoverUpdates.h | 67 +++++++++++++++ .../dotnet/src/org.apache.qpid.messaging.vcproj | 8 ++ 3 files changed, 169 insertions(+) create mode 100644 cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp create mode 100644 cpp/bindings/qpid/dotnet/src/FailoverUpdates.h (limited to 'cpp/bindings') diff --git a/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp b/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp new file mode 100644 index 0000000000..3df06d9557 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp @@ -0,0 +1,94 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +#include +#include +#include +#include +#include + +#include "qpid/messaging/FailoverUpdates.h" + +#include "Connection.h" +#include "FailoverUpdates.h" +#include "QpidException.h" + +namespace Org { +namespace Apache { +namespace Qpid { +namespace Messaging { + + /// + /// FailoverUpdates is a managed wrapper for a qpid::messaging::FailoverUpdates + /// + + // constructors + //FailoverUpdates::FailoverUpdates(Connection ^ connection) : + // failoverupdatesp(new ::qpid::messaging::FailoverUpdates(*(connection->NativeConnection))) + //{ + //} + + FailoverUpdates::FailoverUpdates(Connection ^ connection) + { + System::Exception ^ newException = nullptr; + + try + { + failoverupdatesp = new ::qpid::messaging::FailoverUpdates(*(connection->NativeConnection)); + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + + if (newException != nullptr) + { + throw newException; + } + + return; + } + + + // Destructor + FailoverUpdates::~FailoverUpdates() + { + Cleanup(); + } + + + // Finalizer + FailoverUpdates::!FailoverUpdates() + { + Cleanup(); + } + + + // Destroys kept object + // TODO: add lock + void FailoverUpdates::Cleanup() + { + if (NULL != failoverupdatesp) + { + delete failoverupdatesp; + failoverupdatesp = NULL; + } + } +}}}} diff --git a/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h b/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h new file mode 100644 index 0000000000..bc668d616c --- /dev/null +++ b/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h @@ -0,0 +1,67 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include + +namespace Org { +namespace Apache { +namespace Qpid { +namespace Messaging { + + /// + /// FailoverUpdates is a managed wrapper for a qpid::messaging::FailoverUpdates + /// + + ref class Connection; + + public ref class FailoverUpdates + { + private: + // The kept object in the Messaging C++ DLL + ::qpid::messaging::FailoverUpdates * failoverupdatesp; + + // Kept object deletion code + void Cleanup(); + + public: + FailoverUpdates(Connection ^ connection); + + ~FailoverUpdates(); + !FailoverUpdates(); + + private: + // unmanaged clone + // not defined + + // copy constructor + FailoverUpdates(const FailoverUpdates ^ failoverUpdates) {} + + // assignment operator + FailoverUpdates % operator=(const FailoverUpdates % rhs) + { + return *this; + } + }; +}}}} diff --git a/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj b/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj index 1eb0b718de..286e4ad1c4 100644 --- a/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj +++ b/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj @@ -537,6 +537,10 @@ RelativePath=".\Connection.cpp" > + + @@ -575,6 +579,10 @@ RelativePath=".\Duration.h" > + + -- cgit v1.2.1