diff --git a/Code/Mantid/Framework/Kernel/CMakeLists.txt b/Code/Mantid/Framework/Kernel/CMakeLists.txt index 2ea61f9bd2b76daa36e17e5bf7659b0eb9096966..d8ea4cb6e33848e5a0a2dffef41b8aaa077047e7 100644 --- a/Code/Mantid/Framework/Kernel/CMakeLists.txt +++ b/Code/Mantid/Framework/Kernel/CMakeLists.txt @@ -65,7 +65,6 @@ set ( SRC_FILES src/ReadLock.cpp src/RebinParamsValidator.cpp src/RegexStrings.cpp - src/SignalChannel.cpp src/SingletonHolder.cpp src/SobolSequence.cpp src/StartsWithValidator.cpp @@ -191,7 +190,6 @@ set ( INC_FILES inc/MantidKernel/RebinParamsValidator.h inc/MantidKernel/RegexStrings.h inc/MantidKernel/RegistrationHelper.h - inc/MantidKernel/SignalChannel.h inc/MantidKernel/SingletonHolder.h inc/MantidKernel/SobolSequence.h inc/MantidKernel/StartsWithValidator.h @@ -291,7 +289,6 @@ set ( TEST_FILES RebinHistogramTest.h RebinParamsValidatorTest.h RegexStringsTest.h - SignalChannelTest.h SobolSequenceTest.h StartsWithValidatorTest.h StatisticsTest.h diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/SignalChannel.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/SignalChannel.h deleted file mode 100644 index 113224673be64b16d5ee89d6c1e87a580f64fe92..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/SignalChannel.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// SignalChannel.h -// -// -// Definition of the SignalChannel class. A small extension to the POCO logging. -// -// Copyright © 2007 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory -// -// This file is part of Mantid. -// -// Mantid 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. -// -// Mantid 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/>. -// -//File change history is stored at: <https://github.com/mantidproject/mantid> -// - - -#ifndef Foundation_SignalChannel_INCLUDED -#define Foundation_SignalChannel_INCLUDED - -#include "MantidKernel/DllConfig.h" - -#include <Poco/Foundation.h> -#include <Poco/Channel.h> -#include <boost/signal.hpp> - -#include <vector> - - -namespace Poco { - -/** - class SignalChannel passes log messages to slots, connected to it. - -**/ -class MANTID_KERNEL_DLL SignalChannel: public Channel - /// This channel sends a message through boost::signal. -{ -public: - - /// Signal type - typedef boost::signal<void (const Message& msg)> signal_t; - - /// Creates the SignalChannel. - SignalChannel(); - - /// Connects a slot to the channel. - void connect(void(*slt)(const Message& msg)); - - /// Sends the given Message. - void log(const Message& msg); - - /// Reference to the signal - signal_t& sig(){return _sig;} - -private: - //mutable FastMutex _mutex; - signal_t _sig;///< boost::signal used to send the message -}; - - -} // namespace Poco - - -#endif // Foundation_SignalChannel_INCLUDED diff --git a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp index dcf81b8a8326b2d1b38852f2d9ce38ac46f4d941..5fa41ea4ebadb75f69da16c5f3be900a8f41d67a 100644 --- a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp @@ -7,7 +7,6 @@ #include "MantidKernel/Strings.h" #include "MantidKernel/Logger.h" #include "MantidKernel/FilterChannel.h" -#include "MantidKernel/SignalChannel.h" #include "MantidKernel/Exception.h" #include "MantidKernel/FacilityInfo.h" @@ -184,10 +183,6 @@ ConfigServiceImpl::ConfigServiceImpl() : Poco::LoggingFactory::defaultFactory().registerChannelClass("FilterChannel", new Poco::Instantiator< Poco::FilterChannel, Poco::Channel>); - //Register the SignalChannel with the Poco logging factory - Poco::LoggingFactory::defaultFactory().registerChannelClass("SignalChannel", new Poco::Instantiator< - Poco::SignalChannel, Poco::Channel>); - // Define the directory to search for the Mantid.properties file. Poco::File f; @@ -682,7 +677,6 @@ std::string ConfigServiceImpl::defaultConfig() const "logging.loggers.root.channel.class = SplitterChannel" "logging.loggers.root.channel.channel1 = consoleChannel" "logging.loggers.root.channel.channel2 = fileFilterChannel" - "logging.loggers.root.channel.channel3 = signalChannel" "# output to the console - primarily for console based apps" "logging.channels.consoleChannel.class = ConsoleChannel" "logging.channels.consoleChannel.formatter = f1" @@ -697,9 +691,7 @@ std::string ConfigServiceImpl::defaultConfig() const "logging.channels.fileChannel.formatter.pattern = %Y-%m-%d %H:%M:%S,%i [%I] %p %s - %t" "logging.formatters.f1.class = PatternFormatter" "logging.formatters.f1.pattern = %s-[%p] %t" - "logging.formatters.f1.times = UTC;" - "# SignalChannel - Passes messages to the MantidPlot User interface" - "logging.channels.signalChannel.class = SignalChannel"; + "logging.formatters.f1.times = UTC"; return propFile; } diff --git a/Code/Mantid/Framework/Kernel/src/SignalChannel.cpp b/Code/Mantid/Framework/Kernel/src/SignalChannel.cpp deleted file mode 100644 index 19f3579097bf7f6a407b54fdc7cc70cf983c62f8..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/Kernel/src/SignalChannel.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -#include "MantidKernel/SignalChannel.h" - -#include <Poco/LoggingRegistry.h> -#include <Poco/Message.h> -//#include <boost/bind.hpp> - -#include <iostream> - -namespace Poco { - - /// Connects a function (slot) to a SignalChannel with name chName. - /// chName must be defined in Mantid.properies file. A slot is a - /// function of the type: void slot(const Message& msg). - /// Returns true if the connection was successful. - bool DLLExport connectSignal(const std::string& chName, void(*slt)(const Message& msg)) - { - try - { - SignalChannel *pChannel = dynamic_cast<SignalChannel*>(Poco::LoggingRegistry::defaultRegistry().channelForName(chName)); - if (!pChannel) return false; - pChannel->connect(slt); - } - catch(...) - { - return false; - } - return true; - } - - SignalChannel::SignalChannel():Channel() - { - } - - void SignalChannel::log(const Message& msg) - { - _sig(msg); - } - - /// Connects a slot to the channel. - void SignalChannel::connect(void(*slt)(const Message& msg)) - { - _sig.connect(slt); - } - -} // namespace Poco diff --git a/Code/Mantid/Framework/Kernel/test/SignalChannelTest.h b/Code/Mantid/Framework/Kernel/test/SignalChannelTest.h deleted file mode 100644 index fee1ce365b73cd69387a625774565a84fe34818a..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/Kernel/test/SignalChannelTest.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef MANTID_SIGNALCHANNELTEST_H_ -#define MANTID_SIGNALCHANNELTEST_H_ - -#include <cxxtest/TestSuite.h> - -#include "MantidKernel/SignalChannel.h" -#include "MantidKernel/ConfigService.h" -#include <Poco/Channel.h> -#include <Poco/Message.h> -#include <Poco/LoggingFactory.h> -#include <Poco/LoggingRegistry.h> -#include <string> - -using namespace Mantid::Kernel; - -std::string str = ""; -void tst(const Poco::Message& msg) -{ - str = msg.getText(); -} - -class SignalChannelTest : public CxxTest::TestSuite -{ -public: - - void testContructor() - { - TS_ASSERT_THROWS_NOTHING - ( - Poco::SignalChannel a; - ) - } - - void testCreateThroughFactory() - { - //Ensure that the ConfigService has started as this registers the SignalChannel into the factory - ConfigService::Instance(); - - Poco::SignalChannel* empty=0; - - Poco::Channel* createdChannel = Poco::LoggingFactory::defaultFactory().createChannel("SignalChannel"); - Poco::SignalChannel* castedSignalChannel = dynamic_cast<Poco::SignalChannel*>(createdChannel); - TS_ASSERT_DIFFERS(castedSignalChannel,empty); - createdChannel->release(); - } - - void testConnect() - { - Poco::SignalChannel a; - TS_ASSERT_THROWS_NOTHING - ( - a.connect(tst); - ) - } - - void testSendMessage() - { - Poco::SignalChannel a; - a.connect(tst); - Poco::Message msg; - msg.setText("TesT"); - a.log(msg); - TS_ASSERT_EQUALS(str, "TesT") - } - -}; - -#endif /*MANTID_SIGNALCHANNELTEST_H_*/ diff --git a/Code/Mantid/Framework/Properties/Mantid.properties.template b/Code/Mantid/Framework/Properties/Mantid.properties.template index 8073f4ba688108c249935cbca43098a6e183fa71..c39a97d4308db276369bef1a11ae15ace3823e5b 100644 --- a/Code/Mantid/Framework/Properties/Mantid.properties.template +++ b/Code/Mantid/Framework/Properties/Mantid.properties.template @@ -148,7 +148,6 @@ logging.loggers.root.level = notice logging.loggers.root.channel.class = SplitterChannel logging.loggers.root.channel.channel1 = consoleChannel logging.loggers.root.channel.channel2 = fileFilterChannel -logging.loggers.root.channel.channel3 = signalChannel # output to the console - primarily for console based apps logging.channels.consoleChannel.class = ConsoleChannel logging.channels.consoleChannel.formatter = f1 @@ -167,8 +166,6 @@ logging.formatters.f1.class = PatternFormatter logging.formatters.f1.pattern = @CONSOLEPATTERN@ logging.formatters.f1.times = local logging.channels.fileChannel.formatter.times = local -# SignalChannel - Passes messages to the MantidPlot User interface -logging.channels.signalChannel.class = SignalChannel workspace.sendto.SansView.arguments=[file] workspace.sendto.SansView.saveusing=SaveCanSAS1D