working version with calibration done

Fork of Eurobot2013 by Oskar Weigl

Committer:
xiaxia686
Date:
Tue Apr 09 15:32:47 2013 +0000
Revision:
11:5ba926692210
Parent:
1:6799c07fe510
woking version (calibrated)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sv 1:6799c07fe510 1 /*
sv 1:6799c07fe510 2 * Tiny Vector Matrix Library
sv 1:6799c07fe510 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
sv 1:6799c07fe510 4 *
sv 1:6799c07fe510 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
sv 1:6799c07fe510 6 *
sv 1:6799c07fe510 7 * This library is free software; you can redistribute it and/or
sv 1:6799c07fe510 8 * modify it under the terms of the GNU Lesser General Public
sv 1:6799c07fe510 9 * License as published by the Free Software Foundation; either
sv 1:6799c07fe510 10 * version 2.1 of the License, or (at your option) any later version.
sv 1:6799c07fe510 11 *
sv 1:6799c07fe510 12 * This library is distributed in the hope that it will be useful,
sv 1:6799c07fe510 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
sv 1:6799c07fe510 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
sv 1:6799c07fe510 15 * Lesser General Public License for more details.
sv 1:6799c07fe510 16 *
sv 1:6799c07fe510 17 * You should have received a copy of the GNU Lesser General Public
sv 1:6799c07fe510 18 * License along with this library; if not, write to the Free Software
sv 1:6799c07fe510 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
sv 1:6799c07fe510 20 *
sv 1:6799c07fe510 21 * $Id: TvmetBase.h,v 1.17 2007-06-23 15:58:58 opetzold Exp $
sv 1:6799c07fe510 22 */
sv 1:6799c07fe510 23
sv 1:6799c07fe510 24 #ifndef TVMET_BASE_H
sv 1:6799c07fe510 25 #define TVMET_BASE_H
sv 1:6799c07fe510 26
sv 1:6799c07fe510 27 #include <iostream>//<iosfwd> // io streams forward declaration
sv 1:6799c07fe510 28 #include <typeinfo> // rtti: used by Xpr.h level printing
sv 1:6799c07fe510 29 #include <cmath> // unary and binary math
sv 1:6799c07fe510 30 #include <cstdlib> // labs
sv 1:6799c07fe510 31
sv 1:6799c07fe510 32 #if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER == 1310)
sv 1:6799c07fe510 33 #include <string> // operator<<(ostream) here defined
sv 1:6799c07fe510 34 #endif
sv 1:6799c07fe510 35
sv 1:6799c07fe510 36 #if defined(__APPLE_CC__)
sv 1:6799c07fe510 37 // Mac OS X builds seems to miss these functions inside cmath
sv 1:6799c07fe510 38 extern "C" int isnan(double);
sv 1:6799c07fe510 39 extern "C" int isinf(double);
sv 1:6799c07fe510 40 #endif
sv 1:6799c07fe510 41
sv 1:6799c07fe510 42 namespace tvmet {
sv 1:6799c07fe510 43
sv 1:6799c07fe510 44
sv 1:6799c07fe510 45 /**
sv 1:6799c07fe510 46 * \class TvmetBase TvmetBase.h "tvmet/TvmetBase.h"
sv 1:6799c07fe510 47 * \brief Base class
sv 1:6799c07fe510 48 * Used for static polymorph call of print_xpr
sv 1:6799c07fe510 49 */
sv 1:6799c07fe510 50 template<class E> class TvmetBase { };
sv 1:6799c07fe510 51
sv 1:6799c07fe510 52
sv 1:6799c07fe510 53 /**
sv 1:6799c07fe510 54 * \class IndentLevel TvmetBase.h "tvmet/TvmetBase.h"
sv 1:6799c07fe510 55 * \brief Prints the level indent.
sv 1:6799c07fe510 56 */
sv 1:6799c07fe510 57 class IndentLevel : public TvmetBase< IndentLevel >
sv 1:6799c07fe510 58 {
sv 1:6799c07fe510 59 public:
sv 1:6799c07fe510 60 IndentLevel(std::size_t level) : m_level(level) { }
sv 1:6799c07fe510 61
sv 1:6799c07fe510 62 std::ostream& print_xpr(std::ostream& os) const {
sv 1:6799c07fe510 63 for(std::size_t i = 0; i != m_level; ++i) os << " ";
sv 1:6799c07fe510 64 return os;
sv 1:6799c07fe510 65 }
sv 1:6799c07fe510 66
sv 1:6799c07fe510 67 private:
sv 1:6799c07fe510 68 std::size_t m_level;
sv 1:6799c07fe510 69 };
sv 1:6799c07fe510 70
sv 1:6799c07fe510 71
sv 1:6799c07fe510 72 /**
sv 1:6799c07fe510 73 * \fn operator<<(std::ostream& os, const TvmetBase<E>& e)
sv 1:6799c07fe510 74 * \brief overloaded ostream operator using static polymorphic.
sv 1:6799c07fe510 75 * \ingroup _binary_operator
sv 1:6799c07fe510 76 */
sv 1:6799c07fe510 77 template<class E>
sv 1:6799c07fe510 78 inline
sv 1:6799c07fe510 79 std::ostream& operator<<(std::ostream& os, const TvmetBase<E>& e) {
sv 1:6799c07fe510 80 static_cast<const E&>(e).print_xpr(os);
sv 1:6799c07fe510 81 return os;
sv 1:6799c07fe510 82 }
sv 1:6799c07fe510 83
sv 1:6799c07fe510 84
sv 1:6799c07fe510 85 /**
sv 1:6799c07fe510 86 * \class dispatch TvmetBase.h "tvmet/TvmetBase.h"
sv 1:6799c07fe510 87 * \brief Class helper to distuingish between e.g. meta
sv 1:6799c07fe510 88 * and loop strategy used.
sv 1:6799c07fe510 89 */
sv 1:6799c07fe510 90 template<bool> struct dispatch;
sv 1:6799c07fe510 91
sv 1:6799c07fe510 92 /**
sv 1:6799c07fe510 93 * \class dispatch<true> TvmetBase.h "tvmet/TvmetBase.h"
sv 1:6799c07fe510 94 * \brief specialized.
sv 1:6799c07fe510 95 */
sv 1:6799c07fe510 96 template<> struct dispatch<true> { };
sv 1:6799c07fe510 97
sv 1:6799c07fe510 98 /**
sv 1:6799c07fe510 99 * \class dispatch<false> TvmetBase.h "tvmet/TvmetBase.h"
sv 1:6799c07fe510 100 * \brief specialized.
sv 1:6799c07fe510 101 */
sv 1:6799c07fe510 102 template<> struct dispatch<false> { };
sv 1:6799c07fe510 103
sv 1:6799c07fe510 104
sv 1:6799c07fe510 105 } // namespace tvmet
sv 1:6799c07fe510 106
sv 1:6799c07fe510 107 #endif // TVMET_BASE_H
sv 1:6799c07fe510 108
sv 1:6799c07fe510 109 // Local Variables:
sv 1:6799c07fe510 110 // mode:C++
sv 1:6799c07fe510 111 // tab-width:8
sv 1:6799c07fe510 112 // End: