summaryrefslogtreecommitdiff
path: root/modules/codec-unit/c++/unit_transform.hpp
blob: 3cae3c5e4f4b26ccdcddeda26178866a88777ead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once

#include <type_traits>
#include "unit_schema.hpp"

namespace saw {
namespace impl {

template<typename T, typename U>
class unit_matching;

template<typename... T>
class unit_redux_list {
	static_assert(sizeof...(T) == 0u, "Template type not supported");

	using reduced_type = unit_redux_list<>;
};

template<typename LR, typename RR>
class unit_matching {
	static_assert(is_always_false<LR,RR>, "Template type not supported");
};

template<typename... Ele>
class unit_matching<unit_redux_list<>, unit_redux_list<Ele...>> {
	using Type = unit_redux_list<Ele...>;
};

template<typename Ele0, typename... EleL, typename... EleR>
class unit_matching<unit_redux_list<Ele0, ELeL...>, unit_redux_list<EleR...>> {
	using Type = 
};
}

template<typename... UE>
struct unit_element_reduction {
	using Schema = typename impl::unit_matching<impl::unit_redux_list<UE...>, impl::unit_redux_list<>>::Schema;
};

template<typename U0, typename U1>
struct unit_multiplication {
	static_assert(is_always_false<U0,U1>, "Template type not supported");
};

template<typename... UnitT, int64_t... UnitE, typename... UnitRhsT, int64_t... UnitRhsE>
class unit_multiplication<
	schema::Unit<schema::UnitElement<UnitT,UnitE>...>,schema::Unit<schema::UnitElement<UnitRhsT,UnitRhsE>...>
> {
	using Schema = typename unit_reduction<schema::UnitElement<UnitT,UnitE>..., schema::UnitElement<UnitRhsT, UnitRhsE>...>::Schema;
};

}