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//----------------------------------------------------------------------
12#include "MantidAPI/Algorithm.h"
13#include "MantidDataHandling/DllConfig.h"
14#include "MantidHistogramData/Histogram.h"
15
16namespace Mantid {
17namespace DataHandling {
34class MANTID_DATAHANDLING_DLL LoadSpec final : public API::Algorithm {
35public:
37 const std::string name() const override { return "LoadSpec"; }
39 const std::string summary() const override {
40 return "Loads data from a text file and stores it in a 2D workspace "
41 "(Workspace2D class).";
42 }
43
44 int version() const override { return 1; }
45 const std::vector<std::string> seeAlso() const override { return {"LoadSNSspec"}; }
46 const std::string category() const override { return "DataHandling\\Text"; }
47
48private:
49 void init() override;
50 void exec() override;
51
53 size_t readNumberOfSpectra(std::ifstream &file) const;
55 void readLine(const std::string &line, std::vector<double> &buffer) const;
57 void readHistogram(const std::vector<double> &input, HistogramData::Histogram &histogram) const;
58
60 std::vector<std::string> m_seperator_options;
61 std::map<std::string, const char *> m_separatormap;
62 using separator_pair = std::pair<std::string, const char *>;
63};
64
65} // namespace DataHandling
66} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Loads a workspace from an ascii file.
Definition: LoadSpec.h:34
std::pair< std::string, const char * > separator_pair
serparator pair type def
Definition: LoadSpec.h:62
const std::string name() const override
function to return a name of the algorithm, must be overridden in all algorithms
Definition: LoadSpec.h:37
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: LoadSpec.h:45
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:39
std::vector< std::string > m_seperator_options
Allowed values for the cache property.
Definition: LoadSpec.h:60
int version() const override
function to return a version of the algorithm, must be overridden in all algorithms
Definition: LoadSpec.h:44
std::map< std::string, const char * > m_separatormap
a map of seperators
Definition: LoadSpec.h:61
LoadSpec()
Empty constructor.
Helper class which provides the Collimation Length for SANS instruments.