Oskar Weigl
/
Eurobot2013
We are going to win! wohoo
tvmet/Extremum.h@9:08552997b544, 2012-11-14 (annotated)
- Committer:
- madcowswe
- Date:
- Wed Nov 14 17:15:53 2012 +0000
- Revision:
- 9:08552997b544
- Parent:
- 1:6799c07fe510
Added an important comment
Who changed what in which revision?
User | Revision | Line number | New 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: Extremum.h,v 1.10 2007-06-23 15:58:58 opetzold Exp $ |
sv | 1:6799c07fe510 | 22 | */ |
sv | 1:6799c07fe510 | 23 | |
sv | 1:6799c07fe510 | 24 | #ifndef TVMET_EXTREMUM_H |
sv | 1:6799c07fe510 | 25 | #define TVMET_EXTREMUM_H |
sv | 1:6799c07fe510 | 26 | |
sv | 1:6799c07fe510 | 27 | namespace tvmet { |
sv | 1:6799c07fe510 | 28 | |
sv | 1:6799c07fe510 | 29 | |
sv | 1:6799c07fe510 | 30 | /** |
sv | 1:6799c07fe510 | 31 | * \class matrix_tag Extremum.h "tvmet/Extremum.h" |
sv | 1:6799c07fe510 | 32 | * \brief For use with Extremum to simplify max handling. |
sv | 1:6799c07fe510 | 33 | * This allows the min/max functions to return an Extremum object. |
sv | 1:6799c07fe510 | 34 | */ |
sv | 1:6799c07fe510 | 35 | struct matrix_tag { }; |
sv | 1:6799c07fe510 | 36 | |
sv | 1:6799c07fe510 | 37 | |
sv | 1:6799c07fe510 | 38 | /** |
sv | 1:6799c07fe510 | 39 | * \class vector_tag Extremum.h "tvmet/Extremum.h" |
sv | 1:6799c07fe510 | 40 | * \brief For use with Extremum to simplify max handling. |
sv | 1:6799c07fe510 | 41 | * This allows the min/max functions to return an Extremum object. |
sv | 1:6799c07fe510 | 42 | */ |
sv | 1:6799c07fe510 | 43 | struct vector_tag { }; |
sv | 1:6799c07fe510 | 44 | |
sv | 1:6799c07fe510 | 45 | |
sv | 1:6799c07fe510 | 46 | /** |
sv | 1:6799c07fe510 | 47 | * \class Extremum Extremum.h "tvmet/Extremum.h" |
sv | 1:6799c07fe510 | 48 | * \brief Generell class for storing extremums determined by min/max. |
sv | 1:6799c07fe510 | 49 | */ |
sv | 1:6799c07fe510 | 50 | template<class T1, class T2, class Tag> |
sv | 1:6799c07fe510 | 51 | class Extremum { }; |
sv | 1:6799c07fe510 | 52 | |
sv | 1:6799c07fe510 | 53 | |
sv | 1:6799c07fe510 | 54 | /** |
sv | 1:6799c07fe510 | 55 | * \class Extremum<T1, T2, vector_tag> Extremum.h "tvmet/Extremum.h" |
sv | 1:6799c07fe510 | 56 | * \brief Partial specialzed for vectors to store extremums by value and index. |
sv | 1:6799c07fe510 | 57 | */ |
sv | 1:6799c07fe510 | 58 | template<class T1, class T2> |
sv | 1:6799c07fe510 | 59 | class Extremum<T1, T2, vector_tag> |
sv | 1:6799c07fe510 | 60 | { |
sv | 1:6799c07fe510 | 61 | public: |
sv | 1:6799c07fe510 | 62 | typedef T1 value_type; |
sv | 1:6799c07fe510 | 63 | typedef T2 index_type; |
sv | 1:6799c07fe510 | 64 | |
sv | 1:6799c07fe510 | 65 | public: |
sv | 1:6799c07fe510 | 66 | Extremum(value_type value, index_type index) |
sv | 1:6799c07fe510 | 67 | : m_value(value), m_index(index) { } |
sv | 1:6799c07fe510 | 68 | value_type value() const { return m_value; } |
sv | 1:6799c07fe510 | 69 | index_type index() const { return m_index; } |
sv | 1:6799c07fe510 | 70 | |
sv | 1:6799c07fe510 | 71 | private: |
sv | 1:6799c07fe510 | 72 | value_type m_value; |
sv | 1:6799c07fe510 | 73 | index_type m_index; |
sv | 1:6799c07fe510 | 74 | }; |
sv | 1:6799c07fe510 | 75 | |
sv | 1:6799c07fe510 | 76 | |
sv | 1:6799c07fe510 | 77 | /** |
sv | 1:6799c07fe510 | 78 | * \class Extremum<T1, T2, matrix_tag> Extremum.h "tvmet/Extremum.h" |
sv | 1:6799c07fe510 | 79 | * \brief Partial specialzed for matrix to store extremums by value, row and column. |
sv | 1:6799c07fe510 | 80 | */ |
sv | 1:6799c07fe510 | 81 | template<class T1, class T2> |
sv | 1:6799c07fe510 | 82 | class Extremum<T1, T2, matrix_tag> |
sv | 1:6799c07fe510 | 83 | { |
sv | 1:6799c07fe510 | 84 | public: |
sv | 1:6799c07fe510 | 85 | typedef T1 value_type; |
sv | 1:6799c07fe510 | 86 | typedef T2 index_type; |
sv | 1:6799c07fe510 | 87 | |
sv | 1:6799c07fe510 | 88 | public: |
sv | 1:6799c07fe510 | 89 | Extremum(value_type value, index_type row, index_type col) |
sv | 1:6799c07fe510 | 90 | : m_value(value), m_row(row), m_col(col) { } |
sv | 1:6799c07fe510 | 91 | value_type value() const { return m_value; } |
sv | 1:6799c07fe510 | 92 | index_type row() const { return m_row; } |
sv | 1:6799c07fe510 | 93 | index_type col() const { return m_col; } |
sv | 1:6799c07fe510 | 94 | |
sv | 1:6799c07fe510 | 95 | private: |
sv | 1:6799c07fe510 | 96 | value_type m_value; |
sv | 1:6799c07fe510 | 97 | index_type m_row, m_col; |
sv | 1:6799c07fe510 | 98 | }; |
sv | 1:6799c07fe510 | 99 | |
sv | 1:6799c07fe510 | 100 | |
sv | 1:6799c07fe510 | 101 | } // namespace tvmet |
sv | 1:6799c07fe510 | 102 | |
sv | 1:6799c07fe510 | 103 | #endif // TVMET_EXTREMUM_H |
sv | 1:6799c07fe510 | 104 | |
sv | 1:6799c07fe510 | 105 | // Local Variables: |
sv | 1:6799c07fe510 | 106 | // mode:C++ |
sv | 1:6799c07fe510 | 107 | // tab-width:8 |
sv | 1:6799c07fe510 | 108 | // End: |