Iterator for goSignal3DBase<void> class signals.
More...
#include <gosignal3dgenericiterator.h>
|
| goSignal3DGenericIterator (goSignal3DBase< void > *s) |
|
void | init (goSignal3DBase< void > *s) |
|
| goSignal3DGenericIterator (const goSignal3DGenericIterator &other) |
|
void | setPosition (goIndex_t x, goIndex_t y, goIndex_t z) |
| Sets the iterator position to x,y,z in the signal. More...
|
|
bool | endX () |
|
bool | endY () |
|
bool | endZ () |
|
void | incrementX () |
|
void | incrementY () |
|
void | incrementZ () |
|
void | decrementX () |
|
void | decrementY () |
|
void | decrementZ () |
|
void | resetX () |
| Resets the X pointer and internals concerning X to the beginning of the current x-line.
|
|
void | resetY () |
| Resets the Y pointer and internals concerning Y to the beginning of the current z-plane.
|
|
void | resetZ () |
|
goByte * | operator* () |
|
goByte * | leftX () |
|
goByte * | leftY () |
|
goByte * | leftZ () |
|
goByte * | rightX () |
|
goByte * | rightY () |
|
goByte * | rightZ () |
|
goByte * | leftUp () |
|
goByte * | leftDown () |
|
goByte * | rightUp () |
|
goByte * | rightDown () |
|
const goByte * | operator* () const |
|
|
goSignal3DBase< void > * | sig |
|
goPtrdiff_t * | dx |
|
goPtrdiff_t * | dy |
|
goPtrdiff_t * | dz |
|
goPtrdiff_t * | dxStart |
|
goPtrdiff_t * | dyStart |
|
goPtrdiff_t * | dzStart |
|
goByte * | px |
|
goByte * | py |
|
goByte * | pz |
|
goIndex_t | posX |
|
goIndex_t | posY |
|
goIndex_t | posZ |
|
goIndex_t | maxX |
|
goIndex_t | maxY |
|
goIndex_t | maxZ |
|
Iterator for goSignal3DBase<void> class signals.
This is an iterator class for <void> type signals, the preferred signal class.
Usage is like this:
goSignal3D<void> sig;
....
goSignal3DGenericIterator it(&sig);
while (!it.endZ())
{
it.resetY();
while (!it.endY())
{
it.resetX();
while (!it.endX())
{
// We *know* this is a int16 signal
*(goInt16*)*it = // ... do something
it.incrementX();
}
it.incrementY();
}
it.incrementZ();
}
- Note
- It may be faster to use the GO_SIGNAL3D_EACHELEMENT* macros for iterating through a signal. However, with void type signals, you should be ok with this since the typical inner-loop methods are inlined. If you are optimising for speed, it may still be a good idea to simply write your own loop.
-
Mind that if you want to reuse the iterator from the example above, you must reset it with resetZ(); resetY(); resetX();
-
If you want to iterate over a subwindow of a signal, it may be a good idea to use goSubSignal3D<void>.
-
Be careful when you use multichannel signals. There is a pitfall:
sig.setChannel(1);
goSignal3DGenericIterator it(sig);
sig.setChannel(2);
The iterator will run on channel 1 !!!! It will run on channel 2 when you put a it.resetZ() or a it.setPosition(...) after setting the channel in sig.
- Todo:
- Maybe do something about the pitfall described in the note (documentation). Low priority.
◆ endX()
bool goSignal3DGenericIterator::endX |
( |
| ) |
|
|
inline |
- Returns
- True if the end of the current x-line is reached, false otherwise.
◆ endY()
bool goSignal3DGenericIterator::endY |
( |
| ) |
|
|
inline |
- Returns
- True if the end of the current y-plane is reached, false otherwise.
◆ endZ()
bool goSignal3DGenericIterator::endZ |
( |
| ) |
|
|
inline |
- Returns
- True if the end of the current z-plane is reached (end of the 3D signal), false otherwise.
◆ incrementZ()
void goSignal3DGenericIterator::incrementZ |
( |
| ) |
|
|
inline |
- Bug:
- See todo.
- Todo:
- This runs over the edge of the dz array when there is no border (holds for all increment functions). This leads to an invalid read operation which may lead to problems. Check if there is a way to fix this without having to change
all iterator calls.
◆ operator*()
goByte* goSignal3DGenericIterator::operator* |
( |
| ) |
|
|
inline |
- Returns
- Pointer to the data element at the current iterator position.
◆ setPosition()
void goSignal3DGenericIterator::setPosition |
( |
goIndex_t |
x, |
|
|
goIndex_t |
y, |
|
|
goIndex_t |
z |
|
) |
| |
|
inline |
Sets the iterator position to x,y,z in the signal.
- Parameters
-
x | X position |
y | Y position |
z | Z position |
The documentation for this class was generated from the following file:
- gosignal3dgenericiterator.h