Class for stepping through an array.
More...
#include <act_array.h>
Class for stepping through an array.
This class is used for an ordered traversal of an array/sub-range of an array. Given an Array, we can use this in the following fashion:
while (!as->isend()) {
...
Array *elem = as->toArray();
...
as->step();
}
delete as;
Dense arrays, sparse arrays, and array dereferences.
Definition: act_array.h:65
friend class Arraystep
Definition: act_array.h:443
Arraystep * stepper(Array *sub=NULL)
int idx
used to track the current index
Definition: act_array.h:512
◆ Arraystep()
Arraystep::Arraystep |
( |
Array * |
a, |
|
|
Array * |
sub = NULL |
|
) |
| |
Construct a stepper for the array a, with an optional sub-range specifier sub
- Parameters
-
a | the array to be stepped through |
sub | is an optional sub-range of the array a of interest |
◆ ~Arraystep()
Arraystep::~Arraystep |
( |
| ) |
|
◆ index() [1/2]
the linear index of the current element in the array being stepped through
◆ index() [2/2]
int Arraystep::index |
( |
Array * |
b | ) |
|
|
inline |
the index of the current de-reference within array b
◆ isend()
- Returns
- 1 on an end of array, 0 otherwise
◆ Print()
void Arraystep::Print |
( |
FILE * |
fp, |
|
|
int |
style = 0 |
|
) |
| |
Print the current array de-reference to the specified file
- Parameters
-
fp | is the output file |
style | is the array printing style |
◆ step()
advance to the next element in the array
◆ string()
char * Arraystep::string |
( |
int |
style = 0 | ) |
|
- Returns
- a freshly allocated string corresponding to the current de-reference.
◆ toArray()
Array * Arraystep::toArray |
( |
| ) |
|
convert the current element de-reference into an Array class.
◆ typesize()
int Arraystep::typesize |
( |
| ) |
|
|
inline |
- Returns
- the size of the array being stepped through
◆ base
◆ deref
used to track the current array de-reference
◆ idx
used to track the current index
◆ insubrange
Array* Arraystep::insubrange |
|
private |
part of subrange walker state
◆ subrange
Array* Arraystep::subrange |
|
private |
The documentation for this class was generated from the following file: