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 {
17public:
18 static std::unique_ptr<LoadStl> createReader(const std::string &filename, ScaleUnits scaleType) {
19 std::unique_ptr<LoadStl> reader = nullptr;
20 if (LoadBinaryStl::isBinarySTL(filename)) {
21 reader = std::make_unique<LoadBinaryStl>(filename, scaleType);
22 } else if (LoadAsciiStl::isAsciiSTL(filename)) {
23 reader = std::make_unique<LoadAsciiStl>(filename, scaleType);
24 } else {
25 throw Kernel::Exception::ParseError("Could not read file, did not match either STL Format", filename, 0);
26 }
27 return reader;
28 }
29};
30
31} // namespace DataHandling
32} // 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.