00001 /* 00002 * BEEN: Benchmarking Environment 00003 * ============================== 00004 * 00005 * File author: Branislav Repcek 00006 * 00007 * GNU Lesser General Public License Version 2.1 00008 * --------------------------------------------- 00009 * Copyright (C) 2004-2006 Distributed Systems Research Group, 00010 * Faculty of Mathematics and Physics, Charles University in Prague 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License version 2.1, as published by the Free Software Foundation. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00024 * MA 02111-1307 USA 00025 */ 00026 00034 #ifndef COMPILE_TIME_CHECK_INCLUDED 00035 #define COMPILE_TIME_CHECK_INCLUDED 00036 00037 namespace lm 00038 { 00041 namespace util 00042 { 00045 template< bool > 00046 struct CompileTimeChecker; 00047 00050 template< > 00051 struct CompileTimeChecker< true > 00052 { 00053 }; 00054 } // namespace lm::util 00055 00056 /* This will test if given expression evaluates to true. If yes, it will compile 00057 * as an empty statement without side-effect. If not, it will create error message 00058 * about undefined (or incomplete) type which cannot be used. Name of the type that 00059 * will be reported in message will be ERROR_message (that is, concatenation of 00060 * the message parameter with the ERROR_ string). Therefore message parameter has 00061 * to be valid C++ identifier. 00062 */ 00063 #define COMPILE_TIME_CHECK(expression, message) \ 00064 { \ 00065 ::lm::util::CompileTimeChecker< (expression) > ERROR_##message; \ 00066 (void) ERROR_##message; \ 00067 } 00068 00069 } // namespace lm 00070 00071 #endif