
00001 /*!@file Util/Types.H Basic integer types */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Util/Types.H $ 00035 // $Id: Types.H 10035 2008-08-03 20:31:48Z ilab24 $ 00036 // 00037 00038 #ifndef TYPES_H_DEFINED 00039 #define TYPES_H_DEFINED 00040 00041 // ###################################################################### 00042 // type definitions 00043 00044 //! Makes a <i>type</i> a typedef for \a T only if \a B is true. 00045 template <class T, bool B> 00046 struct type_if {}; 00047 00048 template <class T> 00049 struct type_if<T, true> { typedef T type; }; 00050 00051 //! A compile-time check that \a T has \a N bits. 00052 template <class T, unsigned long N> 00053 struct type_with_N_bits 00054 { 00055 typedef typename type_if<T, sizeof(T)*8 == N>::type type; 00056 }; 00057 00058 // Now use the type_if and type_with_N_bits helper structs to make some 00059 // fixed-size integer typedef's. If the stated bit-size does not match the 00060 // given type, then we get a compile-time error. 00061 00062 //! 8-bit unsigned integer 00063 typedef type_with_N_bits<unsigned char, 8>::type byte; 00064 00065 //! 16-bit signed integer 00066 typedef type_with_N_bits<short, 16>::type int16; 00067 00068 //! 16-bit unsigned integer 00069 typedef type_with_N_bits<unsigned short, 16>::type uint16; 00070 00071 //! 32-bit signed integer 00072 typedef type_with_N_bits<int, 32>::type int32; 00073 00074 //! 32-bit unsigned integer 00075 typedef type_with_N_bits<unsigned int, 32>::type uint32; 00076 00077 //! 64-bit signed integer 00078 typedef type_with_N_bits<long long int, 64>::type int64; 00079 00080 #ifndef NOTDEFINE_UINT64 // for not conflict with the uint64 in xclib 00081 //! 64-bit unsigned integer 00082 typedef type_with_N_bits<unsigned long long int, 64>::type uint64; 00083 #endif // !NOTDEFINE_UINT64 00084 00085 //! Canonical unsigned short int 00086 typedef unsigned short int ushort; 00087 00088 //! Canonical unsigned int 00089 typedef unsigned int uint; 00090 00091 //! Canonical unsigned long int 00092 typedef unsigned long int ulong; 00093 00094 #endif // !TYPES_H_DEFINED
1.4.4