00001 #ifndef _theplu_yat_utility_vector_const_view_ 00002 #define _theplu_yat_utility_vector_const_view_ 00003 00004 // $Id: VectorConstView.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 Copyright (C) 2009 Peter Johansson 00014 00015 This file is part of the yat library, http://dev.thep.lu.se/trac/yat 00016 00017 The yat library is free software; you can redistribute it and/or 00018 modify it under the terms of the GNU General Public License as 00019 published by the Free Software Foundation; either version 3 of the 00020 License, or (at your option) any later version. 00021 00022 The yat library is distributed in the hope that it will be useful, 00023 but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 General Public License for more details. 00026 00027 You should have received a copy of the GNU General Public License 00028 along with yat. If not, see <http://www.gnu.org/licenses/>. 00029 */ 00030 00031 #include "VectorBase.h" 00032 00033 #include <gsl/gsl_vector.h> 00034 00035 namespace theplu { 00036 namespace yat { 00037 namespace utility { 00038 00039 class Matrix; 00040 00055 class VectorConstView : public VectorBase 00056 { 00057 public: 00061 // needed to override compiler generated copy constructor 00062 VectorConstView(const VectorConstView& other); 00063 00067 explicit VectorConstView(const VectorBase& other); 00068 00081 VectorConstView(const VectorBase& v,size_t offset,size_t n,size_t stride=1); 00082 00101 VectorConstView(const Matrix& m, size_t i, bool row=true); 00102 00106 ~VectorConstView(void); 00107 00111 bool isview(void) const; 00112 00113 private: 00114 void copy(const VectorBase& other); 00115 void delete_allocated_memory(void); 00116 00117 // Perhaps not needed - only used to create a gsl_vector (that is 00118 // stored in base class). For data access use data in base class 00119 // because this pointer may be NULL. 00120 gsl_vector_const_view* const_view_; 00121 00122 // assignment not allowed 00123 VectorConstView& operator=(const VectorConstView&); 00124 }; 00125 00126 }}} // of namespace utility, yat, and theplu 00127 00128 #endif