2014 Eurobot fork

Dependencies:   mbed-rtos mbed QEI

Committer:
rsavitski
Date:
Tue Oct 15 12:19:32 2013 +0000
Revision:
92:4a1225fbb146
Parent:
15:9c5aaeda36dc
touch: ripped out 2013-specific bits. Need to address "2014" comments. Rewrite AI layer and other deleted parts.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
madcowswe 15:9c5aaeda36dc 1 /*
madcowswe 15:9c5aaeda36dc 2 * Tiny Vector Matrix Library
madcowswe 15:9c5aaeda36dc 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
madcowswe 15:9c5aaeda36dc 4 *
madcowswe 15:9c5aaeda36dc 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
madcowswe 15:9c5aaeda36dc 6 *
madcowswe 15:9c5aaeda36dc 7 * This library is free software; you can redistribute it and/or
madcowswe 15:9c5aaeda36dc 8 * modify it under the terms of the GNU Lesser General Public
madcowswe 15:9c5aaeda36dc 9 * License as published by the Free Software Foundation; either
madcowswe 15:9c5aaeda36dc 10 * version 2.1 of the License, or (at your option) any later version.
madcowswe 15:9c5aaeda36dc 11 *
madcowswe 15:9c5aaeda36dc 12 * This library is distributed in the hope that it will be useful,
madcowswe 15:9c5aaeda36dc 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
madcowswe 15:9c5aaeda36dc 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
madcowswe 15:9c5aaeda36dc 15 * Lesser General Public License for more details.
madcowswe 15:9c5aaeda36dc 16 *
madcowswe 15:9c5aaeda36dc 17 * You should have received a copy of the GNU Lesser General Public
madcowswe 15:9c5aaeda36dc 18 * License along with this library; if not, write to the Free Software
madcowswe 15:9c5aaeda36dc 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
madcowswe 15:9c5aaeda36dc 20 *
madcowswe 15:9c5aaeda36dc 21 * $Id: Literal.h,v 1.13 2007-06-23 15:58:59 opetzold Exp $
madcowswe 15:9c5aaeda36dc 22 */
madcowswe 15:9c5aaeda36dc 23
madcowswe 15:9c5aaeda36dc 24 #ifndef TVMET_XPR_LITERAL_H
madcowswe 15:9c5aaeda36dc 25 #define TVMET_XPR_LITERAL_H
madcowswe 15:9c5aaeda36dc 26
madcowswe 15:9c5aaeda36dc 27 namespace tvmet {
madcowswe 15:9c5aaeda36dc 28
madcowswe 15:9c5aaeda36dc 29
madcowswe 15:9c5aaeda36dc 30 /**
madcowswe 15:9c5aaeda36dc 31 * \class XprLiteral Literal.h "tvmet/xpr/Literal.h"
madcowswe 15:9c5aaeda36dc 32 * \brief Specify literals like scalars into the expression.
madcowswe 15:9c5aaeda36dc 33 * This expression is used for vectors and matrices - the
madcowswe 15:9c5aaeda36dc 34 * decision is done by the access operator.
madcowswe 15:9c5aaeda36dc 35 */
madcowswe 15:9c5aaeda36dc 36 template<class T>
madcowswe 15:9c5aaeda36dc 37 class XprLiteral
madcowswe 15:9c5aaeda36dc 38 : public TvmetBase< XprLiteral<T> >
madcowswe 15:9c5aaeda36dc 39 {
madcowswe 15:9c5aaeda36dc 40 XprLiteral();
madcowswe 15:9c5aaeda36dc 41 XprLiteral& operator=(const XprLiteral&);
madcowswe 15:9c5aaeda36dc 42
madcowswe 15:9c5aaeda36dc 43 public:
madcowswe 15:9c5aaeda36dc 44 typedef T value_type;
madcowswe 15:9c5aaeda36dc 45
madcowswe 15:9c5aaeda36dc 46 public:
madcowswe 15:9c5aaeda36dc 47 /** Complexity counter. */
madcowswe 15:9c5aaeda36dc 48 enum {
madcowswe 15:9c5aaeda36dc 49 ops = 1
madcowswe 15:9c5aaeda36dc 50 };
madcowswe 15:9c5aaeda36dc 51
madcowswe 15:9c5aaeda36dc 52 public:
madcowswe 15:9c5aaeda36dc 53 /** Constructor by value for literals . */
madcowswe 15:9c5aaeda36dc 54 explicit XprLiteral(value_type value)
madcowswe 15:9c5aaeda36dc 55 : m_data(value)
madcowswe 15:9c5aaeda36dc 56 { }
madcowswe 15:9c5aaeda36dc 57
madcowswe 15:9c5aaeda36dc 58 /** Copy Constructor. Not explicit! */
madcowswe 15:9c5aaeda36dc 59 #if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR)
madcowswe 15:9c5aaeda36dc 60 XprLiteral(const XprLiteral& e)
madcowswe 15:9c5aaeda36dc 61 : m_data(e.m_data)
madcowswe 15:9c5aaeda36dc 62 { }
madcowswe 15:9c5aaeda36dc 63 #endif
madcowswe 15:9c5aaeda36dc 64
madcowswe 15:9c5aaeda36dc 65 /** Index operator, gives the value for vectors. */
madcowswe 15:9c5aaeda36dc 66 value_type operator()(std::size_t) const { return m_data; }
madcowswe 15:9c5aaeda36dc 67
madcowswe 15:9c5aaeda36dc 68 /** Index operator for arrays/matrices. */
madcowswe 15:9c5aaeda36dc 69 value_type operator()(std::size_t, std::size_t) const { return m_data; }
madcowswe 15:9c5aaeda36dc 70
madcowswe 15:9c5aaeda36dc 71 public: // debugging Xpr parse tree
madcowswe 15:9c5aaeda36dc 72 void print_xpr(std::ostream& os, std::size_t l=0) const {
madcowswe 15:9c5aaeda36dc 73 os << IndentLevel(l++) << "XprLiteral[O=" << ops << "]<T="
madcowswe 15:9c5aaeda36dc 74 << typeid(value_type).name()
madcowswe 15:9c5aaeda36dc 75 << ">," << std::endl;
madcowswe 15:9c5aaeda36dc 76 }
madcowswe 15:9c5aaeda36dc 77
madcowswe 15:9c5aaeda36dc 78 private:
madcowswe 15:9c5aaeda36dc 79 const value_type m_data;
madcowswe 15:9c5aaeda36dc 80 };
madcowswe 15:9c5aaeda36dc 81
madcowswe 15:9c5aaeda36dc 82
madcowswe 15:9c5aaeda36dc 83 } // namespace tvmet
madcowswe 15:9c5aaeda36dc 84
madcowswe 15:9c5aaeda36dc 85 #endif // TVMET_XPR_LITERAL_H
madcowswe 15:9c5aaeda36dc 86
madcowswe 15:9c5aaeda36dc 87 // Local Variables:
madcowswe 15:9c5aaeda36dc 88 // mode:C++
madcowswe 15:9c5aaeda36dc 89 // tab-width:8
madcowswe 15:9c5aaeda36dc 90 // End: