Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "MantidQtCustomInterfaces/ReflNexusMeasurementSource.h"
#include <Poco/File.h>
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/Workspace.h"
#include "MantidAPI/MatrixWorkspace.h"
#include <iostream>
#include <string>
#include <sstream>
using namespace Mantid::API;
namespace MantidQt{
namespace CustomInterfaces {
//----------------------------------------------------------------------------------------------
/** Constructor
*/
ReflNexusMeasurementSource::ReflNexusMeasurementSource() {}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
ReflNexusMeasurementSource::~ReflNexusMeasurementSource() {}
Measurement ReflNexusMeasurementSource::obtain(const std::string &definedPath, const std::string &fuzzyName) const
{
std::string filenameArg = fuzzyName;
if(!definedPath.empty()) {
Poco::File file(definedPath);
if(file.exists() && file.isFile()){
// Load the exact path
filenameArg = definedPath;
}}
try{
const std::string filenameArg = fuzzyName;
IAlgorithm_sptr algLoadRun = AlgorithmManager::Instance().create("LoadISISNexus");
algLoadRun->setChild(true);
algLoadRun->setRethrows(true);
algLoadRun->initialize();
algLoadRun->setProperty("Filename", filenameArg);
algLoadRun->setPropertyValue("OutputWorkspace", "dummy");
algLoadRun->execute();
Workspace_sptr temp = algLoadRun->getProperty("OutputWorkspace");
MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(temp);
return Measurement::InvalidMeasurement("Not yet implemented");
}
catch(std::runtime_error& ex){
std::stringstream buffer;
buffer << "Meta-data load attemped a load using: " << filenameArg << std::endl;
buffer << ex.what();
const std::string message = buffer.str();
return Measurement::InvalidMeasurement(message);
}
}
ReflNexusMeasurementSource *ReflNexusMeasurementSource::clone() const
{
return new ReflNexusMeasurementSource(*this);
}
} // namespace CustomInterfaces
} // namespace MantidQt