Simple Application Framework
1
|
00001 /* 00002 This file is part of Simple Application Framework (Saf) library. 00003 Copyright (C) 2010 - 2012 Ondrej Danek <ondrej.danek@gmail.com> 00004 00005 This library is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published 00007 by the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 Saf is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with Simple Application Framework library. If not, 00017 see <http://www.gnu.org/licenses/>. 00018 */ 00019 00028 #ifndef SAF_TYPE_TRAITS_H 00029 #define SAF_TYPE_TRAITS_H 00030 00031 #include "../Type.h" 00032 00033 namespace Saf 00034 { 00036 namespace Type 00037 { 00039 template <class T> 00040 class Traits 00041 { 00042 public: 00047 static bool IsPod() 00048 { 00049 return false; 00050 } 00051 }; 00052 00054 template <> 00055 class Traits<Uint8> 00056 { 00057 public: 00058 static bool IsPod() 00059 { 00060 return true; 00061 } 00062 }; 00063 00064 template <> 00065 class Traits<Uint16> 00066 { 00067 public: 00068 static bool IsPod() 00069 { 00070 return true; 00071 } 00072 }; 00073 00074 template <> 00075 class Traits<Uint32> 00076 { 00077 public: 00078 static bool IsPod() 00079 { 00080 return true; 00081 } 00082 }; 00083 00084 template <> 00085 class Traits<Uint64> 00086 { 00087 public: 00088 static bool IsPod() 00089 { 00090 return true; 00091 } 00092 }; 00093 00094 template <> 00095 class Traits<Int8> 00096 { 00097 public: 00098 static bool IsPod() 00099 { 00100 return true; 00101 } 00102 }; 00103 00104 template <> 00105 class Traits<Int16> 00106 { 00107 public: 00108 static bool IsPod() 00109 { 00110 return true; 00111 } 00112 }; 00113 00114 template <> 00115 class Traits<Int32> 00116 { 00117 public: 00118 static bool IsPod() 00119 { 00120 return true; 00121 } 00122 }; 00123 00124 template <> 00125 class Traits<Int64> 00126 { 00127 public: 00128 static bool IsPod() 00129 { 00130 return true; 00131 } 00132 }; 00133 00134 template <> 00135 class Traits<Float32> 00136 { 00137 public: 00138 static bool IsPod() 00139 { 00140 return true; 00141 } 00142 }; 00143 00144 00145 template <> 00146 class Traits<Float64> 00147 { 00148 public: 00149 static bool IsPod() 00150 { 00151 return true; 00152 } 00153 }; 00158 template <class T> 00159 class Traits<const T> 00160 : public Traits<T> 00161 {}; 00162 00164 template <class T> 00165 class Traits<volatile T> 00166 : public Traits<T> 00167 {}; 00168 00170 template <class T> 00171 class Traits<const volatile T> 00172 : public Traits<T> 00173 {}; 00175 } 00176 } 00177 00178 #endif