Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
XmlParserRegistry.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/memory>
9
10#include <alib/string>
11#include <alib/map>
12
14
15#include <core/xmlApi.hpp>
16
17namespace abstraction {
18
20public:
21 class Entry {
22 public:
23 virtual std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( ) const = 0;
24
25 virtual ~Entry ( ) = default;
26 };
27
28private:
29 template < class Return >
30 class EntryImpl : public Entry {
31 public:
32 EntryImpl ( ) = default;
33
34 std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( ) const override;
35 };
36
38
39public:
40 static void unregisterXmlParser ( const std::string & result );
41
42 template < class ReturnType >
43 static void unregisterXmlParser ( ) {
46 }
47
48 static void registerXmlParser ( std::string result, std::unique_ptr < Entry > entry );
49
50 template < class ReturnType >
51 static void registerXmlParser ( std::string result ) {
52 registerXmlParser ( std::move ( result ), std::unique_ptr < Entry > ( new EntryImpl < ReturnType > ( ) ) ) ;
53 }
54
55 template < class ReturnType >
56 static void registerXmlParser ( ) {
58 registerXmlParser < ReturnType > ( std::move ( ret ) );
59 }
60
61 static std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & typeName );
62};
63
64} /* namespace abstraction */
65
67
68namespace abstraction {
69
70template < class Return >
71std::shared_ptr < abstraction::OperationAbstraction > XmlParserRegistry::EntryImpl < Return >::getAbstraction ( ) const {
72 return std::make_shared < abstraction::XmlParserAbstraction < Return > > ( );
73}
74
75} /* namespace abstraction */
76
Definition: XmlParserRegistry.hpp:21
virtual std::shared_ptr< abstraction::OperationAbstraction > getAbstraction() const =0
Definition: XmlParserRegistry.hpp:19
static void registerXmlParser()
Definition: XmlParserRegistry.hpp:56
static void unregisterXmlParser()
Definition: XmlParserRegistry.hpp:43
static std::shared_ptr< abstraction::OperationAbstraction > getAbstraction(const std::string &typeName)
Definition: XmlParserRegistry.cpp:28
static void registerXmlParser(std::string result)
Definition: XmlParserRegistry.hpp:51
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Definition: AlgorithmAbstraction.hpp:11
ext::set< ext::pair< StateType, StateType > > ret(const ext::set< ext::pair< StateType, StateType > > &S, const DeterministicPushdownStoreSymbolType &pdaSymbol, const InputSymbolType &input, const N &nondeterministic)
Definition: RHDPDACommon.h:57
for(const StateType &state :fsm.getStates()) renamingData.insert(std Rename::RenamedAutomaton< T > result(renamingData.at(fsm.getInitialState()))
Definition: Rename.h:253
Definition: xmlApi.hpp:27