00001 #pragma ident "$Id: DebugUtils.cpp 2938 2011-10-23 19:39:11Z yanweignss $" 00002 00008 //============================================================================ 00009 // 00010 // This file is part of GPSTk, the GPS Toolkit. 00011 // 00012 // The GPSTk is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as published 00014 // by the Free Software Foundation; either version 2.1 of the License, or 00015 // any later version. 00016 // 00017 // The GPSTk is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with GPSTk; if not, write to the Free Software Foundation, 00024 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 // 00026 // Wei Yan - Chinese Academy of Sciences . 2011 00027 // 00028 //============================================================================ 00029 00030 #include "DebugUtils.hpp" 00031 #include <sstream> 00032 00033 namespace gpstk 00034 { 00035 void DebugUtils::assertion(const char* cond, const char* file, int line) 00036 { 00037 throw AssertFailedException(what(cond, file, line)); 00038 } 00039 00040 void DebugUtils::nullPointer(const char* ptr, const char* file, int line) 00041 { 00042 throw NullPointerException(what(ptr, file, line)); 00043 } 00044 00045 std::string DebugUtils::what(const char* msg, const char* file, int line) 00046 { 00047 std::ostringstream str; 00048 if (msg) str << msg << " "; 00049 str << "in file \"" << file << "\", line " << line; 00050 return str.str(); 00051 } 00052 00053 } // End of namespace gpstk 00054
1.3.9.1