1 #ifndef color__internal_reformat
2 #define color__internal_reformat
3 
4 // ::color::_internal::reformat< >(   )
5 // ::color::_internal::reformat< >(   )
6 
7 #include "../generic/trait/component.hpp"
8 #include "../generic/trait/index.hpp"
9 #include "./diverse.hpp"
10 #include "./normalize.hpp"
11 
12 namespace color
13  {
14   namespace _internal
15    {
16 
17     template
18      <
19        typename category_left_name
20       ,typename category_right_name
21      >
22      struct reformat
23       {
24        public:
25          typedef category_left_name   category_left_type;
26          typedef category_right_name  category_right_type;
27 
28          typedef ::color::_internal::diverse< category_left_type >   diverse_type;
29          typedef ::color::_internal::normalize< category_right_type > normalize_type;
30 
31          typedef typename ::color::trait::component< category_left_name >::return_type          left_component_return_type;
32          typedef typename ::color::trait::index< category_left_name >::model_type         left_index_const_input_type;
33          typedef typename ::color::trait::index< category_left_name >::instance_type            left_index_instance_type;
34 
35          typedef typename ::color::trait::component< category_right_name >::model_type    right_component_const_input_type;
36          typedef typename ::color::trait::index< category_right_name >::model_type        right_index_const_input_type;
37          typedef typename ::color::trait::index< category_right_name >::instance_type           right_index_instance_type;
38 
39          static
40          left_component_return_type
processcolor::_internal::reformat41          process
42           (
43             left_index_const_input_type        left_index
44            ,right_component_const_input_type   right_component
45            ,right_index_const_input_type       right_index
46           )
47           {
48            return diverse_type::process
49             (
50              normalize_type::process
51               (
52                 right_component
53                ,right_index
54               )
55              , left_index
56             );
57           }
58 
59          template
60           <
61            left_index_instance_type left_index_size
62           >
63          static
64          left_component_return_type
processcolor::_internal::reformat65          process
66           (
67             right_component_const_input_type   right_component
68            ,right_index_const_input_type       right_index
69           )
70           {
71            return diverse_type::template process< left_index_size >
72             (
73              normalize_type::process
74               (
75                 right_component
76                ,right_index
77               )
78             );
79           }
80 
81          template
82           <
83             left_index_instance_type  left_index_size
84            ,right_index_instance_type right_index_size
85           >
86          static
87          left_component_return_type
processcolor::_internal::reformat88          process
89           (
90             right_component_const_input_type   right_component
91           )
92           {
93            return diverse_type::template process< left_index_size >
94             (
95              normalize_type::template process< right_index_size >
96               (
97                 right_component
98               )
99             );
100           }
101       };
102 
103     template
104      <
105        typename category_name
106      >
107      struct reformat< category_name, category_name >
108       {
109        public:
110          typedef category_name   category_type;
111 
112          typedef typename ::color::trait::scalar<category_name>::instance_type            scalar_type;
113 
114          typedef typename ::color::trait::component< category_type >::return_type          component_return_type;
115          typedef typename ::color::trait::index< category_type >::model_type         index_const_input_type;
116          typedef typename ::color::trait::index< category_type >::instance_type            index_instance_type;
117 
118          typedef typename ::color::trait::component< category_type >::model_type     component_const_input_type;
119 
120          static
121          component_return_type
processcolor::_internal::reformat122          process
123           (
124             index_const_input_type       left_index
125            ,component_const_input_type   right_component
126            ,index_const_input_type       right_index
127           )
128           {
129            return right_component;
130           }
131 
132          template
133           <
134            index_instance_type left_index_size
135           >
136          static
137          component_return_type
processcolor::_internal::reformat138          process
139           (
140             component_const_input_type   right_component
141            ,index_const_input_type       right_index
142           )
143           {
144            return right_component;
145           }
146 
147          template
148           <
149             index_instance_type  left_index_size
150            ,index_instance_type right_index_size
151           >
152          static
153          component_return_type
processcolor::_internal::reformat154          process
155           (
156             component_const_input_type   right_component
157           )
158           {
159            return right_component;
160           }
161       };
162 
163    }
164  }
165 
166 #endif
167 
168 
169 
170