yat  0.8.3pre
VectorView.h
00001 #ifndef _theplu_yat_utility_vector_view_
00002 #define _theplu_yat_utility_vector_view_
00003 
00004 // $Id: VectorView.h 2119 2009-12-12 23:11:43Z peter $
00005 
00006 /*
00007   Copyright (C) 2003 Daniel Dalevi, Peter Johansson
00008   Copyright (C) 2004 Jari Häkkinen, Peter Johansson
00009   Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
00010   Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
00011   Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
00012   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
00013 
00014   This file is part of the yat library, http://dev.thep.lu.se/trac/yat
00015 
00016   The yat library is free software; you can redistribute it and/or
00017   modify it under the terms of the GNU General Public License as
00018   published by the Free Software Foundation; either version 3 of the
00019   License, or (at your option) any later version.
00020 
00021   The yat library is distributed in the hope that it will be useful,
00022   but WITHOUT ANY WARRANTY; without even the implied warranty of
00023   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00024   General Public License for more details.
00025 
00026   You should have received a copy of the GNU General Public License
00027   along with yat. If not, see <http://www.gnu.org/licenses/>.
00028 */
00029 
00030 #include "VectorMutable.h"
00031 
00032 #include <gsl/gsl_vector.h>
00033 
00034 namespace theplu {
00035 namespace yat {
00036 namespace utility {
00037 
00038   class Matrix;
00039   class Vector;
00040 
00078   class VectorView : public VectorMutable
00079   {
00080   public:
00086     VectorView(void);
00087 
00096     VectorView(VectorView& other);
00097 
00105     explicit VectorView(VectorMutable& other);
00106 
00117     VectorView(VectorMutable& v, size_t offset, size_t n, size_t stride=1);
00118 
00136     VectorView(Matrix& m, size_t i, bool row=true);
00137 
00141     ~VectorView(void);
00142 
00146     bool isview(void) const; 
00147 
00157     const VectorView& operator=(const VectorView&);
00158 
00168     const VectorView& operator=(const VectorBase&);
00169 
00170   private:
00171     const VectorView& assign(const VectorBase& other);
00172     void copy(gsl_vector*);
00173     void delete_allocated_memory(void);
00174 
00175     gsl_vector_view* view_;
00176 
00188     struct proxy 
00189     { 
00192       gsl_vector* vec_;
00193     };
00194 
00195   public:
00199     VectorView(proxy p);
00200 
00204     operator proxy();
00205   };
00206 
00207 }}} // of namespace utility, yat, and theplu
00208 
00209 #endif

Generated on Thu Dec 20 2012 03:12:58 for yat by  doxygen 1.8.0-20120409