Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
AlgorithmRegistryInfo.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/vector>
9#include <ext/pair>
10#include <ext/typeinfo>
11#include <ext/tuple>
12
15
16namespace abstraction {
17
20
22
23protected:
24 template < class ... ParamTypes >
27
28 return params;
29 }
30
31 template < class ReturnType >
33 return ext::make_pair ( ext::to_string < typename std::decay < ReturnType >::type > ( ), abstraction::TypeQualifiers::typeQualifiers < ReturnType > ( ) );
34 }
35
36public:
38
40 return m_category;
41 }
42
44 return m_params;
45 }
46
47 template < class ObjectType, class ... ParamTypes >
50
52 params.insert ( params.begin ( ), convertType < ObjectType & > ( ) );
53
54 return AlgorithmBaseInfo ( category, std::move ( params ) );
55 }
56
57 template < class ... ParamTypes >
60
61 return AlgorithmBaseInfo ( category, std::move ( params ) );
62 }
63
64 template < class ... ParamTypes >
67
69
70 return AlgorithmBaseInfo ( category, std::move ( params ) );
71 }
72
75
76 return AlgorithmBaseInfo ( category, std::move ( paramSpec ) );
77 }
78
79 template < class ... ParamTypes >
82
84
85 return AlgorithmBaseInfo ( category, std::move ( params ) );
86 }
87};
88
90 ext::vector < std::string > m_paramNames;
91
93
94public:
96
98 return m_paramNames;
99 }
100
102 return m_result;
103 }
104
106
107 template < class ObjectType, class ReturnType, class ... ParamTypes >
108 static AlgorithmFullInfo methodEntryInfo ( std::array < std::string, sizeof ... ( ParamTypes ) > paramNames ) {
109 ext::vector < std::string > parameterNames;
110 parameterNames.insert ( parameterNames.end ( ), "object" );
111 parameterNames.insert ( parameterNames.end ( ), paramNames.begin ( ), paramNames.end ( ) );
112
114
115 return AlgorithmFullInfo ( AlgorithmBaseInfo::methodEntryInfo < ObjectType, ParamTypes ... > ( ), std::move ( parameterNames ), std::move ( result ) );
116 }
117
118 template < class ReturnType, class ... ParamTypes >
119 static AlgorithmFullInfo algorithmEntryInfo ( AlgorithmCategories::AlgorithmCategory category, std::array < std::string, sizeof ... ( ParamTypes ) > paramNames ) {
121
122 ext::vector < std::string > parameterNames ( paramNames.begin ( ), paramNames.end ( ) );
123
124 return AlgorithmFullInfo ( AlgorithmBaseInfo::algorithmEntryInfo < ParamTypes ... > ( category ), std::move ( parameterNames ), std::move ( result ) );
125 }
126
127 template < class ReturnType, class ... ParamTypes >
128 static AlgorithmFullInfo wrapperEntryInfo ( std::array < std::string, sizeof ... ( ParamTypes ) > paramNames ) {
130
131 ext::vector < std::string > parameterNames ( paramNames.begin ( ), paramNames.end ( ) );
132
133 return AlgorithmFullInfo ( AlgorithmBaseInfo::wrapperEntryInfo < ParamTypes ... > ( ), std::move ( parameterNames ), std::move ( result ) );
134 }
135
137 ext::vector < std::string > parameterNames;
140 parameterNames.push_back ( std::move ( std::get < 2 > ( paramSpec ) ) );
141 parameterSpecs.push_back ( ext::make_pair ( std::move ( std::get < 0 > ( paramSpec ) ), std::get < 1 > ( paramSpec ) ) );
142 }
143
144 return AlgorithmFullInfo ( AlgorithmBaseInfo::rawEntryInfo ( std::move ( parameterSpecs ) ), std::move ( parameterNames ), std::move ( result ) ) ;
145 }
146
147 template < class ReturnType, class ... ParamTypes >
150
151 ext::vector < std::string > parameterNames;
152 if constexpr ( sizeof ... ( ParamTypes ) == 1 ) {
153 parameterNames.push_back ( "arg" );
154 } else if constexpr ( sizeof ... ( ParamTypes ) == 2 ) {
155 parameterNames.push_back ( "lhs" );
156 parameterNames.push_back ( "rhs" );
157 } else {
158 static_assert ( "Invalid number of params or operator" );
159 }
160
161 return AlgorithmFullInfo ( AlgorithmBaseInfo::operatorEntryInfo < ParamTypes ... > ( ), std::move ( parameterNames ), std::move ( result ) );
162 }
163
164};
165
166} /* namespace abstraction */
167
Definition: AlgorithmRegistryInfo.hpp:18
static ext::vector< ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > > convertTypes()
Definition: AlgorithmRegistryInfo.hpp:25
static AlgorithmBaseInfo wrapperEntryInfo()
Definition: AlgorithmRegistryInfo.hpp:65
static AlgorithmBaseInfo methodEntryInfo()
Definition: AlgorithmRegistryInfo.hpp:48
AlgorithmBaseInfo(AlgorithmCategories::AlgorithmCategory category, ext::vector< ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > > params)
Definition: AlgorithmRegistryInfo.cpp:11
static ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > convertType()
Definition: AlgorithmRegistryInfo.hpp:32
static AlgorithmBaseInfo rawEntryInfo(ext::vector< ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > > paramSpec)
Definition: AlgorithmRegistryInfo.hpp:73
static AlgorithmBaseInfo algorithmEntryInfo(AlgorithmCategories::AlgorithmCategory category)
Definition: AlgorithmRegistryInfo.hpp:58
const ext::vector< ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > > & getParams() const
Definition: AlgorithmRegistryInfo.hpp:43
static AlgorithmBaseInfo operatorEntryInfo()
Definition: AlgorithmRegistryInfo.hpp:80
AlgorithmCategories::AlgorithmCategory getCategory() const
Definition: AlgorithmRegistryInfo.hpp:39
AlgorithmCategory
Definition: AlgorithmCategories.hpp:14
Definition: AlgorithmRegistryInfo.hpp:89
static AlgorithmFullInfo wrapperEntryInfo(std::array< std::string, sizeof ...(ParamTypes) > paramNames)
Definition: AlgorithmRegistryInfo.hpp:128
const ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > & getResult() const
Definition: AlgorithmRegistryInfo.hpp:101
AlgorithmFullInfo(AlgorithmBaseInfo baseInfo, ext::vector< std::string > paramNames, ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > result)
Definition: AlgorithmRegistryInfo.cpp:14
static AlgorithmFullInfo operatorEntryInfo()
Definition: AlgorithmRegistryInfo.hpp:148
ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > getNormalizedResult() const
Definition: AlgorithmRegistryInfo.cpp:17
const ext::vector< std::string > & getParamNames() const
Definition: AlgorithmRegistryInfo.hpp:97
static AlgorithmFullInfo methodEntryInfo(std::array< std::string, sizeof ...(ParamTypes) > paramNames)
Definition: AlgorithmRegistryInfo.hpp:108
static AlgorithmFullInfo rawEntryInfo(ext::pair< std::string, abstraction::TypeQualifiers::TypeQualifierSet > result, ext::vector< ext::tuple< std::string, abstraction::TypeQualifiers::TypeQualifierSet, std::string > > paramSpecs)
Definition: AlgorithmRegistryInfo.hpp:136
static AlgorithmFullInfo algorithmEntryInfo(AlgorithmCategories::AlgorithmCategory category, std::array< std::string, sizeof ...(ParamTypes) > paramNames)
Definition: AlgorithmRegistryInfo.hpp:119
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Class extending the tuple class from the standard library. Original reason is to allow printing of th...
Definition: tuple.hpp:42
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: vector.hpp:125
reverse_iterator insert(const_reverse_iterator pos, const T &value)
Inserts the value on position given by iterator pos.
Definition: vector.hpp:229
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
Definition: AlgorithmAbstraction.hpp:11
for(const StateType &state :fsm.getStates()) renamingData.insert(std Rename::RenamedAutomaton< T > result(renamingData.at(fsm.getInitialState()))
Definition: Rename.h:253
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79