xc
RowConstRef.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //RowConstRef.h
22 
23 #ifndef ROWCONSTREF_H
24 #define ROWCONSTREF_H
25 
26 #include "BoxConstRef.h"
27 
29 template <class MAT>
30 class RowConstRef: public BoxConstRef<MAT>
31  {
32  public:
33  typedef typename BoxConstRef<MAT>::const_reference const_reference;
34 
35  RowConstRef(const MAT &m,const size_t &f= 1,const size_t &c= 1);
36  RowConstRef(const MAT &m,const size_t &,const size_t &,const size_t &);
37  RowConstRef(const MAT &mat,const size_t &,const RangoIndice &);
38  virtual const_reference operator()(size_t col) const
39  { return BoxConstRef<MAT>::operator()(1,col); }
40  };
41 
42 template<class MAT>
43 RowConstRef<MAT>::RowConstRef(const MAT &mat,const size_t &f,const size_t &c)
44  : BoxConstRef<MAT>(mat,f,c,f,mat.getNumberOfColumns())
45  {}
46 
47 template<class MAT>
48 RowConstRef<MAT>::RowConstRef(const MAT &mat,const size_t &f,const size_t &c1,const size_t &c2)
49  : BoxConstRef<MAT>(mat,f,RangoIndice(c1,c2))
50  {}
51 
52 template<class MAT>
53 RowConstRef<MAT>::RowConstRef(const MAT &mat,const size_t &f,const RangoIndice &column_range)
54  : BoxConstRef<MAT>(mat,f,column_range)
55  {}
56 
57 #endif
Reference to a matrix box.
Definition: BoxConstRef.h:47
Reference to a matrix row.
Definition: RowConstRef.h:30
Rango de variación de un índice, se emplea en BoxConstRef.
Definition: RangoIndice.h:30