| 1 | #ifndef __TMTO__CONFIGURATION__HPP |
|---|
| 2 | #define __TMTO__CONFIGURATION__HPP |
|---|
| 3 | |
|---|
| 4 | #include <stdlib.h> |
|---|
| 5 | #include <boost/cstdint.hpp> |
|---|
| 6 | |
|---|
| 7 | #include <tmto/device/working_set.hpp> |
|---|
| 8 | #include <tmto/implementation.hpp> |
|---|
| 9 | #include <tmto/condition/condition.hpp> |
|---|
| 10 | |
|---|
| 11 | namespace tmto { namespace configuration { |
|---|
| 12 | struct end { }; |
|---|
| 13 | |
|---|
| 14 | template <typename Cond, typename Tail> |
|---|
| 15 | struct supported_condition { |
|---|
| 16 | typedef Cond cond; |
|---|
| 17 | typedef Tail tail; |
|---|
| 18 | }; |
|---|
| 19 | |
|---|
| 20 | template <typename RFunc, typename Tail> |
|---|
| 21 | struct supported_round_function { |
|---|
| 22 | typedef RFunc rfunc; |
|---|
| 23 | typedef Tail tail; |
|---|
| 24 | }; |
|---|
| 25 | |
|---|
| 26 | template <typename Gen, typename Tail> |
|---|
| 27 | struct supported_round_function_generator { |
|---|
| 28 | typedef Gen generator; |
|---|
| 29 | typedef Tail tail; |
|---|
| 30 | }; |
|---|
| 31 | |
|---|
| 32 | template <typename Impl, typename Arguments, typename Tail> |
|---|
| 33 | struct supported_implementation { |
|---|
| 34 | typedef Impl impl; |
|---|
| 35 | typedef Arguments args; |
|---|
| 36 | typedef Tail tail; |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | template <typename Cond, typename RF, typename RCond, typename RGen> |
|---|
| 40 | struct AllAspects { |
|---|
| 41 | typedef Cond conditions; |
|---|
| 42 | typedef RF round_functions; |
|---|
| 43 | typedef RCond rconditions; |
|---|
| 44 | typedef RGen rgenerators; |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | template < |
|---|
| 48 | typename Imps, |
|---|
| 49 | typename Conditions, |
|---|
| 50 | typename RoundFuncs, |
|---|
| 51 | typename RConditions, |
|---|
| 52 | typename RGenerators, |
|---|
| 53 | typename All = AllAspects<Conditions, RoundFuncs, RConditions, RGenerators> |
|---|
| 54 | > |
|---|
| 55 | struct supported_combined_implementation { |
|---|
| 56 | typedef typename Imps::impl impl; |
|---|
| 57 | typedef typename Imps::args args; |
|---|
| 58 | typedef typename Conditions::cond condition; |
|---|
| 59 | typedef typename RoundFuncs::rfunc round_function; |
|---|
| 60 | typedef typename RConditions::cond rcondition; |
|---|
| 61 | typedef typename RGenerators::generator rgenerator; |
|---|
| 62 | typedef supported_combined_implementation< |
|---|
| 63 | Imps, Conditions, RoundFuncs, RConditions, typename RGenerators::tail, |
|---|
| 64 | All> tail; |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | // rgenerators depleted |
|---|
| 68 | template <typename Imps, typename Conditions, typename RoundFuncs, |
|---|
| 69 | typename RConditions, |
|---|
| 70 | typename All> |
|---|
| 71 | struct supported_combined_implementation< |
|---|
| 72 | Imps, Conditions, RoundFuncs, RConditions, end, |
|---|
| 73 | All |
|---|
| 74 | > |
|---|
| 75 | : public supported_combined_implementation< |
|---|
| 76 | Imps, Conditions, RoundFuncs, typename RConditions::tail, |
|---|
| 77 | typename All::rgenerators, All> { |
|---|
| 78 | }; |
|---|
| 79 | |
|---|
| 80 | // rconditions depleted |
|---|
| 81 | template <typename Imps, typename Conditions, typename RoundFuncs, |
|---|
| 82 | typename RGenerators, |
|---|
| 83 | typename All> |
|---|
| 84 | struct supported_combined_implementation< |
|---|
| 85 | Imps, Conditions, RoundFuncs, end, RGenerators, All |
|---|
| 86 | > |
|---|
| 87 | : public supported_combined_implementation< |
|---|
| 88 | Imps, Conditions, typename RoundFuncs::tail, |
|---|
| 89 | typename All::rconditions, typename All::rgenerators, All> { |
|---|
| 90 | }; |
|---|
| 91 | |
|---|
| 92 | // round functions depleted |
|---|
| 93 | template <typename Imps, typename Conditions, |
|---|
| 94 | typename RConditions, typename RGenerators, typename All |
|---|
| 95 | > |
|---|
| 96 | struct supported_combined_implementation< |
|---|
| 97 | Imps, Conditions, end, RConditions, RGenerators, All> |
|---|
| 98 | : public supported_combined_implementation< |
|---|
| 99 | Imps, typename Conditions::tail, typename All::round_functions, |
|---|
| 100 | typename All::rconditions, typename All::rgenerators, All> { |
|---|
| 101 | }; |
|---|
| 102 | |
|---|
| 103 | // conditions depleted |
|---|
| 104 | template <typename Imps, typename RoundFuncs, |
|---|
| 105 | typename RConditions, typename RGenerators, typename All> |
|---|
| 106 | struct supported_combined_implementation< |
|---|
| 107 | Imps, end, RoundFuncs, RConditions, RGenerators, All> |
|---|
| 108 | : public supported_combined_implementation< |
|---|
| 109 | typename Imps::tail, typename All::conditions, |
|---|
| 110 | typename All::round_functions, |
|---|
| 111 | typename All::rconditions, |
|---|
| 112 | typename All::rgenerators,All> { |
|---|
| 113 | }; |
|---|
| 114 | |
|---|
| 115 | // implementations depleted |
|---|
| 116 | template <typename Conditions, typename RoundFuncs, |
|---|
| 117 | typename RConditions, typename RGenerators, |
|---|
| 118 | typename All> |
|---|
| 119 | struct supported_combined_implementation<end, Conditions, RoundFuncs, RConditions, RGenerators, All> { |
|---|
| 120 | typedef end impl; |
|---|
| 121 | typedef end tail; |
|---|
| 122 | }; |
|---|
| 123 | } |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | #ifdef DEFINE_STATIC_STORAGE |
|---|
| 127 | //const char * tmto::configuration::unused::name = "unused"; |
|---|
| 128 | #endif |
|---|
| 129 | |
|---|
| 130 | #endif |
|---|