From 430a676dd05d60a427cdd6786b72bd8651444967 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 23 Sep 2013 21:18:25 +0000 Subject: 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 --- qpid/cpp/src/CMakeLists.txt | 8 --- qpid/cpp/src/qpid/messaging/Connection.cpp | 3 + qpid/cpp/src/qpid/messaging/HandleInstantiator.cpp | 64 ---------------------- qpid/cpp/src/qpid/messaging/Receiver.cpp | 3 + qpid/cpp/src/qpid/messaging/Sender.cpp | 4 ++ qpid/cpp/src/qpid/messaging/Session.cpp | 3 + 6 files changed, 13 insertions(+), 72 deletions(-) delete mode 100644 qpid/cpp/src/qpid/messaging/HandleInstantiator.cpp (limited to 'qpid/cpp/src') 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; + using namespace qpid::types; typedef PrivateImplRef 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; + typedef PrivateImplRef 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; + typedef PrivateImplRef 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; + typedef PrivateImplRef PI; Session::Session(SessionImpl* impl) { PI::ctor(*this, impl); } -- cgit v1.2.1