This will take the same amount of clock time to iterate over a range. More...
#include <trackiterator.h>
Public Types | |
typedef InterpolatorType::InterpolatableType | InterpolatableType |
The type the interpolator this works with uses. | |
typedef std::input_iterator_tag | iterator_category |
This almost supports random access iteration, it does not support any kind of writing to the container. | |
typedef InterpolatableType * | pointer |
The type of a pointer to the iterated type. | |
typedef InterpolatableType & | reference |
The type of a reference to the iterated type. | |
typedef Track< InterpolatorType > | TargetTrackType |
What kind of track with this iterate over. | |
typedef TimedTrackIterator< InterpolatorType > | ThisType |
The kind of this iterator. | |
typedef InterpolatableType | value_type |
What type is this iterator working with. | |
Public Member Functions | |
TimedTrackIterator (const TargetTrackType *const TrackToIterate=0, Real StartOnTrack=0.0, Real EndOnTrack=1.0, MaxInt Duration=1000000, MaxInt WhenToStart=crossplatform::GetTimeStamp()) | |
The constructor for and iterator. More... | |
TimedTrackIterator (const ThisType &Copy) | |
Create a copy of an TimedTrackIterator. More... | |
Boole | AtEnd () const |
Is this iterator at the end of its range on the track. More... | |
Boole | AtStart () const |
Is this iterator at the beginning of its range on the track. More... | |
Boole | operator!= (const ThisType &Other) const |
Is this TimedTrackIterator not on the same track and in the same place as another. More... | |
virtual InterpolatableType | operator* () const |
Get the location on track from the last time it was incremented. More... | |
ThisType & | operator++ () |
Move the TimedTrackIterator forwards on the track by an amount proportionate to time elapsed. More... | |
const ThisType | operator++ (int) |
Move the TimedTrackIterator forwards on the track by an amount proportionate to time elapsed. More... | |
virtual CountedPtr< InterpolatableType > | operator-> () const |
Dereference this with the syntax for pointer member access. More... | |
TimedTrackIterator< InterpolatorType > & | operator= (const ThisType &Other) |
Change this TimedTrackIterator to match another (Except for Track) More... | |
Boole | operator== (const ThisType &Other) const |
Is this TimedTrackIterator on the same track and in the same place as another. More... | |
Protected Member Functions | |
InterpolatableType | GetDereferenced () const |
Do the math for determining where/when the iterator is. More... | |
void | Update (MaxInt Now=crossplatform::GetTimeStamp()) |
Update the current location of this iterator based on the current time. | |
Protected Attributes | |
MaxInt | CurrentTime |
Where is this iterator now. | |
Real | EndRange |
Where should iteration stop. | |
MaxInt | EndTime |
What Time does iteration ed at. | |
Real | StartRange |
Where Should Iteration Start. | |
MaxInt | StartTime |
What Time does iteration start at. | |
const TargetTrackType *const | TargetTrack |
The track this works against. | |
This will take the same amount of clock time to iterate over a range.
This will spread movement over a range of a track evenly throughout a period of time. For example if you have a track of Real values ranging from 0.0 to 10.0, interpolating the point at 0.0 will return 0.0 and the point 1.0 will return 10.0. Continuing this example if we were to define an iterator over this range that will take exactly 1,000 milliseconds to complete its journey, if we increment and dereference this 500 milliseconds after it was instantiated it will return 5.0. This is the point halfway through the range of the track because the time is halfway consumed.
This iterator must be bounds checked to be safe to use. If incremented before its start time its current location is set to its start time, if incremented past its end time its current location becoms its end time.
Here is a code sample that takes 3/4 of a second to iterate over the first quarter of the data in a track.
This code will emit to the standard output at least one Vector3 to the standard output. All output will be between(inclusive) 0.0 and 0.25 with times closer to the iterator creation time being near 0.0 and times closer to 750
Definition at line 359 of file trackiterator.h.
|
inline |
The constructor for and iterator.
Tracks
TrackToIterate | Which track with this work against. |
StartOnTrack | In the range of 0.0 to 1.0 Where on the track should iteration start. Defaults to 0.0. |
EndOnTrack | In the range of 0.0 to 1.0 Where on the track should iteration end. Defaults to 1.0. |
Duration | In microseconds how long should traversing the range of the track take. Defaults to 1 second. |
WhenToStart | The time iteration should start. Defaults to now. |
Definition at line 423 of file trackiterator.h.
|
inline |
Create a copy of an TimedTrackIterator.
Copy | The TimedTrackIterator to copy. |
Definition at line 436 of file trackiterator.h.
|
inline |
Is this iterator at the end of its range on the track.
Definition at line 509 of file trackiterator.h.
|
inline |
Is this iterator at the beginning of its range on the track.
Definition at line 514 of file trackiterator.h.
|
inlineprotected |
Do the math for determining where/when the iterator is.
Definition at line 405 of file trackiterator.h.
|
inline |
Is this TimedTrackIterator not on the same track and in the same place as another.
Other | The Other TimedTrackIterator to compare this one too. |
Definition at line 472 of file trackiterator.h.
|
inlinevirtual |
Get the location on track from the last time it was incremented.
Definition at line 479 of file trackiterator.h.
|
inline |
Move the TimedTrackIterator forwards on the track by an amount proportionate to time elapsed.
Definition at line 490 of file trackiterator.h.
|
inline |
Move the TimedTrackIterator forwards on the track by an amount proportionate to time elapsed.
Like the prefix ++ this moves the iterator, but this returns a copy of the iterator before being incremented.
Definition at line 500 of file trackiterator.h.
|
inlinevirtual |
Dereference this with the syntax for pointer member access.
Definition at line 485 of file trackiterator.h.
|
inline |
Change this TimedTrackIterator to match another (Except for Track)
Other | The TimedTrackIterator to copy, except for its target track |
Definition at line 447 of file trackiterator.h.
|
inline |
Is this TimedTrackIterator on the same track and in the same place as another.
Other | The Other TimedTrackIterator to compare this one too. |
Definition at line 460 of file trackiterator.h.