Mantid
Loading...
Searching...
No Matches
LoadStlFactory.h
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 +
7#pragma once
8
9#include "MantidDataHandling/DllConfig.h"
12
13namespace Mantid {
14namespace DataHandling {
15
16class MANTID_DATAHANDLING_DLL LoadStlFactory {
17
18 // clang-format off
19public :
20static std::unique_ptr<LoadStl> createReader(const std::string &filename, ScaleUnits scaleType) {
21
22 std::unique_ptr<LoadStl> reader = nullptr;
23 if (LoadBinaryStl::isBinarySTL(filename)) {
24 reader = std::make_unique<LoadBinaryStl>(filename, scaleType);
25 } else if (LoadAsciiStl::isAsciiSTL(filename)) {
26 reader = std::make_unique<LoadAsciiStl>(filename, scaleType);
27 } else {
28 throw Kernel::Exception::ParseError("Could not read file, did not match either STL Format", filename, 0);
29 }
30 return reader;
31}
32 // clang-format on
33
34}; // namespace Mantid
35
36} // namespace DataHandling
37} // namespace Mantid
static std::unique_ptr< LoadStl > createReader(const std::string &filename, ScaleUnits scaleType)
Records the filename, the description of failure and the line on which it happened.
Definition Exception.h:115
Helper class which provides the Collimation Length for SANS instruments.