Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ShUtility.hpp

00001 // Sh: A GPU metaprogramming language. 00002 // 00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory 00004 // Project administrator: Michael D. McCool 00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa, 00006 // Michael D. McCool 00007 // 00008 // This software is provided 'as-is', without any express or implied 00009 // warranty. In no event will the authors be held liable for any damages 00010 // arising from the use of this software. 00011 // 00012 // Permission is granted to anyone to use this software for any purpose, 00013 // including commercial applications, and to alter it and redistribute it 00014 // freely, subject to the following restrictions: 00015 // 00016 // 1. The origin of this software must not be misrepresented; you must 00017 // not claim that you wrote the original software. If you use this 00018 // software in a product, an acknowledgment in the product documentation 00019 // would be appreciated but is not required. 00020 // 00021 // 2. Altered source versions must be plainly marked as such, and must 00022 // not be misrepresented as being the original software. 00023 // 00024 // 3. This notice may not be removed or altered from any source 00025 // distribution. 00027 #ifndef SHUTILITY_HPP 00028 #define SHUTILITY_HPP 00029 00034 #include <iosfwd> 00035 #include "ShDllExport.hpp" 00036 00037 namespace SH { 00038 00040 SH_DLLEXPORT 00041 std::ostream& shPrintIndent(std::ostream& out, int indent); 00042 00046 template<bool B> struct ShCompileTimeChecker 00047 { 00048 ShCompileTimeChecker(...); 00049 }; 00050 template<> struct ShCompileTimeChecker<false> { 00051 }; 00052 00053 #define SH_STATIC_CHECK(expr, msg) \ 00054 { \ 00055 class SH_ERROR_##msg {} y; \ 00056 (void)sizeof(ShCompileTimeChecker<(expr)>(y));\ 00057 } 00058 00059 struct 00060 SH_DLLEXPORT ShIgnore { 00061 template<typename T> 00062 T& operator&(T& other) { return other; } 00063 }; 00064 00066 template<bool B, typename T1, typename T2> 00067 struct SelectType; 00068 00069 template<typename T1, typename T2> 00070 struct SelectType<true, T1, T2> { 00071 typedef T1 type; 00072 }; 00073 00074 template<typename T1, typename T2> 00075 struct SelectType<false, T1, T2> { 00076 typedef T2 type; 00077 }; 00078 00079 } 00080 00081 #endif

Generated on Mon Oct 18 14:17:40 2004 for Sh by doxygen 1.3.7