Mantid
Loading...
Searching...
No Matches
ImplicitFunctionParser.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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/* Used to register classes into the factory. creates a global object in an
10 * anonymous namespace. The object itself does nothing, but the comma operator
11 * is used in the call to its constructor to effect a call to the factory's
12 * subscribe method.
13 */
14#define DECLARE_IMPLICIT_FUNCTION_PARSER(classname) \
15 namespace { \
16 Mantid::Kernel::RegistrationHelper register_alg_##classname( \
17 ((Mantid::API::ImplicitFunctionParserFactory::Instance().subscribe<classname>(#classname)), 0)); \
18 }
19
20//----------------------------------------------------------------------
21// Includes
22//----------------------------------------------------------------------
23#include <memory> //HACK
24#include <vector>
25
26#include <Poco/DOM/DOMParser.h>
27#include <Poco/DOM/Document.h>
28#include <Poco/DOM/Element.h>
29#include <Poco/DOM/NodeFilter.h>
30#include <Poco/DOM/NodeIterator.h>
31#include <Poco/DOM/NodeList.h>
32#include <Poco/File.h>
33#include <Poco/Path.h>
34
37#include "MantidAPI/DllConfig.h"
39
40namespace Mantid {
41namespace API {
49class MANTID_API_DLL ImplicitFunctionParser {
50public:
52 using SuccessorType = boost::interprocess::unique_ptr<ImplicitFunctionParser, DeleterPolicy<ImplicitFunctionParser>>;
53
54protected:
56
58
59 ImplicitFunctionParameter *parseParameter(Poco::XML::Element *pRoot) {
60 return m_paramParserRoot->createParameter(pRoot);
61 }
62
64 if (!m_successor) {
65 std::string message = "There is no successor function parser. Is this an "
66 "empty composite function?";
67 throw std::runtime_error(message);
68 }
69 }
70
71public:
72 ImplicitFunctionParser(ImplicitFunctionParameterParser *parameterParser) : m_paramParserRoot(parameterParser) {}
73
74 virtual ImplicitFunctionBuilder *createFunctionBuilder(Poco::XML::Element *functionElement) = 0;
75 virtual void setSuccessorParser(ImplicitFunctionParser *parser) = 0;
77 virtual ~ImplicitFunctionParser() = default;
78};
79} // namespace API
80} // namespace Mantid
This class is the abstract type for building IImplicitFunctions.
boost::interprocess::unique_ptr< ImplicitFunctionParameterParser, DeleterPolicy< ImplicitFunctionParameterParser > > SuccessorType
Successor type.
Abstract parameter type for use with IImplicitFunctions.
virtual void setParameterParser(ImplicitFunctionParameterParser *parser)=0
ImplicitFunctionParameterParser::SuccessorType m_paramParserRoot
ImplicitFunctionParameter * parseParameter(Poco::XML::Element *pRoot)
ImplicitFunctionParser(ImplicitFunctionParameterParser *parameterParser)
virtual ~ImplicitFunctionParser()=default
virtual ImplicitFunctionBuilder * createFunctionBuilder(Poco::XML::Element *functionElement)=0
virtual void setSuccessorParser(ImplicitFunctionParser *parser)=0
boost::interprocess::unique_ptr< ImplicitFunctionParser, DeleterPolicy< ImplicitFunctionParser > > SuccessorType
Successor type. Unique pointer with stack scoped deletion semantics.
Helper class which provides the Collimation Length for SANS instruments.