ivl 679
ivl/details/core/tool/util.hpp
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>.
00002    A C++ template library extending syntax towards mathematical notation.
00003 
00004    Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr>
00005    Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr>
00006 
00007    ivl is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU Lesser General Public License 
00009    version 3 as published by the Free Software Foundation.
00010 
00011    Alternatively, you can redistribute it and/or modify it under the terms 
00012    of the GNU General Public License version 2 as published by the Free 
00013    Software Foundation.
00014 
00015    ivl is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00018    See the GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License 
00021    and a copy of the GNU Lesser General Public License along 
00022    with ivl. If not, see <http://www.gnu.org/licenses/>. */
00023 
00024 #ifndef IVL_CORE_DETAILS_TOOL_UTIL_HPP
00025 #define IVL_CORE_DETAILS_TOOL_UTIL_HPP
00026 
00027 namespace ivl {
00028 
00029 namespace internal {
00030 
00031 template<class T>
00032 void report(const T& t = T())
00033 {
00034         t.unsupported_method();
00035 }
00036 
00037 template<class IS>
00038 struct report_hlp
00039 {
00040         template<class T, class S>
00041         static inline void f(const array_nd<T, S>& t) {  t.unsupported_method(); }
00042         template<class T, class S>
00043         static inline void f(const array<T, S>& t) { }
00044 };
00045 template<>
00046 struct report_hlp<types::t_false>
00047 {
00048         template<class T>
00049         static inline void f() { }
00050 };
00051 
00052 template<class T>
00053 void nonlin_report(const T& t = T())
00054 {
00055         report_hlp<typename 
00056                 types::is_ivl_array<T>::type>::f(t); 
00057 }
00058 
00059 } /* namespace internal */
00060 /*
00061 template <class InputIterator, class Size, class OutputIterator>
00062 void copy_n(InputIterator first, Size count,
00063         OutputIterator result)
00064 {
00065         while (count--) *result++ = *first++;
00066 }
00067 */
00068 //void handle_exception(const std::exception& e);
00069 
00070 
00071 inline void handle_exception(const std::exception& e)
00072 {
00073         std::cout << std::endl << std::endl << "---------------------------------------" << std::endl;
00074         std::cout << "An exception has occured! : " << std::endl << e.what() << std::endl;
00075         std::cout << "---------------------------------------" << std::endl << std::endl;
00076         throw e;
00077 }
00078 
00079 
00080 
00081 } /* namespace ivl */
00082 
00083 #endif // IVL_CORE_DETAILS_TOOL_UTIL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations