xc
KRowVarRef.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 //KRowVarRef.h
22 
23 #ifndef KROWVARREF_H
24 #define KROWVARREF_H
25 
26 
28 //
31 template <class ARRAY_3D>
32 class KRowVarRef: public Array3dBoxVarRef<ARRAY_3D>
33  {
34  public:
35  typedef typename Array3dBoxVarRef<ARRAY_3D>::const_reference const_reference;
36  typedef typename Array3dBoxVarRef<ARRAY_3D>::reference reference;
37 
38  explicit KRowVarRef(ARRAY_3D &m,const size_t &iLayer= 1,const size_t &f= 1);
39  KRowVarRef(ARRAY_3D &m,const size_t &,const size_t &,const size_t &,const size_t &);
40  KRowVarRef(ARRAY_3D &t,const size_t &iLayer,const size_t &f,const RangoIndice &rango_col);
41  inline virtual ~KRowVarRef(void) {}
42  size_t getLayerIndex(void) const
43  { return this->offset_cp+1; }
44  size_t getRowIndex(void) const
45  { return this->offset_f+1; }
46  inline virtual const_reference operator()(size_t c=1) const
48  inline virtual reference operator()(size_t c=1)
50  inline virtual const_reference operator()(size_t iLayer,size_t iRow,size_t col) const
51  { return Array3dBoxVarRef<ARRAY_3D>::operator()(iLayer,iRow,col); }
52  inline virtual reference operator()(size_t iLayer,size_t iRow,size_t col)
53  { return Array3dBoxVarRef<ARRAY_3D>::operator()(iLayer,iRow,col); }
54  };
55 
57 template<class ARRAY_3D>
58 KRowVarRef<ARRAY_3D>::KRowVarRef(ARRAY_3D &t,const size_t &iLayer,const size_t &f)
59  : Array3dBoxVarRef<ARRAY_3D>(t,iLayer,f,RangoIndice(1,t.getNumberOfColumns())) {}
60 
61 template<class ARRAY_3D>
62 KRowVarRef<ARRAY_3D>::KRowVarRef(ARRAY_3D &t,const size_t &iLayer,const size_t &f,const size_t &c1,const size_t &c2)
63  : Array3dBoxVarRef<ARRAY_3D>(t,iLayer,f,RangoIndice(c1,c2)) {}
64 
65 template<class ARRAY_3D>
66 KRowVarRef<ARRAY_3D>::KRowVarRef(ARRAY_3D &t,const size_t &iLayer,const size_t &f,const RangoIndice &rango_col)
67  : Array3dBoxVarRef<ARRAY_3D>(t,iLayer,f,rango_col) {}
68 
69 #endif
size_t offset_cp
Offset layer.
Definition: Array3dBoxRefBase.h:40
Reference to a row of the array which points have constant K indexes.
Definition: KRowVarRef.h:32
KRowVarRef(ARRAY_3D &m, const size_t &iLayer=1, const size_t &f=1)
Default constructor.
Definition: KRowVarRef.h:58
Reference to a "sub-array".
Definition: Array3dBoxVarRef.h:33
size_t offset_f
Offset row.
Definition: Array3dBoxRefBase.h:41
Rango de variación de un índice, se emplea en BoxConstRef.
Definition: RangoIndice.h:30