ivl 679
ivl/details/array/impl/specialization_details/fixed/fixed_storage.hpp
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>.
00002    A C++ template library extending syntax towards mathematical notation.
00003 
00004    Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr>
00005    Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr>
00006 
00007    ivl is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU Lesser General Public License 
00009    version 3 as published by the Free Software Foundation.
00010 
00011    Alternatively, you can redistribute it and/or modify it under the terms 
00012    of the GNU General Public License version 2 as published by the Free 
00013    Software Foundation.
00014 
00015    ivl is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00018    See the GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License 
00021    and a copy of the GNU Lesser General Public License along 
00022    with ivl. If not, see <http://www.gnu.org/licenses/>. */
00023 
00024 #ifndef IVL_ARRAY_SPECIALIZATION_DETAILS_FIXED_STORAGE_HPP
00025 #define IVL_ARRAY_SPECIALIZATION_DETAILS_FIXED_STORAGE_HPP
00026 
00027 namespace ivl {
00028 namespace array_details {
00029 
00030 template<class T, int N, class NAMING>
00031 class fixed_storage
00032 {
00033 public:
00034         T base_ptr[N];
00035 };
00036 
00038 template<>
00039 class fixed_storage<size_t, 2, data::point_naming>
00040 {
00041         typedef size_t t;
00042 public:
00043         union {
00044                 t base_ptr[2];
00045                 struct { t y; t x; };
00046                 struct { t r; t c; };
00047         };
00048 };
00049 
00050 template<>
00051 class fixed_storage<size_t, 3, data::point_naming>
00052 {
00053         typedef size_t t;
00054 public:
00055         union {
00056                 t base_ptr[3];
00057                 struct { t y; t x; t z; };
00058                 struct { t r; t c; };
00059         };
00060 };
00061 
00062 template<>
00063 class fixed_storage<int, 2, data::point_naming>
00064 {
00065         typedef int t;
00066 public:
00067         union {
00068                 t base_ptr[2];
00069                 struct { t y; t x; };
00070                 struct { t r; t c; };
00071         };
00072 };
00073 
00074 template<>
00075 class fixed_storage<int, 3, data::point_naming>
00076 {
00077         typedef int t;
00078 public:
00079         union {
00080                 t base_ptr[3];
00081                 struct { t y; t x; t z; };
00082                 struct { t r; t c; };
00083         };
00084 };
00085 
00086 template<>
00087 class fixed_storage<double, 2, data::point_naming>
00088 {
00089         typedef double t;
00090 public:
00091         union {
00092                 t base_ptr[2];
00093                 struct { t y; t x; };
00094         };
00095 };
00096 
00097 template<>
00098 class fixed_storage<double, 3, data::point_naming>
00099 {
00100         typedef double t;
00101 public:
00102         union {
00103                 t base_ptr[3];
00104                 struct { t y; t x; t z; };
00105         };
00106 };
00107 
00108 template<>
00109 class fixed_storage<float, 2, data::point_naming>
00110 {
00111         typedef float t;
00112 public:
00113         union {
00114                 t base_ptr[2];
00115                 struct { t y; t x; };
00116         };
00117 };
00118 
00119 template<>
00120 class fixed_storage<float, 3, data::point_naming>
00121 {
00122         typedef float t;
00123 public:
00124         union {
00125                 t base_ptr[3];
00126                 struct { t y; t x; t z; };
00127         };
00128 };
00129 
00131 template<>
00132 class fixed_storage<size_t, 2, data::dims_naming>
00133 {
00134         typedef size_t t;
00135 public:
00136         union {
00137                 t base_ptr[2];
00138                 struct { t h; t w; };
00139         };
00140 };
00141 
00142 template<>
00143 class fixed_storage<size_t, 3, data::dims_naming>
00144 {
00145         typedef size_t t;
00146 public:
00147         union {
00148                 t base_ptr[3];
00149                 struct { t h; t w; t d; };
00150         };
00151 };
00152 
00153 template<>
00154 class fixed_storage<int, 2, data::dims_naming>
00155 {
00156         typedef int t;
00157 public:
00158         union {
00159                 t base_ptr[2];
00160                 struct { t h; t w; };
00161         };
00162 };
00163 
00164 template<>
00165 class fixed_storage<int, 3, data::dims_naming>
00166 {
00167         typedef int t;
00168 public:
00169         union {
00170                 t base_ptr[3];
00171                 struct { t h; t w; t d; };
00172         };
00173 };
00174 
00175 template<>
00176 class fixed_storage<double, 2, data::dims_naming>
00177 {
00178         typedef double t;
00179 public:
00180         union {
00181                 t base_ptr[2];
00182                 struct { t h; t w; };
00183         };
00184 };
00185 
00186 template<>
00187 class fixed_storage<double, 3, data::dims_naming>
00188 {
00189         typedef double t;
00190 public:
00191         union {
00192                 t base_ptr[3];
00193                 struct { t h; t w; t d; };
00194         };
00195 };
00196 
00197 template<>
00198 class fixed_storage<float, 2, data::dims_naming>
00199 {
00200         typedef float t;
00201 public:
00202         union {
00203                 t base_ptr[2];
00204                 struct { t h; t w; };
00205         };
00206 };
00207 
00208 template<>
00209 class fixed_storage<float, 3, data::dims_naming>
00210 {
00211         typedef float t;
00212 public:
00213         union {
00214                 t base_ptr[3];
00215                 struct { t h; t w; t d; };
00216         };
00217 };
00218 
00221 
00222 template<>
00223 class fixed_storage<unsigned char, 1, data::color_naming>
00224 {
00225         typedef unsigned char t;
00226 public:
00227         union {
00228                 t base_ptr[1];
00229                 struct { t gray; };
00230         };
00231 };
00232 
00233 template<>
00234 class fixed_storage<char, 1, data::color_naming>
00235 {
00236         typedef char t;
00237 public:
00238         union {
00239                 t base_ptr[1];
00240                 struct { t gray; };
00241         };
00242 };
00243 
00244 template<>
00245 class fixed_storage<short, 1, data::color_naming>
00246 {
00247         typedef short t;
00248 public:
00249         union {
00250                 t base_ptr[1];
00251                 struct { t gray; };
00252         };
00253 };
00254 
00255 template<>
00256 class fixed_storage<int, 1, data::color_naming>
00257 {
00258         typedef int t;
00259 public:
00260         union {
00261                 t base_ptr[1];
00262                 struct { t gray; };
00263         };
00264 };
00265 
00266 template<>
00267 class fixed_storage<float, 1, data::color_naming>
00268 {
00269         typedef float t;
00270 public:
00271         union {
00272                 t base_ptr[1];
00273                 struct { t gray; };
00274         };
00275 };
00276 
00277 template<>
00278 class fixed_storage<double, 1, data::color_naming>
00279 {
00280         typedef double t;
00281 public:
00282         union {
00283                 t base_ptr[1];
00284                 struct { t gray; };
00285         };
00286 };
00287 //
00288 template<>
00289 class fixed_storage<unsigned char, 3, data::color_naming>
00290 {
00291         typedef unsigned char t;
00292 public:
00293         union {
00294                 t base_ptr[3];
00295                 struct { t r; t g; t b; };
00296         };
00297 };
00298 
00299 template<>
00300 class fixed_storage<char, 3, data::color_naming>
00301 {
00302         typedef char t;
00303 public:
00304         union {
00305                 t base_ptr[3];
00306                 struct { t r; t g; t b; };
00307         };
00308 };
00309 
00310 template<>
00311 class fixed_storage<short, 3, data::color_naming>
00312 {
00313         typedef short t;
00314 public:
00315         union {
00316                 t base_ptr[3];
00317                 struct { t r; t g; t b; };
00318         };
00319 };
00320 
00321 template<>
00322 class fixed_storage<int, 3, data::color_naming>
00323 {
00324         typedef int t;
00325 public:
00326         union {
00327                 t base_ptr[3];
00328                 struct { t r; t g; t b; };
00329         };
00330 };
00331 
00332 template<>
00333 class fixed_storage<float, 3, data::color_naming>
00334 {
00335         typedef float t;
00336 public:
00337         union {
00338                 t base_ptr[3];
00339                 struct { t r; t g; t b; };
00340         };
00341 };
00342 
00343 template<>
00344 class fixed_storage<double, 3, data::color_naming>
00345 {
00346         typedef double t;
00347 public:
00348         union {
00349                 t base_ptr[3];
00350                 struct { t r; t g; t b; };
00351         };
00352 };
00353 //
00354 template<>
00355 class fixed_storage<unsigned char, 4, data::color_naming>
00356 {
00357         typedef unsigned char t;
00358 public:
00359         union {
00360                 t base_ptr[4];
00361                 struct { t r; t g; t b; t a; };
00362         };
00363 };
00364 
00365 template<>
00366 class fixed_storage<char, 4, data::color_naming>
00367 {
00368         typedef char t;
00369 public:
00370         union {
00371                 t base_ptr[4];
00372                 struct { t r; t g; t b; t a; };
00373         };
00374 };
00375 
00376 template<>
00377 class fixed_storage<short, 4, data::color_naming>
00378 {
00379         typedef short t;
00380 public:
00381         union {
00382                 t base_ptr[4];
00383                 struct { t r; t g; t b; t a; };
00384         };
00385 };
00386 
00387 template<>
00388 class fixed_storage<int, 4, data::color_naming>
00389 {
00390         typedef int t;
00391 public:
00392         union {
00393                 t base_ptr[4];
00394                 struct { t r; t g; t b; t a; };
00395         };
00396 };
00397 
00398 template<>
00399 class fixed_storage<float, 4, data::color_naming>
00400 {
00401         typedef float t;
00402 public:
00403         union {
00404                 t base_ptr[4];
00405                 struct { t r; t g; t b; t a; };
00406         };
00407 };
00408 
00409 template<>
00410 class fixed_storage<double, 4, data::color_naming>
00411 {
00412         typedef double t;
00413 public:
00414         union {
00415                 t base_ptr[4];
00416                 struct { t r; t g; t b; t a; };
00417         };
00418 };
00419 //
00420 
00421 } /* namespace array_details */
00422 } /* namespace ivl */
00423 
00424 #endif // IVL_ARRAY_SPECIALIZATION_DETAILS_FIXED_STORAGE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations