summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-09-23 21:18:25 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-09-23 21:18:25 +0000
commit430a676dd05d60a427cdd6786b72bd8651444967 (patch)
tree3756fb1e2d1fd75057da5cf7cf2e8dd52d4d76a6
parent21ea51552d12cfa09478db0ea427fc7244b7235a (diff)
downloadqpid-python-430a676dd05d60a427cdd6786b72bd8651444967.tar.gz
QPID-2926: Better solution for instantiating qpid::messaging::Handle<> specialisations
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1525706 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/include/qpid/messaging/Handle.h9
-rw-r--r--qpid/cpp/src/CMakeLists.txt8
-rw-r--r--qpid/cpp/src/qpid/messaging/Connection.cpp3
-rw-r--r--qpid/cpp/src/qpid/messaging/HandleInstantiator.cpp64
-rw-r--r--qpid/cpp/src/qpid/messaging/Receiver.cpp3
-rw-r--r--qpid/cpp/src/qpid/messaging/Sender.cpp4
-rw-r--r--qpid/cpp/src/qpid/messaging/Session.cpp3
7 files changed, 18 insertions, 76 deletions
diff --git a/qpid/cpp/include/qpid/messaging/Handle.h b/qpid/cpp/include/qpid/messaging/Handle.h
index 97a8f00b54..2edab26744 100644
--- a/qpid/cpp/include/qpid/messaging/Handle.h
+++ b/qpid/cpp/include/qpid/messaging/Handle.h
@@ -53,14 +53,15 @@ template <class T> class Handle {
void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+ private:
+ // Not implemented, subclasses must implement.
+ Handle(const Handle&);
+ Handle& operator=(const Handle&);
+
protected:
typedef T Impl;
QPID_MESSAGING_INLINE_EXTERN Handle() :impl() {}
- // Not implemented,subclasses must implement.
- QPID_MESSAGING_EXTERN Handle(const Handle&);
- QPID_MESSAGING_EXTERN Handle& operator=(const Handle&);
-
Impl* impl;
friend class PrivateImplRef<T>;
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt
index 618fe3b9b4..45b93cd358 100644
--- a/qpid/cpp/src/CMakeLists.txt
+++ b/qpid/cpp/src/CMakeLists.txt
@@ -889,10 +889,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
windows/SCM.cpp
)
- set (qpidmessaging_platform_SOURCES
- qpid/messaging/HandleInstantiator.cpp
- )
-
else (CMAKE_SYSTEM_NAME STREQUAL Windows)
# POSIX (Non-Windows) platforms have a lot of overlap in sources; the only
@@ -990,9 +986,6 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows)
set (qpidd_platform_SOURCES
posix/QpiddBroker.cpp
)
-
- set (qpidmessaging_platform_SOURCES
- )
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
set (qpidcommon_SOURCES
@@ -1234,7 +1227,6 @@ set_source_files_properties(
COMPILE_FLAGS "${HIDE_SYMBOL_FLAGS}")
set (qpidmessaging_SOURCES
- ${qpidmessaging_platform_SOURCES}
${qpidmessaging_SOURCES_hidden}
qpid/messaging/Address.cpp
qpid/messaging/AddressParser.cpp # The functions in here are not in the public interface, but qmf uses them
diff --git a/qpid/cpp/src/qpid/messaging/Connection.cpp b/qpid/cpp/src/qpid/messaging/Connection.cpp
index 71618d1057..c8a60fc56b 100644
--- a/qpid/cpp/src/qpid/messaging/Connection.cpp
+++ b/qpid/cpp/src/qpid/messaging/Connection.cpp
@@ -31,6 +31,9 @@
namespace qpid {
namespace messaging {
+// Explicitly instantiate Handle superclass
+template class Handle<ConnectionImpl>;
+
using namespace qpid::types;
typedef PrivateImplRef<qpid::messaging::Connection> PI;
diff --git a/qpid/cpp/src/qpid/messaging/HandleInstantiator.cpp b/qpid/cpp/src/qpid/messaging/HandleInstantiator.cpp
deleted file mode 100644
index c9a7680bb4..0000000000
--- a/qpid/cpp/src/qpid/messaging/HandleInstantiator.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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 "qpid/messaging/Connection.h"
-#include "qpid/messaging/Receiver.h"
-#include "qpid/messaging/Sender.h"
-#include "qpid/messaging/Session.h"
-
-namespace qpid {
-namespace messaging {
-
-using namespace qpid::types;
-
-void HandleInstantiatorDoNotCall(void)
-{
- // This function exists to instantiate various template Handle
- // bool functions. The instances are then available to
- // the qpidmessaging DLL and subsequently exported.
- // This function must not be exported nor called called.
- // For further information refer to
- // https://issues.apache.org/jira/browse/QPID-2926
-
- Connection connection;
- if (connection.isValid()) connection.close();
- if (connection.isNull() ) connection.close();
- if (connection ) connection.close();
- if (!connection ) connection.close();
-
- Receiver receiver;
- if (receiver.isValid()) receiver.close();
- if (receiver.isNull() ) receiver.close();
- if (receiver ) receiver.close();
- if (!receiver ) receiver.close();
-
- Sender sender;
- if (sender.isValid()) sender.close();
- if (sender.isNull() ) sender.close();
- if (sender ) sender.close();
- if (!sender ) sender.close();
-
- Session session;
- if (session.isValid()) session.close();
- if (session.isNull() ) session.close();
- if (session ) session.close();
- if (!session ) session.close();
-}
-}} // namespace qpid::messaging
diff --git a/qpid/cpp/src/qpid/messaging/Receiver.cpp b/qpid/cpp/src/qpid/messaging/Receiver.cpp
index f60e5f55b3..18670ec068 100644
--- a/qpid/cpp/src/qpid/messaging/Receiver.cpp
+++ b/qpid/cpp/src/qpid/messaging/Receiver.cpp
@@ -29,6 +29,9 @@
namespace qpid {
namespace messaging {
+// Explicitly instantiate Handle superclass
+template class Handle<ReceiverImpl>;
+
typedef PrivateImplRef<qpid::messaging::Receiver> PI;
Receiver::Receiver(ReceiverImpl* impl) { PI::ctor(*this, impl); }
diff --git a/qpid/cpp/src/qpid/messaging/Sender.cpp b/qpid/cpp/src/qpid/messaging/Sender.cpp
index a60de3d606..a26f2544c8 100644
--- a/qpid/cpp/src/qpid/messaging/Sender.cpp
+++ b/qpid/cpp/src/qpid/messaging/Sender.cpp
@@ -27,6 +27,10 @@
namespace qpid {
namespace messaging {
+
+// Explicitly instantiate Handle superclass
+template class Handle<SenderImpl>;
+
typedef PrivateImplRef<qpid::messaging::Sender> PI;
Sender::Sender(SenderImpl* impl) { PI::ctor(*this, impl); }
diff --git a/qpid/cpp/src/qpid/messaging/Session.cpp b/qpid/cpp/src/qpid/messaging/Session.cpp
index cccfd9a873..fd0519705d 100644
--- a/qpid/cpp/src/qpid/messaging/Session.cpp
+++ b/qpid/cpp/src/qpid/messaging/Session.cpp
@@ -30,6 +30,9 @@
namespace qpid {
namespace messaging {
+// Explicitly instantiate Handle superclass
+template class Handle<SessionImpl>;
+
typedef PrivateImplRef<qpid::messaging::Session> PI;
Session::Session(SessionImpl* impl) { PI::ctor(*this, impl); }