ICRS Eurobot 2013

Dependencies:   mbed mbed-rtos Servo QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Vector.h Source File

Vector.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: Vector.h,v 1.9 2007-06-23 15:58:59 opetzold Exp $
00022  */
00023 
00024 #ifndef TVMET_LOOP_VECTOR_H
00025 #define TVMET_LOOP_VECTOR_H
00026 
00027 namespace tvmet {
00028 
00029 namespace loop {
00030 
00031 
00032 /**
00033  * \class Vector Vector.h "tvmet/loop/Vector.h"
00034  * \brief Loop %Vector class using expression and loop templates.
00035  */
00036 template<std::size_t Sz>
00037 class Vector
00038 {
00039   Vector(const Vector&);
00040   Vector& operator=(const Vector&);
00041 
00042 public:
00043   Vector() { }
00044 
00045 public:
00046   /** assign an expression on columns on given row using the functional fn. */
00047   template<class E1, class E2, class Assign>
00048   static inline
00049   void assign(E1& lhs, const E2& rhs, const Assign& assign_fn) {
00050     for(std::size_t i = 0; i != Sz; ++i)
00051       assign_fn.apply_on(lhs(i), rhs(i));
00052   }
00053 };
00054 
00055 
00056 } // namespace loop
00057 
00058 } // namespace tvmet
00059 
00060 #endif /* TVMET_LOOP_VECTOR_H */
00061 
00062 // Local Variables:
00063 // mode:C++
00064 // tab-width:8
00065 // End: