STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
gslice Class Reference
Inheritance diagram for gslice:
gslice_array< _Ty >

Public Member Functions

 gslice ()
 
 gslice (size_t _Off, const _Sizarray &_Lenarr, const _Sizarray &_Incarr)
 
size_t start () const
 
_Sizarray size () const
 
_Sizarray stride () const
 
size_t _Nslice () const
 
size_t _Off (_Sizarray &_Indexarr) const
 
size_t _Totlen () const
 

Private Attributes

size_t _Start
 
_Sizarray _Len
 
_Sizarray _Stride
 

Constructor & Destructor Documentation

gslice::gslice ( )
inline
1151  : _Start(0)
1152  { // construct with all zeros
1153  }
size_t _Start
Definition: valarray:1208
gslice::gslice ( size_t  _Off,
const _Sizarray _Lenarr,
const _Sizarray _Incarr 
)
inline
1157  : _Start(_Off), _Len(_Lenarr), _Stride(_Incarr)
1158  { // construct from starting offset, arrays of lengths and strides
1159  }
size_t _Off(_Sizarray &_Indexarr) const
Definition: valarray:1181
_Sizarray _Len
Definition: valarray:1209
_Sizarray _Stride
Definition: valarray:1210
size_t _Start
Definition: valarray:1208

Member Function Documentation

size_t gslice::_Nslice ( ) const
inline
1177  { // return number of slices
1178  return (_Len.size());
1179  }
_Sizarray _Len
Definition: valarray:1209
size_t size() const
Definition: valarray:312
size_t gslice::_Off ( _Sizarray _Indexarr) const
inline
1182  { // return offset for an array of indexes, then increment
1183  size_t _Idx, _Ans = _Start;
1184 
1185  for (_Idx = 0; _Idx < _Indexarr.size(); ++_Idx)
1186  _Ans += _Indexarr[_Idx] * _Stride[_Idx]; // compute offset
1187 
1188  while (0 < _Idx--)
1189  if (++_Indexarr[_Idx] < _Len[_Idx])
1190  break; // increment done, quit
1191  else
1192  _Indexarr[_Idx] = 0; // carry to more-significant index
1193  return (_Ans);
1194  }
_Sizarray _Len
Definition: valarray:1209
size_t size() const
Definition: valarray:312
_Sizarray _Stride
Definition: valarray:1210
size_t _Start
Definition: valarray:1208
size_t gslice::_Totlen ( ) const
inline
1197  { // return total length of generalized slice
1198  if (_Len.size() == 0)
1199  return (0);
1200 
1201  size_t _Count = _Len[0];
1202  for (size_t _Idx = 0; ++_Idx < _Len.size(); )
1203  _Count *= _Len[_Idx];
1204  return (_Count);
1205  }
unsigned int _Count
Definition: xcomplex:668
_Sizarray _Len
Definition: valarray:1209
size_t size() const
Definition: valarray:312
_Sizarray gslice::size ( ) const
inline
1167  { // return array of lengths of slices
1168  return (_Len);
1169  }
_Sizarray _Len
Definition: valarray:1209
size_t gslice::start ( ) const
inline
1162  { // return starting offset of generalized slice
1163  return (_Start);
1164  }
size_t _Start
Definition: valarray:1208
_Sizarray gslice::stride ( ) const
inline
1172  { // return array of strides of slices
1173  return (_Stride);
1174  }
_Sizarray _Stride
Definition: valarray:1210

Member Data Documentation

_Sizarray gslice::_Len
private
size_t gslice::_Start
private
_Sizarray gslice::_Stride
private

The documentation for this class was generated from the following file: