Mantid
Loading...
Searching...
No Matches
ImplicitFunctionFactory.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 +
8#include <Poco/DOM/DOMParser.h>
9#include <Poco/DOM/Document.h>
10#include <Poco/DOM/Element.h>
11#include <Poco/DOM/NodeFilter.h>
12#include <Poco/DOM/NodeIterator.h>
13#include <Poco/DOM/NodeList.h>
14#include <Poco/File.h>
15#include <Poco/Path.h>
16#include <boost/scoped_ptr.hpp>
17
18namespace Mantid::API {
19
21 UNUSED_ARG(className);
22 throw std::runtime_error("Use of create in this context is forbidden. Use "
23 "createUnwrappedInstead.");
24}
25
27ImplicitFunctionFactoryImpl::createUnwrapped(Poco::XML::Element *processXML) const {
28
29 ImplicitFunctionParser *funcParser =
30 Mantid::API::ImplicitFunctionParserFactory::Instance().createImplicitFunctionParserFromXML(processXML);
31
32 boost::scoped_ptr<ImplicitFunctionBuilder> functionBuilder(funcParser->createFunctionBuilder(processXML));
33 return functionBuilder->create();
34}
35
37ImplicitFunctionFactoryImpl::createUnwrapped(const std::string &processXML) const {
38 using namespace Poco::XML;
39 DOMParser pParser;
40 Poco::AutoPtr<Document> pDoc = pParser.parseString(processXML);
41 Element *pInstructionsXML = pDoc->documentElement();
42
43 boost::scoped_ptr<ImplicitFunctionParser> funcParser(
44 ImplicitFunctionParserFactory::Instance().createImplicitFunctionParserFromXML(processXML));
45
46 boost::scoped_ptr<ImplicitFunctionBuilder> functionBuilder(funcParser->createFunctionBuilder(pInstructionsXML));
47 return functionBuilder->create();
48}
49} // namespace Mantid::API
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
Mantid::Geometry::MDImplicitFunction_sptr create(const std::string &className) const override
Creates a new instance of the class with the given name.
virtual Mantid::Geometry::MDImplicitFunction * createUnwrapped(Poco::XML::Element *processXML) const
XML Parser for function types.
virtual ImplicitFunctionBuilder * createFunctionBuilder(Poco::XML::Element *functionElement)=0
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< MDImplicitFunction > MDImplicitFunction_sptr