diff --git a/Code/Mantid/Framework/Kernel/CMakeLists.txt b/Code/Mantid/Framework/Kernel/CMakeLists.txt index 98c5c45473d1..f07e87aae37d 100644 --- a/Code/Mantid/Framework/Kernel/CMakeLists.txt +++ b/Code/Mantid/Framework/Kernel/CMakeLists.txt @@ -187,7 +187,6 @@ set ( INC_FILES inc/MantidKernel/VectorHelper.h inc/MantidKernel/VisibleWhenProperty.h inc/MantidKernel/cow_ptr.h - inc/MantidKernel/ValidatorSignalChange.h inc/MantidKernel/ValidatorAnyList.h ) @@ -264,7 +263,6 @@ set ( TEST_FILES test/V2DTest.h test/V3DTest.h test/VMDTest.h - test/ValidatorSignalChangeTest.h test/VectorHelperTest.h test/VisibleWhenPropertyTest.h test/ValidatorAnyListTest.h diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ValidatorSignalChange.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ValidatorSignalChange.h deleted file mode 100644 index 8f2b804fe53d..000000000000 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ValidatorSignalChange.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef MANTID_KERNEL_VALIDATOR_SIGNAL_CHANGE_H_ -#define MANTID_KERNEL_VALIDATOR_SIGNAL_CHANGE_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidKernel/DllConfig.h" -#include "MantidKernel/IValidator.h" -#include "MantidKernel/Property.h" -#include "MantidKernel/Logger.h" -#include "boost/signal.hpp" -//#include - -namespace Mantid -{ -namespace Kernel -{ - -/** ValidatorSignalChange is a validator, which connects to a property and signals to subscribers that this property has changed - - DO NOT USE -- it is currently the concept, which has memory leak. - @date 03/11/2011 - - Copyright © 2007-9 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 . - - File change history is stored at: . - Code Documentation is available at: -*/ -template -class DLLExport ValidatorSignalChange : public IValidator< TYPE >, public boost::signal -{ -public: - /// Constructor; takes property to check - ValidatorSignalChange(Property const *const pProp): - IValidator() , - boost::signal(), - pPropObserved(pProp) - {} - - ///virtual Destructor - virtual ~ValidatorSignalChange() {} - - //------------------------------------------------------------------------------------------------------------ - /** Calls the validator, but validates nothing. Sends signal to subscribers instead - * Returns the results of the function, which is excecuted, when the signal has been called; - */ - std::string isValid(const TYPE &) const - { - return this->operator()(pPropObserved); - } - - //------------------------------------------------------------------------------------------------------------ - /** Does not verify allowed values - * @return The set of allowed values of this validato is an empty set - */ - std::set allowedValues() const { return std::set(); } - // - /** Make a copy of the present type of validator */ - IValidator* clone(){return new ValidatorSignalChange(pPropObserved);} - // -protected: - /// always valid - std::string checkValidity(const TYPE &) const{return std::string("");} -private: - // the pointer to property, this validator checks. - Property const *const pPropObserved; - // -}; -} // namespace Kernel -} // namespace Mantid - -#endif /*MANTID_KERNEL_IVALIDATOR_H_*/ \ No newline at end of file diff --git a/Code/Mantid/Framework/Kernel/test/ValidatorSignalChangeTest.h b/Code/Mantid/Framework/Kernel/test/ValidatorSignalChangeTest.h deleted file mode 100644 index c38aef84f78d..000000000000 --- a/Code/Mantid/Framework/Kernel/test/ValidatorSignalChangeTest.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef MANTID_KERNEL_SIGNALCHANGETEST_H_ -#define MANTID_KERNEL_SIGNALCHANGETEST_H_ - -#include - -#include "MantidKernel/ValidatorSignalChange.h" -#include "MantidKernel/PropertyWithValue.h" -#include "boost/bind.hpp" - -using namespace Mantid; -using namespace Mantid::Kernel; - -std::string actOnPropertyChange(Property const *const pProp) -{ - std::string result; - int middle_val(1); - int new_val = boost::lexical_cast(pProp->value()); - if (new_val>middle_val){ - return result.assign(" new property is bigger"); - }else{ - return result.assign(" new property is smaller"); - } - - -}; - -class propChanger{ -public: - propChanger(Property & toChange): - toModify(toChange){} - std::string changes_analyser(Property const *const pProp){ - std::string rez = actOnPropertyChange(pProp); - toModify.setValue(rez); - return ""; - } - Property &Accessor(){return toModify;} -private: - Property &toModify; -}; - - -class ValidatorSignalChangeTest : public CxxTest::TestSuite -{ -public: - - void test_SendSignal() - { - - PropertyWithValue *ipProp = new PropertyWithValue("intProp", 1); - ValidatorSignalChange * pValC = new ValidatorSignalChange(ipProp); - pValC->connect(&actOnPropertyChange); - - ipProp->setValue("2"); - // value provided to validator function is irrelevant here, as check occurs on ipProp and the number is just to keep the function signaturel - TSM_ASSERT_EQUALS("should return correct message "," new property is bigger",pValC->isValid(2)); - // - ipProp->setValue("0"); - // value provided to validator function is irrelevant here, as check occurs on ipProp and the number is just to keep the function signaturel - TSM_ASSERT_EQUALS("should return correct message"," new property is smaller",pValC->isValid(2)); - // - delete ipProp; - delete pValC; - } - void test_changeProp() - { - - PropertyWithValue *ipProp = new PropertyWithValue("intProp", 1); - ValidatorSignalChange * pValC = new ValidatorSignalChange(ipProp); - - PropertyWithValue *spProp = new PropertyWithValue("stringProp", ""); - propChanger propCh(*spProp); - - boost::function target; - - target = std::bind1st(std::mem_fun(&propChanger::changes_analyser),&propCh); - - pValC->connect(target); - - ipProp->setValue("2"); - // runs validator as it usually happens within an algorithm property - pValC->isValid(2); - TSM_ASSERT_EQUALS("should return correct message "," new property is bigger",propCh.Accessor().value()); - // - ipProp->setValue("0"); - // runs validator as it usually happens within an algorithm property - pValC->isValid(2); - TSM_ASSERT_EQUALS("should return correct message"," new property is smaller",propCh.Accessor().value()); - // - delete ipProp; - delete pValC; - delete spProp; - } -}; -#endif /* MANTID_KERNEL_SIGNALCHANGETEST_H_ */