Mantid
Loading...
Searching...
No Matches
LoadAscii.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
11#include "MantidDataHandling/DllConfig.h"
13
14#include <list>
15
16namespace Mantid {
17namespace DataHandling {
34class MANTID_DATAHANDLING_DLL LoadAscii : public API::IFileLoader<Kernel::FileDescriptor>,
36public:
38 LoadAscii();
40 const std::string name() const override { return "LoadAscii"; }
42 const std::string summary() const override {
43 return "Loads data from a text file and stores it in a 2D workspace "
44 "(Workspace2D class).";
45 }
46
48 int version() const override { return 1; }
50 const std::string category() const override { return "DataHandling\\Text"; }
52 int confidence(Kernel::FileDescriptor &descriptor) const override;
53
54protected:
56 virtual void processHeader(std::ifstream &file) const;
58 virtual API::Workspace_sptr readData(std::ifstream &file) const;
59
61 void peekLine(std::ifstream &is, std::string &str) const;
63 bool skipLine(const std::string &line) const;
65 int splitIntoColumns(std::list<std::string> &columns, const std::string &str) const;
67 void fillInputValues(std::vector<double> &values, const std::list<std::string> &columns) const;
68
70 std::string m_columnSep;
71
72private:
74 void init() override;
76 void exec() override;
77
79 std::map<std::string, std::string> m_separatorIndex;
80};
81
82} // namespace DataHandling
83} // namespace Mantid
Class for marking algorithms as deprecated.
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: LoadAscii.h:35
const std::string name() const override
The name of the algorithm.
Definition: LoadAscii.h:40
std::string m_columnSep
The column separator.
Definition: LoadAscii.h:70
const std::string category() const override
The category.
Definition: LoadAscii.h:50
const std::string summary() const override
Summary of algorithms purpose.
Definition: LoadAscii.h:42
int version() const override
The version number.
Definition: LoadAscii.h:48
std::map< std::string, std::string > m_separatorIndex
Map the separator options to their string equivalents.
Definition: LoadAscii.h:79
Defines a wrapper around an open file.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
Helper class which provides the Collimation Length for SANS instruments.