Mantid
Loading...
Searching...
No Matches
SaveCanSAS1D.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 <fstream>
15
16namespace Poco {
17namespace XML {
18class Document;
19class Element;
20class Text;
21} // namespace XML
22} // namespace Poco
23
24namespace Mantid {
25namespace DataHandling {
82class MANTID_DATAHANDLING_DLL SaveCanSAS1D : public API::Algorithm {
83public:
84 virtual ~SaveCanSAS1D() = default;
85 const std::string name() const override { return "SaveCanSAS1D"; }
86 const std::string summary() const override { return "Save a MatrixWorkspace to a file in the canSAS 1-D format"; }
87 int version() const override { return 1; }
88 const std::string category() const override { return "DataHandling\\XML;SANS\\DataHandling"; }
89
90protected:
92 void init() override;
94 void setOtherProperties(API::IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue,
95 int perioidNum) override;
97 void exec() override;
98
101 void prepareFileToWriteEntry(const std::string &fileName);
103 bool openForAppending(const std::string &filename);
105 void findEndofLastEntry();
107 virtual void writeHeader(const std::string &fileName);
110 void searchandreplaceSpecialChars(std::string &input);
113 void replacewithEntityReference(std::string &input, const std::string::size_type &index);
115 virtual void createSASRootElement(std::string &rootElem);
116
118 void createSASTitleElement(std::string &sasTitle);
119
121 void createSASSampleElement(std::string &sasSample);
122
124 void createSASRunElement(std::string &sasRun);
125
127 void createSASDataElement(std::string &sasData, size_t workspaceIndex);
128
130 void createSASSourceElement(std::string &sasSource);
131
133 void createSASDetectorElement(std::string &sasDet);
134
136 void createSASProcessElement(std::string &sasProcess);
137
139 void createSASInstrument(std::string &sasInstrument);
140
146 std::fstream m_outFile;
147};
148} // namespace DataHandling
149} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:45
std::fstream m_outFile
an fstream object is used to write the xml manually as the user requires a specific format with new l...
Definition: SaveCanSAS1D.h:146
const std::string name() const override
function to return a name of the algorithm, must be overridden in all algorithms
Definition: SaveCanSAS1D.h:85
const std::string summary() const override
function returns a summary message that will be displayed in the default GUI, and in the help.
Definition: SaveCanSAS1D.h:86
const std::string category() const override
function to return a category of the algorithm.
Definition: SaveCanSAS1D.h:88
API::MatrixWorkspace_const_sptr m_workspace
points to the workspace that will be written to file
Definition: SaveCanSAS1D.h:142
int version() const override
function to return a version of the algorithm, must be overridden in all algorithms
Definition: SaveCanSAS1D.h:87
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Helper class which provides the Collimation Length for SANS instruments.
Definition: Algorithm.h:30