Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Eurobot_2012_Secondary by
Io.h
00001 /* 00002 * Tiny Vector Matrix Library 00003 * Dense Vector Matrix Libary of Tiny size using Expression Templates 00004 * 00005 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * $Id: Io.h,v 1.8 2007-06-23 15:58:58 opetzold Exp $ 00022 */ 00023 00024 #ifndef TVMET_IO_H 00025 #define TVMET_IO_H 00026 00027 namespace tvmet { 00028 00029 /** 00030 * \class IoPrintHelper Io.h "tvmet/Io.h" 00031 * \brief Determines the number of digits regarding the sign of the 00032 * container. 00033 * This class is nesessary due to the complex type and the 00034 * function min(), which are not defined for this type. 00035 * So we have to dispatch between pod and complex types 00036 * to get an information about the extra space for signs. 00037 */ 00038 template<class C> 00039 class IoPrintHelper { 00040 IoPrintHelper(); 00041 IoPrintHelper(const IoPrintHelper&); 00042 IoPrintHelper& operator=(const IoPrintHelper&); 00043 00044 private: 00045 static std::streamsize width(const C& e) { 00046 std::streamsize w = static_cast<std::streamsize>(std::log10(max(abs(e)))+1); 00047 return w > 0 ? w : 0; 00048 } 00049 00050 public: 00051 static std::streamsize width(dispatch<true>, const C& e) { 00052 return width(e); 00053 } 00054 static std::streamsize width(dispatch<false>, const C& e) { 00055 std::streamsize w = width(e); 00056 if(min(e) < 0) return w+1; 00057 else return w; 00058 } 00059 }; 00060 00061 00062 } 00063 00064 #endif /* TVMET_IO_H */ 00065 00066 // Local Variables: 00067 // mode:C++ 00068 // tab-width:8 00069 // End:
Generated on Tue Jul 12 2022 21:02:13 by
