|
degate 0.1.1
|
00001 /* -*-c++-*- 00002 00003 This file is part of the IC reverse engineering tool degate. 00004 00005 Copyright 2008, 2009, 2010 by Martin Schobert 00006 00007 Degate is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 any later version. 00011 00012 Degate is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with degate. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 #ifndef __TYPETRAITS_H__ 00023 #define __TYPETRAITS_H__ 00024 00025 #include <PixelPolicies.h> 00026 00027 namespace degate { 00028 00029 /** 00030 * A pointer trait for the generic type T. 00031 * @todo use boost version instead. 00032 */ 00033 00034 template<typename T> 00035 struct is_pointer { 00036 static const bool value = false; 00037 }; 00038 00039 /** 00040 * A pointer trait for the generic type T *. 00041 * @todo use boost version instead. 00042 */ 00043 00044 template<typename T> 00045 struct is_pointer<T*> { 00046 static const bool value = true; 00047 }; 00048 00049 /** 00050 * A pointer trait for the special shared pointer of type T. 00051 * @todo use boost version instead. 00052 */ 00053 00054 template<typename T> 00055 struct is_pointer<std::tr1::shared_ptr<T> > { 00056 static const bool value = true; 00057 }; 00058 00059 00060 /** 00061 * Method parameter type trait for pointer and shared pointer. 00062 */ 00063 00064 template<typename T, bool b> 00065 struct call_trait { 00066 typedef T param_type; 00067 }; 00068 00069 /** 00070 * Method parameter type trait for normal object that should be passed via reference. 00071 */ 00072 00073 template<typename T> 00074 struct call_trait<T, false> { 00075 typedef T& param_type; 00076 }; 00077 00078 00079 /** 00080 * Type trait for multi channel images. 00081 */ 00082 00083 template<class PixelType> 00084 struct is_single_channel_image { 00085 static const bool value = true; 00086 }; 00087 00088 /** 00089 * Type trait for single channel images. 00090 */ 00091 00092 template<> 00093 struct is_single_channel_image<rgba_pixel_t> { 00094 static const bool value = false; 00095 }; 00096 00097 00098 } 00099 00100 #endif
1.7.4