Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
XmlComposerRegistry.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/memory>
9#include <ext/typeinfo>
10
11#include <alib/string>
12#include <alib/set>
13#include <alib/map>
14
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 Param >
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 unregisterXmlComposer ( const std::string & param );
41
42 template < class ParamType >
43 static void unregisterXmlComposer ( ) {
44 std::string param = ext::to_string < ParamType > ( );
45 unregisterXmlComposer ( param );
46 }
47
48 static void registerXmlComposer ( std::string param, std::unique_ptr < Entry > entry );
49
50 template < class ParamType >
51 static void registerXmlComposer ( std::string param ) {
52 registerXmlComposer ( std::move ( param ), std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) );
53 }
54
55 template < class ParamType >
56 static void registerXmlComposer ( ) {
57 std::string param = ext::to_string < ParamType > ( );
58 registerXmlComposer < ParamType > ( std::move ( param ) );
59 }
60
61 static std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & param );
62
63 static ext::set < std::string > listGroup ( const std::string & group );
64
66};
67
68} /* namespace abstraction */
69
71
72namespace abstraction {
73
74template < class Param >
75std::shared_ptr < abstraction::OperationAbstraction > XmlComposerRegistry::EntryImpl < Param >::getAbstraction ( ) const {
76 return std::make_shared < abstraction::XmlComposerAbstraction < const Param & > > ( );
77}
78
79
80} /* namespace abstraction */
81
Definition: XmlComposerRegistry.hpp:21
virtual std::shared_ptr< abstraction::OperationAbstraction > getAbstraction() const =0
Definition: XmlComposerRegistry.hpp:19
static void registerXmlComposer(std::string param)
Definition: XmlComposerRegistry.hpp:51
static std::shared_ptr< abstraction::OperationAbstraction > getAbstraction(const std::string &param)
Definition: XmlComposerRegistry.cpp:27
static void unregisterXmlComposer()
Definition: XmlComposerRegistry.hpp:43
static ext::set< std::string > list()
Definition: XmlComposerRegistry.cpp:45
static ext::set< std::string > listGroup(const std::string &group)
Definition: XmlComposerRegistry.cpp:35
static void registerXmlComposer()
Definition: XmlComposerRegistry.hpp:56
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Definition: set.hpp:44
Definition: AlgorithmAbstraction.hpp:11