diff --git a/mediachanger/AcsProxyZmqSingleton.cpp b/mediachanger/AcsProxyZmqSingleton.cpp deleted file mode 100644 index 572807d11ff7f314b479d6c415cc6bbe676beb93..0000000000000000000000000000000000000000 --- a/mediachanger/AcsProxyZmqSingleton.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The CERN Tape Archive (CTA) project - * Copyright (C) 2015 CERN - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "common/exception/Exception.hpp" -#include "common/utils/utils.hpp" -#include "mediachanger/AcsProxyZmqSingleton.hpp" - -namespace cta { -namespace mediachanger { - -//------------------------------------------------------------------------------ -// s_mutex -//------------------------------------------------------------------------------ -std::mutex AcsProxyZmqSingleton::s_mutex; - -//------------------------------------------------------------------------------ -// s_instance -//------------------------------------------------------------------------------ -std::unique_ptr<AcsProxyZmqSingleton> AcsProxyZmqSingleton::s_instance; - -//------------------------------------------------------------------------------ -// instance -//------------------------------------------------------------------------------ -AcsProxyZmqSingleton &AcsProxyZmqSingleton::instance(void *const zmqContext) { - try { - std::lock_guard<std::mutex> lock(s_mutex); - - if(nullptr == s_instance) { - s_instance.reset(new AcsProxyZmqSingleton(zmqContext)); - } - return *s_instance; - } catch(exception::Exception &ex) { - throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); - } -} - -//------------------------------------------------------------------------------ -// constructor -//------------------------------------------------------------------------------ -AcsProxyZmqSingleton::AcsProxyZmqSingleton(void *const zmqContext, const unsigned short serverPort) throw(): - AcsProxyZmq(zmqContext, serverPort) { -} - -} // namespace mediachanger -} // namespace cta diff --git a/mediachanger/AcsProxyZmqSingleton.hpp b/mediachanger/AcsProxyZmqSingleton.hpp deleted file mode 100644 index c0dd110766bca35f6d331c3a1fab3571b6eeb094..0000000000000000000000000000000000000000 --- a/mediachanger/AcsProxyZmqSingleton.hpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The CERN Tape Archive(CTA) project - * Copyright(C) 2015 CERN - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - *(at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include "mediachanger/Constants.hpp" -#include "mediachanger/AcsProxyZmq.hpp" - -#include <memory> -#include <mutex> - -namespace cta { -namespace mediachanger { - -/** - * A singleton class. - */ -class AcsProxyZmqSingleton: public AcsProxyZmq { -public: - - /** - * Delete the default constructor. - */ - AcsProxyZmqSingleton() = delete; - - /** - * Delete the copy constructor. - */ - AcsProxyZmqSingleton(const AcsProxyZmqSingleton&) = delete; - - /** - * Delete the move constructor. - */ - AcsProxyZmqSingleton(AcsProxyZmqSingleton&&) = delete; - - /** - * Delete the copy assignment oprator. - */ - AcsProxyZmqSingleton &operator=(const AcsProxyZmqSingleton&) = delete; - - /** - * Delete the move assignment oprator. - */ - AcsProxyZmqSingleton &operator=(AcsProxyZmqSingleton&&) = delete; - - /** - * Returns the singleton instance. - * - * @param zmqContext The ZMQ context to be used to construct the instance if - * the instance does not already exist. - * @return the singleton instance. - */ - static AcsProxyZmqSingleton &instance(void *const zmqContext); - -private: - - /** - * Provate constructor to only be used by the instance() method. - * - * @param zmqContext The ZMQ context. - * @param serverPort The TCP/IP port on which the CASTOR ACS daemon is - * listening for ZMQ messages. - */ - AcsProxyZmqSingleton(void *const zmqContext, const unsigned short serverPort = ACS_PORT) throw(); - - /** - * Mutex used to implement a critical region around the implementation of the - * instance() method. - */ - static std::mutex s_mutex; - - /** - * The single instance. - */ - static std::unique_ptr<AcsProxyZmqSingleton> s_instance; - -}; // class AcsProxyZmqSingleton - -} // namespace mediachanger -} // namespace cta diff --git a/mediachanger/CMakeLists.txt b/mediachanger/CMakeLists.txt index 80f8edbb08af4869377d91ff5746da5170e1e8fc..ef15b0556c8c4b838bafc17cef376c0d83684c06 100644 --- a/mediachanger/CMakeLists.txt +++ b/mediachanger/CMakeLists.txt @@ -25,7 +25,6 @@ PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) set (MEDIACHANGER_LIB_SRC_FILES AcsLibrarySlot.cpp AcsProxyZmq.cpp - AcsProxyZmqSingleton.cpp CmdLine.cpp CmdLineTool.cpp CommonMarshal.cpp