From 887ff84376ffb5aae81bdf56cb27fca6ffd606eb Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 1 Jun 2007 07:16:33 +0000 Subject: [PATCH] remove custom assert system and use plain standard asserts instead. we don't need no complication. --- tvmet-1.7.1/include/tvmet/Matrix.h | 15 +++--- tvmet-1.7.1/include/tvmet/RunTimeError.h | 65 ------------------------ tvmet-1.7.1/include/tvmet/Vector.h | 15 +++--- 3 files changed, 14 insertions(+), 81 deletions(-) delete mode 100644 tvmet-1.7.1/include/tvmet/RunTimeError.h diff --git a/tvmet-1.7.1/include/tvmet/Matrix.h b/tvmet-1.7.1/include/tvmet/Matrix.h index c04f45040..f10ed1755 100644 --- a/tvmet-1.7.1/include/tvmet/Matrix.h +++ b/tvmet-1.7.1/include/tvmet/Matrix.h @@ -24,12 +24,12 @@ #ifndef TVMET_MATRIX_H #define TVMET_MATRIX_H -#include // reverse_iterator +#include // reverse_iterator +#include #include #include #include -#include #include #include @@ -92,7 +92,7 @@ public: public: // access operators /** access by index. */ value_type operator()(std::size_t i, std::size_t j) const { - TVMET_RT_CONDITION((i < Rows) && (j < Cols), "MatrixConstReference Bounce Violation") + assert((i < Rows) && (j < Cols)); return m_data[i * Cols + j]; } @@ -226,8 +226,7 @@ public: template explicit Matrix(InputIterator first, InputIterator last) { - TVMET_RT_CONDITION(static_cast(std::distance(first, last)) <= Size, - "InputIterator doesn't fits in size" ) + assert(static_cast(std::distance(first, last)) <= Size); std::copy(first, last, m_data); } @@ -238,7 +237,7 @@ public: template explicit Matrix(InputIterator first, std::size_t sz) { - TVMET_RT_CONDITION(sz <= Size, "InputIterator doesn't fits in size" ) + assert(sz <= Size); std::copy(first, first + sz, m_data); } @@ -269,12 +268,12 @@ public: // access operators public: // index access operators value_type& _tvmet_restrict operator()(std::size_t i, std::size_t j) { // Note: g++-2.95.3 does have problems on typedef reference - TVMET_RT_CONDITION((i < Rows) && (j < Cols), "Matrix Bounce Violation") + assert((i < Rows) && (j < Cols)); return m_data[i * Cols + j]; } value_type operator()(std::size_t i, std::size_t j) const { - TVMET_RT_CONDITION((i < Rows) && (j < Cols), "Matrix Bounce Violation") + assert((i < Rows) && (j < Cols)); return m_data[i * Cols + j]; } diff --git a/tvmet-1.7.1/include/tvmet/RunTimeError.h b/tvmet-1.7.1/include/tvmet/RunTimeError.h deleted file mode 100644 index 2ce4269a1..000000000 --- a/tvmet-1.7.1/include/tvmet/RunTimeError.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Tiny Vector Matrix Library - * Dense Vector Matrix Libary of Tiny size using Expression Templates - * - * Copyright (C) 2001 - 2003 Olaf Petzold - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id: RunTimeError.h,v 1.9 2003/11/30 08:26:25 opetzold Exp $ - */ - -#ifndef TVMET_RUN_TIME_ERROR_H -#define TVMET_RUN_TIME_ERROR_H - -#include - - -namespace tvmet { - - -/** - * \def TVMET_RT_CONDITION(XPR, MSG) - * \brief If TVMET_DEBUG is defined it checks the condition XPR and prints - * an error message MSG at runtime. - */ -#if defined(TVMET_DEBUG) - -#define TVMET_RT_CONDITION(XPR, MSG) { \ - if(!(XPR)) { \ - std::cerr << "[tvmet] Precondition failure in " << __FILE__ \ - << ", line " << __LINE__ << ": " \ - << MSG << std::endl; \ - std::cerr.flush(); \ - assert(0); \ - } \ -} - -#else - -#define TVMET_RT_CONDITION(XPR, MSG) - -#endif - - -} // namespace tvmet - - -#endif // TVMET_RUN_TIME_ERROR_H - - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/Vector.h b/tvmet-1.7.1/include/tvmet/Vector.h index 1e87e1d3a..24a514233 100644 --- a/tvmet-1.7.1/include/tvmet/Vector.h +++ b/tvmet-1.7.1/include/tvmet/Vector.h @@ -24,12 +24,12 @@ #ifndef TVMET_VECTOR_H #define TVMET_VECTOR_H -#include // reverse_iterator +#include // reverse_iterator +#include #include #include #include -#include #include @@ -83,7 +83,7 @@ public: public: // access operators /** access by index. */ value_type operator()(std::size_t i) const { - TVMET_RT_CONDITION(i < Size, "VectorConstReference Bounce Violation") + assert(i < Size); return m_data[i]; } @@ -214,8 +214,7 @@ public: template explicit Vector(InputIterator first, InputIterator last) { - TVMET_RT_CONDITION( static_cast(std::distance(first, last)) <= Size, - "InputIterator doesn't fits in size" ) + assert( static_cast(std::distance(first, last)) <= Size); std::copy(first, last, m_data); } @@ -226,7 +225,7 @@ public: template explicit Vector(InputIterator first, std::size_t sz) { - TVMET_RT_CONDITION( sz <= Size, "InputIterator doesn't fits in size" ) + assert(sz <= Size); std::copy(first, first + sz, m_data); } @@ -333,12 +332,12 @@ public: // access operators public: // index access operators value_type& _tvmet_restrict operator()(std::size_t i) { // Note: g++-2.95.3 does have problems on typedef reference - TVMET_RT_CONDITION(i < Size, "Vector Bounce Violation") + assert(i < Size); return m_data[i]; } value_type operator()(std::size_t i) const { - TVMET_RT_CONDITION(i < Size, "Vector Bounce Violation") + assert(i < Size); return m_data[i]; }