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 Parser Parser
15#define DECLARE_IMPLICIT_FUNCTION_PARSER(classname) \
16 namespace { \
17 Mantid::Kernel::RegistrationHelper register_alg_##classname( \
18 ((Mantid::API::ImplicitFunctionParserFactory::Instance().subscribe<classname>(#classname)), 0)); \
19 }
20
21//----------------------------------------------------------------------
22// Includes
23//----------------------------------------------------------------------
24#include <memory> //HACK
25#include <vector>
26
27#include <Poco/DOM/DOMParser.h>
28#include <Poco/DOM/Document.h>
29#include <Poco/DOM/Element.h>
30#include <Poco/DOM/NodeFilter.h>
31#include <Poco/DOM/NodeIterator.h>
32#include <Poco/DOM/NodeList.h>
33#include <Poco/File.h>
34#include <Poco/Path.h>
35
38#include "MantidAPI/DllConfig.h"
40
41namespace Mantid {
42namespace API {
50class MANTID_API_DLL ImplicitFunctionParser {
51public:
53 using SuccessorType = boost::interprocess::unique_ptr<ImplicitFunctionParser, DeleterPolicy<ImplicitFunctionParser>>;
54
55protected:
57
59
60 ImplicitFunctionParameter *parseParameter(Poco::XML::Element *pRoot) {
61 return m_paramParserRoot->createParameter(pRoot);
62 }
63
65 if (!m_successor) {
66 std::string message = "There is no successor function parser. Is this an "
67 "empty composite function?";
68 throw std::runtime_error(message);
69 }
70 }
71
72public:
73 ImplicitFunctionParser(ImplicitFunctionParameterParser *parameterParser) : m_paramParserRoot(parameterParser) {}
74
75 virtual ImplicitFunctionBuilder *createFunctionBuilder(Poco::XML::Element *functionElement) = 0;
76 virtual void setSuccessorParser(ImplicitFunctionParser *parser) = 0;
78 virtual ~ImplicitFunctionParser() = default;
79};
80} // namespace API
81} // 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.
XML Parser for function types.
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.