Commit feac0dd5 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Refs #5051. First round of the new helper algorithm.

Almost every method just throws a runtime_error and has the wrong signature. At
least there is a place to put all of the functionality though.
parent cb21efb4
......@@ -19,6 +19,7 @@ set ( SRC_FILES
src/ConstraintFactory.cpp
src/CoordTransform.cpp
src/CostFunctionFactory.cpp
src/DataProcessorAlgorithm.cpp
src/DeprecatedAlgorithm.cpp
src/EnabledWhenWorkspaceIsType.cpp
src/ExperimentInfo.cpp
......@@ -35,8 +36,8 @@ set ( SRC_FILES
src/IEventList.cpp
src/IEventWorkspace.cpp
src/IFunction.cpp
src/IFunctionMD.cpp
src/IFunction1D.cpp
src/IFunctionMD.cpp
src/IFunctionMW.cpp
src/ILiveListener.cpp
src/IMDEventWorkspace.cpp
......@@ -52,8 +53,8 @@ set ( SRC_FILES
src/ImplicitFunctionParserFactory.cpp
src/ImplictFunctionFactory.cpp
src/InstrumentDataService.cpp
src/LiveListenerFactory.cpp
src/JointDomain.cpp
src/LiveListenerFactory.cpp
src/LoadAlgorithmFactory.cpp
src/LocatedDataRef.cpp
src/LocatedDataValue.cpp
......@@ -62,10 +63,9 @@ set ( SRC_FILES
src/MatrixWorkspace.cpp
src/MatrixWorkspaceMDIterator.cpp
src/MemoryManager.cpp
src/MultiDomainFunction.cpp
src/MultipleExperimentInfos.cpp
src/MultipleFileProperty.cpp
src/MultiDomainFunction.cpp
src/NumericAxis.cpp
src/NullCoordTransform.cpp
src/NumericAxis.cpp
src/ParamFunction.cpp
......@@ -114,12 +114,13 @@ set ( INC_FILES
inc/MantidAPI/CloneableAlgorithm.h
inc/MantidAPI/Column.h
inc/MantidAPI/ColumnFactory.h
inc/MantidAPI/CompositeFunction.h
inc/MantidAPI/CompositeDomain.h
inc/MantidAPI/CompositeDomainMD.h
inc/MantidAPI/CompositeFunction.h
inc/MantidAPI/ConstraintFactory.h
inc/MantidAPI/CoordTransform.h
inc/MantidAPI/CostFunctionFactory.h
inc/MantidAPI/DataProcessorAlgorithm.h
inc/MantidAPI/DeclareUserAlg.h
inc/MantidAPI/DeprecatedAlgorithm.h
inc/MantidAPI/DllConfig.h
......@@ -146,8 +147,8 @@ set ( INC_FILES
inc/MantidAPI/IEventList.h
inc/MantidAPI/IEventWorkspace.h
inc/MantidAPI/IFunction.h
inc/MantidAPI/IFunctionMD.h
inc/MantidAPI/IFunction1D.h
inc/MantidAPI/IFunctionMD.h
inc/MantidAPI/IFunctionMW.h
inc/MantidAPI/IFunctionValues.h
inc/MantidAPI/IFunctionWithLocation.h
......@@ -172,8 +173,8 @@ set ( INC_FILES
inc/MantidAPI/ImplicitFunctionParserFactory.h
inc/MantidAPI/InstrumentDataService.h
inc/MantidAPI/Jacobian.h
inc/MantidAPI/LiveListenerFactory.h
inc/MantidAPI/JointDomain.h
inc/MantidAPI/LiveListenerFactory.h
inc/MantidAPI/LoadAlgorithmFactory.h
inc/MantidAPI/LocatedDataRef.h
inc/MantidAPI/LocatedDataValue.h
......@@ -182,10 +183,9 @@ set ( INC_FILES
inc/MantidAPI/MatrixWorkspace.h
inc/MantidAPI/MatrixWorkspaceMDIterator.h
inc/MantidAPI/MemoryManager.h
inc/MantidAPI/MultiDomainFunction.h
inc/MantidAPI/MultipleExperimentInfos.h
inc/MantidAPI/MultipleFileProperty.h
inc/MantidAPI/MultiDomainFunction.h
inc/MantidAPI/NumericAxis.h
inc/MantidAPI/NullCoordTransform.h
inc/MantidAPI/NumericAxis.h
inc/MantidAPI/ParamFunction.h
......@@ -229,15 +229,16 @@ set ( TEST_FILES
test/CompositeFunctionTest.h
test/CoordTransformTest.h
test/CostFunctionFactoryTest.h
test/DataProcessorAlgorithmTest.h
test/EnabledWhenWorkspaceIsTypeTest.h
test/ExperimentInfoTest.h
test/ExpressionTest.h
test/FileFinderTest.h
test/FilePropertyTest.h
test/FrameworkManagerTest.h
test/FunctionPropertyTest.h
test/FunctionDomainTest.h
test/FunctionFactoryTest.h
test/FunctionPropertyTest.h
test/FunctionTest.h
test/FunctionValuesTest.h
test/IEventListTest.h
......
#ifndef MANTID_API_DATAPROCESSORALGORITHM_H_
#define MANTID_API_DATAPROCESSORALGORITHM_H_
#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/ITableWorkspace.h"
#include <vector>
namespace Mantid
{
namespace API
{
/** DataProcessorAlgorithm : TODO: DESCRIPTION
@date 2012-04-04
Copyright &copy; 2012 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://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport DataProcessorAlgorithm : public Algorithm
{
public:
DataProcessorAlgorithm();
virtual ~DataProcessorAlgorithm();
protected:
void setLoadAlg(const std::string & alg);
void setAccumAlg(const std::string & alg);
ITableWorkspace_sptr determineChunk();
void loadChunk();
void load();
std::vector<std::string> splitInput(const std::string & input);
void forwardProperties();
private:
/// The name of the algorithm to invoke when loading data
std::string m_loadAlg;
/// The name of the algorithm to invoke when accumulating data chunks
std::string m_accumulateAlg;
};
} // namespace API
} // namespace Mantid
#endif /* MANTID_API_DATAPROCESSORALGORITHM_H_ */
#include "MantidAPI/DataProcessorAlgorithm.h"
#include "MantidKernel/System.h"
#include <stdexcept>
using namespace Mantid::Kernel;
using namespace Mantid::API;
namespace Mantid
{
namespace API
{
//----------------------------------------------------------------------------------------------
/** Constructor
*/
DataProcessorAlgorithm::DataProcessorAlgorithm()
{
m_loadAlg = "Load";
m_accumulateAlg = "Plus";
}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
DataProcessorAlgorithm::~DataProcessorAlgorithm()
{
}
//----------------------------------------------------------------------------------------------
void DataProcessorAlgorithm::setLoadAlg(const std::string & alg)
{
if (alg.empty())
throw std::invalid_argument("Cannot set load algorithm to empty string");
m_loadAlg = alg;
}
void DataProcessorAlgorithm::setAccumAlg(const std::string &alg)
{
if (alg.empty())
throw std::invalid_argument("Cannot set accumulate algorithm to empty string");
m_accumulateAlg = alg;
}
ITableWorkspace_sptr DataProcessorAlgorithm::determineChunk()
{
throw std::runtime_error("DataProcessorAlgorithm::determineChunk is not implemented");
}
void DataProcessorAlgorithm::loadChunk()
{
throw std::runtime_error("DataProcessorAlgorithm::loadChunk is not implemented");
}
void DataProcessorAlgorithm::load()
{
throw std::runtime_error("DataProcessorAlgorithm::load is not implemented");
}
std::vector<std::string> DataProcessorAlgorithm::splitInput(const std::string & input)
{
UNUSED_ARG(input);
throw std::runtime_error("DataProcessorAlgorithm::splitInput is not implemented");
}
void DataProcessorAlgorithm::forwardProperties()
{
throw std::runtime_error("DataProcessorAlgorithm::forwardProperties is not implemented");
}
} // namespace Mantid
} // namespace API
#ifndef MANTID_API_DATAPROCESSORALGORITHMTEST_H_
#define MANTID_API_DATAPROCESSORALGORITHMTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
#include "MantidKernel/System.h"
#include <iostream>
#include <iomanip>
#include "MantidAPI/DataProcessorAlgorithm.h"
using namespace Mantid;
using namespace Mantid::API;
using namespace Mantid::API;
class DataProcessorAlgorithmTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static DataProcessorAlgorithmTest *createSuite() { return new DataProcessorAlgorithmTest(); }
static void destroySuite( DataProcessorAlgorithmTest *suite ) { delete suite; }
void test_Something()
{
}
};
#endif /* MANTID_API_DATAPROCESSORALGORITHMTEST_H_ */
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment