Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

matfile/matfile_concepts/src/traits.hh
Go to the documentation of this file.
00001 /*
00002     This file is part of matfile.
00003 
00004     Copyright (C) 2010-2011 Andrea Arteaga <arteagaa@student.ethz.ch>
00005 
00006     matfile is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU Lesser General Public License as published
00008     by the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 
00011     matfile is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public License
00017     along with matfile.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 #ifndef TRAITS_HPP_
00021 #define TRAITS_HPP_
00022 
00023 /* NumTraits */
00024 
00025 template<class C> struct NumTraits { };
00026 template<> struct NumTraits<miINT8_t>
00027 {
00028     enum { isComplex = 0, size = 1, MatType = miINT8, matrixClass = mxINT8_CLASS };
00029     typedef miINT8_t Real;
00030 };
00031 template<> struct NumTraits<miUINT8_t>
00032 {
00033     enum { isComplex = 0, size = 1, MatType = miUINT8, matrixClass = mxUINT8_CLASS };
00034     typedef miUINT8_t Real;
00035 };
00036 template<> struct NumTraits<miINT16_t>
00037 {
00038     enum { isComplex = 0, size = 2, MatType = miINT16, matrixClass = mxINT16_CLASS };
00039     typedef miINT16_t Real;
00040 };
00041 template<> struct NumTraits<miUINT16_t>
00042 {
00043     enum { isComplex = 0, size = 2, MatType = miUINT16, matrixClass = mxUINT16_CLASS };
00044     typedef miUINT16_t Real;
00045 };
00046 template<> struct NumTraits<miINT32_t>
00047 {
00048     enum { isComplex = 0, size = 4, MatType = miINT32, matrixClass = mxINT32_CLASS };
00049     typedef miINT32_t Real;
00050 };
00051 template<> struct NumTraits<miUINT32_t>
00052 {
00053     enum { isComplex = 0, size = 4, MatType = miUINT32, matrixClass = mxUINT32_CLASS };
00054     typedef miUINT32_t Real;
00055 };
00056 template<> struct NumTraits<miINT64_t>
00057 {
00058     enum { isComplex = 0, size = 8, MatType = miINT64, matrixClass = -1 };
00059     typedef miINT64_t Real;
00060 };
00061 template<> struct NumTraits<miUINT64_t>
00062 {
00063     enum { isComplex = 0, size = 8, MatType = miUINT64, matrixClass = -1 };
00064     typedef miUINT64_t Real;
00065 };
00066 template<> struct NumTraits<miSINGLE_t>
00067 {
00068     enum { isComplex = 0, size = 4, MatType = miSINGLE, matrixClass = mxSINGLE_CLASS };
00069     typedef miSINGLE_t Real;
00070 };
00071 template<> struct NumTraits<miDOUBLE_t>
00072 {
00073     enum { isComplex = 0, size = 8, MatType = miDOUBLE, matrixClass = mxDOUBLE_CLASS };
00074     typedef miDOUBLE_t Real;
00075 };
00076 template<class S> struct NumTraits<std::complex<S> >
00077 {
00078     enum { isComplex = 1, size = NumTraits<S>::size, MatType = NumTraits<S>::MatType, matrixClass = NumTraits<S>::matrixClass };
00079     typedef S Real;
00080 };
00081 
00082 
00083 
00084 #endif /* TRAITS_HPP_ */

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)