Mantid
Loading...
Searching...
No Matches
SaveCanSAS1D.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
9
11#include "MantidAPI/Run.h"
13
16
21
22#include <boost/algorithm/string/split.hpp>
23#include <boost/algorithm/string/trim.hpp>
24#include <memory>
25
26#include <list>
27
28namespace {
29void encode(std::string &data) {
30 std::string buffer;
31 buffer.reserve(data.size());
32
33 for (auto const &element : data) {
34 switch (element) {
35 case '&':
36 buffer.append("&amp;");
37 break;
38 case '\"':
39 buffer.append("&quot;");
40 break;
41 case '\'':
42 buffer.append("&apos;");
43 break;
44 case '<':
45 buffer.append("&lt;");
46 break;
47 case '>':
48 buffer.append("&gt;");
49 break;
50 default:
51 buffer.push_back(element);
52 }
53 }
54
55 data.swap(buffer);
56}
57} // namespace
58
59using namespace Mantid::Kernel;
60using namespace Mantid::Geometry;
61using namespace Mantid::API;
62
63namespace Mantid::DataHandling {
64
65// Register the algorithm into the AlgorithmFactory
67
68
69void SaveCanSAS1D::init() {
70 declareProperty(
71 std::make_unique<API::WorkspaceProperty<>>("InputWorkspace", "", Kernel::Direction::Input,
72 std::make_shared<API::WorkspaceUnitValidator>("MomentumTransfer")),
73 "The input workspace, which must be in units of Q. Must be a 1D workspace.");
74 declareProperty(std::make_unique<API::FileProperty>("Filename", "", API::FileProperty::Save, ".xml"),
75 "The name of the xml file to save");
76
77 std::vector<std::string> radiation_source{"Spallation Neutron Source",
78 "Pulsed Reactor Neutron Source",
79 "Reactor Neutron Source",
80 "Synchrotron X-ray Source",
81 "Pulsed Muon Source",
82 "Rotating Anode X-ray",
83 "Fixed Tube X-ray",
84 "neutron",
85 "x-ray",
86 "muon",
87 "electron"};
88 declareProperty("RadiationSource", "Spallation Neutron Source",
89 std::make_shared<Kernel::StringListValidator>(radiation_source), "The type of radiation used.");
90 declareProperty("Append", false,
91 "Selecting append allows the workspace to "
92 "be added to an existing canSAS 1-D file as "
93 "a new SASentry");
94 declareProperty("Process", "", "Text to append to Process section");
95 declareProperty("DetectorNames", "",
96 "Specify in a comma separated list, which detectors to store "
97 "information about; \nwhere each name must match a name "
98 "given for a detector in the [[IDF|instrument definition "
99 "file (IDF)]]. \nIDFs are located in the instrument "
100 "sub-directory of the Mantid install directory.");
101
102 // Collimation information
103 std::vector<std::string> collimationGeometry{
104 "Cylinder", "FlatPlate", "Flat plate", "Disc", "Unknown",
105 };
106 declareProperty("Geometry", "Unknown", std::make_shared<Kernel::StringListValidator>(collimationGeometry),
107 "The geometry type of the collimation.");
108 auto mustBePositiveOrZero = std::make_shared<Kernel::BoundedValidator<double>>();
109 mustBePositiveOrZero->setLower(0);
110 declareProperty("SampleHeight", 0.0, mustBePositiveOrZero,
111 "The height of the collimation element in mm. If specified "
112 "as 0 it will not be recorded.");
113 declareProperty("SampleWidth", 0.0, mustBePositiveOrZero,
114 "The width of the collimation element in mm. If specified as "
115 "0 it will not be recorded.");
116
117 // Sample information
118 declareProperty("SampleThickness", 0.0, mustBePositiveOrZero,
119 "The thickness of the sample in mm. If specified as 0 it "
120 "will not be recorded.");
121}
129void SaveCanSAS1D::setOtherProperties(API::IAlgorithm *alg, const std::string &propertyName,
130 const std::string &propertyValue, int perioidNum) {
131 // call the base class method
132 Algorithm::setOtherProperties(alg, propertyName, propertyValue, perioidNum);
133
134 if ((propertyName == "Append") && (perioidNum > 1)) {
135 alg->setPropertyValue(propertyName, "1");
136 }
137}
140 m_workspace = getProperty("InputWorkspace");
141 if (!m_workspace) {
142 throw std::invalid_argument("Invalid inputworkspace ,Error in SaveCanSAS1D");
143 }
144
145 if (m_workspace->getNumberHistograms() > 1) {
146 throw std::invalid_argument("Error in SaveCanSAS1D - more than one histogram.");
147 }
148
149 // write xml manually as the user requires a specific format were the
150 // placement of new line characters is controled
151 // and this can't be done in using the stylesheet part in Poco or libXML
153
154 m_outFile << "\n\t<SASentry name=\"" << m_workspace->getName() << "\">";
155
156 std::string sasTitle;
157 createSASTitleElement(sasTitle);
158 m_outFile << sasTitle;
159
160 std::string sasRun;
161 createSASRunElement(sasRun);
162 m_outFile << sasRun;
163
164 std::string dataUnit = m_workspace->YUnitLabel();
165 // look for xml special characters and replace with entity refrence
167
168 std::string sasData;
169 createSASDataElement(sasData, 0);
170 m_outFile << sasData;
171
172 std::string sasSample;
173 createSASSampleElement(sasSample);
174 m_outFile << sasSample;
175
176 // Recording the SAS instrument can throw, if there
177 // are no detecors present
178 std::string sasInstrument;
179 try {
180 createSASInstrument(sasInstrument);
182 throw;
183 } catch (std::runtime_error &) {
184 throw;
185 }
186 m_outFile << sasInstrument;
187
188 std::string sasProcess;
189 createSASProcessElement(sasProcess);
190 m_outFile << sasProcess;
191
192 std::string sasNote = "\n\t\t<SASnote>";
193 sasNote += "\n\t\t</SASnote>";
194 m_outFile << sasNote;
195
196 m_outFile << "\n\t</SASentry>";
197 m_outFile << "\n</SASroot>";
198 m_outFile.close();
199}
207void SaveCanSAS1D::prepareFileToWriteEntry(const std::string &fileName) {
208 // reduce error handling code by making file access errors throw
209 m_outFile.exceptions(std::ios::eofbit | std::ios::failbit | std::ios::badbit);
210
211 bool append(getProperty("Append"));
212
213 // write xml manually as the user requires a specific format were the
214 // placement of new line characters is controled
215 // and this can't be done in using the stylesheet part in Poco or libXML
216 if (append) {
217 append = openForAppending(fileName);
218 }
219
220 if (append) {
222 } else {
223 writeHeader(fileName);
224 }
225}
230bool SaveCanSAS1D::openForAppending(const std::string &filename) {
231 try {
232 m_outFile.open(filename.c_str(), std::ios::out | std::ios::in);
233 // check if the file already has data
234 m_outFile.seekg(0, std::ios::end);
235 if (m_outFile.tellg() > 0) {
236 // a file exists with data leave the file open and state that appending
237 // should be possible
238 return true;
239 }
240 } catch (std::fstream::failure &) {
241 g_log.information() << "File " << filename << " couldn't be opened for a appending, will try to create the file\n";
242 }
243 m_outFile.clear();
244 if (m_outFile.is_open()) {
245 m_outFile.close();
246 }
247 return false;
248}
255 const int rootTagLen = static_cast<int>(std::string("</SASroot>").length());
256
257 try {
258 static const int LAST_TAG_LEN = 11;
259
260 // move to the place _near_ the end of the file where the data will be
261 // appended to
262 m_outFile.seekg(-LAST_TAG_LEN - rootTagLen, std::ios::end);
263 char test_tag[LAST_TAG_LEN + 1];
264 m_outFile.read(test_tag, LAST_TAG_LEN);
265 // check we're in the correct place in the file
266 static const char LAST_TAG[LAST_TAG_LEN + 1] = "</SASentry>";
267 if (std::string(test_tag, LAST_TAG_LEN) != std::string(LAST_TAG, LAST_TAG_LEN)) {
268 // we'll allow some extra charaters so there is some variablity in where
269 // the tag might be found
270 bool tagFound(false);
271 // UNCERT should be less than the length of a SASentry
272 static const int UNCERT = 20;
273 for (int i = 1; i < UNCERT; ++i) {
274 // together this seek and read move the file pointer back on byte at a
275 // time and read
276 m_outFile.seekg(-i - LAST_TAG_LEN - rootTagLen, std::ios::end);
277 m_outFile.read(test_tag, LAST_TAG_LEN);
278 std::string read = std::string(test_tag, LAST_TAG_LEN);
279 if (read == std::string(LAST_TAG, LAST_TAG_LEN)) {
280 tagFound = true;
281 break;
282 }
283 }
284 if (!tagFound) {
285 throw std::logic_error("Couldn't find the end of the existing data, "
286 "missing </SASentry> tag");
287 }
288 }
289 // prepare to write to the place found by reading
290 m_outFile.seekp(m_outFile.tellg(), std::ios::beg);
291 } catch (std::fstream::failure &) {
292 // give users more explaination about no being able to read their files
293 throw std::logic_error("Trouble reading existing data in the output file, "
294 "are you appending to an invalid CanSAS1D file?");
295 }
296}
302void SaveCanSAS1D::writeHeader(const std::string &fileName) {
303 try {
304 m_outFile.open(fileName.c_str(), std::ios::out | std::ios::trunc);
305 // write the file header
306 m_outFile << "<?xml version=\"1.0\"?>\n"
307 << "<?xml-stylesheet type=\"text/xsl\" "
308 "href=\"cansasxml-html.xsl\" ?>\n";
309 std::string sasroot;
310 createSASRootElement(sasroot);
311 m_outFile << sasroot;
312 } catch (std::fstream::failure &) {
313 throw Exception::FileError("Error opening the output file for writing", fileName);
314 }
315}
321 std::string specialchars = "&<>'\"";
322 std::string::size_type searchIndex = 0;
323 std::string::size_type findIndex;
324 for (char specialchar : specialchars) {
325 while (searchIndex < input.length()) {
326 findIndex = input.find(specialchar, searchIndex);
327 if (findIndex != std::string::npos) {
328 searchIndex = findIndex + 1;
329 // replace with xml entity refrence
330 replacewithEntityReference(input, findIndex);
331
332 } else {
333 searchIndex = 0;
334 break;
335 }
336 }
337 }
338}
339
345void SaveCanSAS1D::replacewithEntityReference(std::string &input, const std::string::size_type &index) {
346 std::basic_string<char>::reference str = input.at(index);
347 switch (str) {
348 case '&':
349 input.replace(index, 1, "&amp;");
350 break;
351 case '<':
352 input.replace(index, 1, "&lt;");
353 break;
354 case '>':
355 input.replace(index, 1, "&gt;");
356 break;
357 case '\'':
358 input.replace(index, 1, "&apos;");
359 break;
360 case '\"':
361 input.replace(index, 1, "&quot;");
362 break;
363 }
364}
365
369void SaveCanSAS1D::createSASRootElement(std::string &rootElem) {
370 rootElem = "<SASroot version=\"1.0\"";
371 rootElem += "\n\t\t xmlns=\"cansas1d/1.0\"";
372 rootElem += "\n\t\t xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
373 rootElem += "\n\t\t xsi:schemaLocation=\"cansas1d/1.0 "
374 "http://svn.smallangles.net/svn/canSAS/1dwg/trunk/"
375 "cansas1d.xsd\">";
376}
377
381void SaveCanSAS1D::createSASTitleElement(std::string &sasTitle) {
382 std::string title = m_workspace->getTitle();
383 // look for xml special characters and replace with entity refrence
385 sasTitle = "\n\t\t<Title>";
386 sasTitle += title;
387 sasTitle += "</Title>";
388}
389
393void SaveCanSAS1D::createSASRunElement(std::string &sasRun) {
394 // initialise the run number to an empty string, this may or may not be
395 // changed later
396 std::string run;
397 if (m_workspace->run().hasProperty("run_number")) {
398 Kernel::Property const *logP = m_workspace->run().getLogData("run_number");
399 run = logP->value();
400 } else {
401 g_log.debug() << "Didn't find RunNumber log in workspace. Writing "
402 "<Run></Run> to the CANSAS file\n";
403 }
404
406
407 sasRun = "\n\t\t<Run>";
408 sasRun += run;
409 sasRun += "</Run>";
410}
411
416void SaveCanSAS1D::createSASDataElement(std::string &sasData, size_t workspaceIndex) {
417 std::string dataUnit = m_workspace->YUnitLabel();
418 // look for xml special characters and replace with entity refrence
420
421 // Workspaces that come out of the ISIS SANS reduction have had their
422 // YUnitLabel
423 // changed to "I(q) (cm-1)", but the CanSAS schema requires that the intensity
424 // unit
425 // be "1/cm"... In lieu of a better way to handle YUnitLabels, (and trying to
426 // avoid
427 // *always* writing out "1/cm") we have the following (brittle) if-statement.
428 if (dataUnit == "I(q) (cm-1)")
429 dataUnit = "1/cm";
430
431 const auto intensities = m_workspace->points(workspaceIndex);
432 auto intensityDeltas = m_workspace->pointStandardDeviations(workspaceIndex);
433 if (!intensityDeltas)
434 intensityDeltas = HistogramData::PointStandardDeviations(intensities.size(), 0.0);
435 const auto &ydata = m_workspace->y(workspaceIndex);
436 const auto &edata = m_workspace->e(workspaceIndex);
437 sasData += "\n\t\t<SASdata>";
438 for (size_t j = 0; j < ydata.size(); ++j) {
439 // x data is the QData in xml.If histogramdata take the mean
440 std::stringstream x;
441 x << formatDouble(intensities[j]);
442 std::stringstream dx_str;
443 dx_str << formatDouble(intensityDeltas[j]);
444 sasData += "\n\t\t\t<Idata><Q unit=\"1/A\">";
445 sasData += x.str();
446 sasData += "</Q>";
447 sasData += "<I unit=";
448 sasData += "\"";
449 sasData += dataUnit;
450 sasData += "\">";
452 std::stringstream y;
453 y << formatDouble(ydata[j]);
454 sasData += y.str();
455 sasData += "</I>";
456
457 // workspace error data is the Idev data in the xml file
458 std::stringstream e;
459 e << formatDouble(edata[j]);
460
461 sasData += "<Idev unit=";
462 sasData += "\"";
463 sasData += dataUnit;
464 sasData += "\">";
465
466 sasData += e.str();
467 sasData += "</Idev>";
468
469 sasData += "<Qdev unit=\"1/A\">";
470 sasData += dx_str.str();
471 sasData += "</Qdev>";
472
473 sasData += "</Idata>";
474 }
475 sasData += "\n\t\t</SASdata>";
476}
477
481void SaveCanSAS1D::createSASSampleElement(std::string &sasSample) {
482 sasSample = "\n\t\t<SASsample>";
483 // outFile<<sasSample;
484 std::string sasSampleId = "\n\t\t\t<ID>";
485 std::string sampleid = m_workspace->getTitle();
486 // look for xml special characters and replace with entity refrence
488 sasSampleId += sampleid;
489 sasSampleId += "</ID>";
490 sasSample += sasSampleId;
491 // Add sample thickness information here. We only add it if
492 // has been given a value larger than 0
493 double thickness = getProperty("SampleThickness");
494 if (thickness > 0) {
495 std::string thicknessTag = "\n\t\t\t<thickness unit=\"mm\">";
496 thicknessTag += formatDouble(thickness);
497 thicknessTag += "</thickness>";
498 sasSample += thicknessTag;
499 }
500 sasSample += "\n\t\t</SASsample>";
501}
502
506void SaveCanSAS1D::createSASSourceElement(std::string &sasSource) {
507 sasSource = "\n\t\t\t<SASsource>";
508 // outFile<<sasSource;
509
510 std::string radiation_source = getPropertyValue("RadiationSource");
511 std::string sasrad = "\n\t\t\t\t<radiation>";
512 sasrad += radiation_source;
513 sasrad += "</radiation>";
514 sasSource += sasrad;
515 // outFile<<sasrad;
516 sasSource += "\n\t\t\t</SASsource>";
517}
522void SaveCanSAS1D::createSASDetectorElement(std::string &sasDet) {
523 const std::string detectorNames = getProperty("DetectorNames");
524
525 if (detectorNames.empty()) {
526 sasDet += "\n\t\t\t<SASdetector>";
527 std::string sasDetname = "\n\t\t\t\t<name/>";
528 sasDet += sasDetname;
529 sasDet += "\n\t\t\t</SASdetector>";
530 return;
531 }
532
533 std::list<std::string> detList;
534 using std::placeholders::_1;
535 boost::algorithm::split(detList, detectorNames, std::bind(std::equal_to<char>(), _1, ','));
536 for (auto detectorName : detList) {
537 boost::algorithm::trim(detectorName);
538
539 // get first component with name detectorName in IDF
540 std::shared_ptr<const IComponent> comp = m_workspace->getInstrument()->getComponentByName(detectorName);
541 if (comp != std::shared_ptr<const IComponent>()) {
542 sasDet += "\n\t\t\t<SASdetector>";
543
544 std::string sasDetname = "\n\t\t\t\t<name>";
545 sasDetname += detectorName;
546 sasDetname += "</name>";
547 sasDet += sasDetname;
548
549 std::string sasDetUnit = "\n\t\t\t\t<SDD unit=\"m\">";
550
551 std::stringstream sdd;
552 double distance = comp->getDistance(*m_workspace->getInstrument()->getSample());
553 sdd << formatDouble(distance);
554
555 sasDetUnit += sdd.str();
556 sasDetUnit += "</SDD>";
557
558 sasDet += sasDetUnit;
559 sasDet += "\n\t\t\t</SASdetector>";
560 } else {
561 g_log.notice() << "Detector with name " << detectorName
562 << " does not exist in the instrument of the workspace: " << m_workspace->getName() << '\n';
563 }
564 }
565}
566
570void SaveCanSAS1D::createSASProcessElement(std::string &sasProcess) {
571 sasProcess = "\n\t\t<SASprocess>";
572 // outFile<<sasProcess;
573
574 std::string sasProcname = "\n\t\t\t<name>";
575 sasProcname += "Mantid generated CanSAS1D XML";
576 sasProcname += "</name>";
577 sasProcess += sasProcname;
578
579 time_t rawtime;
580 time(&rawtime);
581
582 char temp[25];
583 strftime(temp, 25, "%d-%b-%Y %H:%M:%S", localtime(&rawtime));
584 std::string sasDate(temp);
585
586 std::string sasProcdate = "\n\t\t\t<date>";
587 sasProcdate += sasDate;
588 sasProcdate += "</date>";
589 sasProcess += sasProcdate;
590
591 std::string sasProcsvn = "\n\t\t\t<term name=\"svn\">";
592 sasProcsvn += MantidVersion::version();
593 sasProcsvn += "</term>";
594 sasProcess += sasProcsvn;
595
596 const API::Run &run = m_workspace->run();
597 std::string user_file;
598 if (run.hasProperty("UserFile")) {
599 user_file = run.getLogData("UserFile")->value();
600 }
601
602 std::string sasProcuserfile = "\n\t\t\t<term name=\"user_file\">";
603 sasProcuserfile += user_file;
604 sasProcuserfile += "</term>";
605 // outFile<<sasProcuserfile;
606 sasProcess += sasProcuserfile;
607
608 // Reduction process note, if available
609 std::string process_xml = getProperty("Process");
610 if (!process_xml.empty()) {
611 std::string processNote = "\n\t\t\t<SASprocessnote>";
612 encode(process_xml);
613 processNote += process_xml;
614 processNote += "</SASprocessnote>";
615 sasProcess += processNote;
616 } else {
617 sasProcess += "\n\t\t\t<SASprocessnote/>";
618 }
619
620 sasProcess += "\n\t\t</SASprocess>";
621}
622
642void SaveCanSAS1D::createSASInstrument(std::string &sasInstrument) {
643 sasInstrument = "\n\t\t<SASinstrument>";
644
645 // Set name(r)
646 std::string sasInstrName = "\n\t\t\t<name>";
647 std::string instrname = m_workspace->getInstrument()->getName();
648 // look for xml special characters and replace with entity refrence
650 sasInstrName += instrname;
651 sasInstrName += "</name>";
652 sasInstrument += sasInstrName;
653
654 // Set SASsource(r)
655 std::string sasSource;
656 createSASSourceElement(sasSource);
657 sasInstrument += sasSource;
658
659 // Set SAScollimation(r)
660 // Add the collimation. We add the collimation information if
661 // either the width of the height is different from 0
662 double collimationHeight = getProperty("SampleHeight");
663 double collimationWidth = getProperty("SampleWidth");
664 std::string sasCollimation = "\n\t\t\t<SAScollimation/>";
665 if (collimationHeight > 0 || collimationWidth > 0) {
666 sasCollimation = "\n\t\t\t<SAScollimation>";
667
668 // aperture with name
669 std::string collimationGeometry = getProperty("Geometry");
670 sasCollimation += "\n\t\t\t\t<aperture name=\"" + collimationGeometry + "\">";
671
672 // size
673 sasCollimation += "\n\t\t\t\t\t<size>";
674
675 // Width
676 sasCollimation += "\n\t\t\t\t\t\t<x unit=\"mm\">" + formatDouble(collimationWidth) + "</x>";
677 // Height
678 sasCollimation += "\n\t\t\t\t\t\t<y unit=\"mm\">" + formatDouble(collimationHeight) + "</y>";
679
680 sasCollimation += "\n\t\t\t\t\t</size>";
681 sasCollimation += "\n\t\t\t\t</aperture>";
682 sasCollimation += "\n\t\t\t</SAScollimation>";
683 }
684 sasInstrument += sasCollimation;
685
686 // Set SASdetector
687 std::string sasDet;
689 sasInstrument += sasDet;
690 sasInstrument += "\n\t\t</SASinstrument>";
691}
692
693} // namespace Mantid::DataHandling
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
std::map< DeltaEMode::Type, std::string > index
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Kernel::Logger & g_log
Definition Algorithm.h:422
virtual void setOtherProperties(IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int periodNum)
Virtual method to set the non workspace properties for this algorithm.
@ Save
to specify a file to write to, the file may or may not exist
IAlgorithm is the interface implemented by the Algorithm base class.
Definition IAlgorithm.h:45
bool hasProperty(const std::string &name) const
Does the property exist on the object.
Kernel::Property * getLogData(const std::string &name) const
Access a single log entry.
Definition LogManager.h:140
This class stores information regarding an experimental run as a series of log entries.
Definition Run.h:35
A property class for workspaces.
bool openForAppending(const std::string &filename)
opens the named file if possible or returns false
void createSASSourceElement(std::string &sasSource)
this method creates a sasSource element
std::fstream m_outFile
an fstream object is used to write the xml manually as the user requires a specific format with new l...
void findEndofLastEntry()
Moves to the end of the last entry in the file.
void createSASTitleElement(std::string &sasTitle)
this method creates a sasTitle element
void createSASInstrument(std::string &sasInstrument)
this method creates a sasInstrument element
virtual void createSASRootElement(std::string &rootElem)
sasroot element
void setOtherProperties(API::IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int perioidNum) override
overriden method sets appending for workspace groups
void searchandreplaceSpecialChars(std::string &input)
this method searches for xml special characters and replace with entity references
void createSASProcessElement(std::string &sasProcess)
this method creates a sasProcess element
void createSASDataElement(std::string &sasData, size_t workspaceIndex)
this method creates a sasData element
void createSASDetectorElement(std::string &sasDet)
this method creates a sasDetector element
void createSASSampleElement(std::string &sasSample)
this method creates a sasSample element
virtual void writeHeader(const std::string &fileName)
Write xml header tags.
void prepareFileToWriteEntry(const std::string &fileName)
Opens the output file and, as necessary blanks it, writes the file header and moves the file pointer.
void createSASRunElement(std::string &sasRun)
this method creates a sasRun Element
API::MatrixWorkspace_const_sptr m_workspace
points to the workspace that will be written to file
void replacewithEntityReference(std::string &input, const std::string::size_type &index)
replaces the charcter at index in the input string with xml entity reference(eg.replace '&' with "&")
void exec() override
Overwrites Algorithm method.
Records the filename and the description of failure.
Definition Exception.h:98
Exception for when an item is not found in a collection.
Definition Exception.h:145
virtual void setPropertyValue(const std::string &name, const std::string &value)=0
Sets property value from a string.
void debug(const std::string &msg)
Logs at debug level.
Definition Logger.cpp:145
void notice(const std::string &msg)
Logs at notice level.
Definition Logger.cpp:126
void information(const std::string &msg)
Logs at information level.
Definition Logger.cpp:136
static const std::string & version()
The full version number.
Base class for properties.
Definition Property.h:94
virtual std::string value() const =0
Returns the value of the property as a string.
MANTID_DATAHANDLING_DLL std::string formatDouble(double const value)
@ Input
An input workspace.
Definition Property.h:53