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
1156  : _Start(0)
1157  { // construct with all zeros
1158  }
size_t _Start
Definition: valarray:1213
gslice::gslice ( size_t  _Off,
const _Sizarray _Lenarr,
const _Sizarray _Incarr 
)
inline
1162  : _Start(_Off), _Len(_Lenarr), _Stride(_Incarr)
1163  { // construct from starting offset, arrays of lengths and strides
1164  }
size_t _Off(_Sizarray &_Indexarr) const
Definition: valarray:1186
_Sizarray _Len
Definition: valarray:1214
_Sizarray _Stride
Definition: valarray:1215
size_t _Start
Definition: valarray:1213

Member Function Documentation

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

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: