Mantid
Loading...
Searching...
No Matches
LoadSpec.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include "MantidDataHandling/DllConfig.h"
14#include "MantidHistogramData/Histogram.h"
16
17namespace Mantid {
18namespace DataHandling {
35class MANTID_DATAHANDLING_DLL LoadSpec : public API::IFileLoader<Kernel::FileDescriptor> {
36public:
38 const std::string name() const override { return "LoadSpec"; }
40 const std::string summary() const override {
41 return "Loads data from a text file and stores it in a 2D workspace "
42 "(Workspace2D class).";
43 }
44
45 int version() const override { return 1; }
46 const std::string category() const override { return "DataHandling\\Text"; }
47
49 int confidence(Kernel::FileDescriptor &descriptor) const override;
50
51private:
52 void init() override;
53 void exec() override;
54
56 size_t readNumberOfSpectra(std::ifstream &file) const;
58 void readLine(const std::string &line, std::vector<double> &buffer) const;
60 void readHistogram(const std::vector<double> &input, HistogramData::Histogram &histogram) const;
61
63 std::vector<std::string> m_seperator_options;
64 std::map<std::string, const char *> m_separatormap;
65 using separator_pair = std::pair<std::string, const char *>;
66};
67
68} // namespace DataHandling
69} // namespace Mantid
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition IFileLoader.h:19
Loads a workspace from an ascii file.
Definition LoadSpec.h:35
std::pair< std::string, const char * > separator_pair
serparator pair type def
Definition LoadSpec.h:65
const std::string name() const override
function to return a name of the algorithm, must be overridden in all algorithms
Definition LoadSpec.h:38
const std::string category() const override
function to return a category of the algorithm.
Definition LoadSpec.h:46
const std::string summary() const override
Summary of algorithms purpose.
Definition LoadSpec.h:40
std::vector< std::string > m_seperator_options
Allowed values for the cache property.
Definition LoadSpec.h:63
int version() const override
function to return a version of the algorithm, must be overridden in all algorithms
Definition LoadSpec.h:45
std::map< std::string, const char * > m_separatormap
a map of seperators
Definition LoadSpec.h:64
LoadSpec()
Empty constructor.
Defines a wrapper around an open file.
Helper class which provides the Collimation Length for SANS instruments.