Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
OperatorRegistration.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/registration>
9
11
12namespace registration {
13
14template < abstraction::Operators::BinaryOperators Type, class FirstParamType, class SecondParamType >
15class BinaryOperatorRegister : public ext::Register < void > {
16public:
17 template < class ReturnType >
18 explicit BinaryOperatorRegister ( ReturnType ( * callback ) ( FirstParamType, SecondParamType ) ) : ext::Register < void > ( [ = ] ( ) {
19 abstraction::OperatorRegistry::registerBinary < ReturnType, FirstParamType, SecondParamType > ( Type, callback );
20 }, [ ] ( ) {
21 abstraction::OperatorRegistry::unregisterBinary < FirstParamType, SecondParamType > ( Type );
22 } ) {
23 }
24
25 explicit BinaryOperatorRegister ( ) : ext::Register < void > ( [ ] ( ) {
26 abstraction::OperatorRegistry::registerBinary < Type, FirstParamType, SecondParamType > ( );
27 }, [ ] ( ) {
28 abstraction::OperatorRegistry::unregisterBinary < FirstParamType, SecondParamType > ( Type );
29 } ) {
30 }
31
32};
33
34template < abstraction::Operators::PrefixOperators Type, class ParamType >
35class PrefixOperatorRegister : public ext::Register < void > {
36public:
37 template < class ReturnType >
38 explicit PrefixOperatorRegister ( ReturnType ( * callback ) ( ParamType ) ) : ext::Register < void > ( [ = ] ( ) {
39 abstraction::OperatorRegistry::registerPrefix < ReturnType, ParamType > ( Type, callback );
40 }, [ ] ( ) {
41 abstraction::OperatorRegistry::unregisterBinary < ParamType > ( Type );
42 } ) {
43 }
44
45 explicit PrefixOperatorRegister ( ) : ext::Register < void > ( [ ] ( ) {
46 abstraction::OperatorRegistry::registerPrefix < Type, ParamType > ( );
47 }, [ ] ( ) {
48 abstraction::OperatorRegistry::unregisterPrefix < ParamType > ( Type );
49 } ) {
50 }
51
52};
53
54template < abstraction::Operators::PostfixOperators Type, class ParamType >
55class PostfixOperatorRegister : public ext::Register < void > {
56public:
57 template < class ReturnType >
58 explicit PostfixOperatorRegister ( ReturnType ( * callback ) ( ParamType ) ) : ext::Register < void > ( [ = ] ( ) {
59 abstraction::OperatorRegistry::registerPostfix < ReturnType, ParamType > ( Type, callback );
60 }, [ ] ( ) {
61 abstraction::OperatorRegistry::unregisterBinary < ParamType > ( Type );
62 } ) {
63 }
64
65 explicit PostfixOperatorRegister ( ) : ext::Register < void > ( [ ] ( ) {
66 abstraction::OperatorRegistry::registerPostfix < Type, ParamType > ( );
67 }, [ ] ( ) {
68 abstraction::OperatorRegistry::unregisterPostfix < ParamType > ( Type );
69 } ) {
70 }
71
72};
73
74} /* namespace registration */
75
Register(InitCallback init, FinalizeCallback finish)
Definition: registration.hpp:64
Definition: registration.hpp:31
Definition: OperatorRegistration.hpp:15
BinaryOperatorRegister()
Definition: OperatorRegistration.hpp:25
BinaryOperatorRegister(ReturnType(*callback)(FirstParamType, SecondParamType))
Definition: OperatorRegistration.hpp:18
Definition: OperatorRegistration.hpp:55
PostfixOperatorRegister(ReturnType(*callback)(ParamType))
Definition: OperatorRegistration.hpp:58
PostfixOperatorRegister()
Definition: OperatorRegistration.hpp:65
Definition: OperatorRegistration.hpp:35
PrefixOperatorRegister()
Definition: OperatorRegistration.hpp:45
PrefixOperatorRegister(ReturnType(*callback)(ParamType))
Definition: OperatorRegistration.hpp:38
Definition: sigHandler.cpp:20
int callback(struct dl_phdr_info *info, size_t, void *data)
Definition: simpleStacktrace.cpp:25
Type
Definition: MeasurementTypes.hpp:20
Definition: AlgoRegistration.hpp:14