MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::TrackBase< InterpolatorType > Class Template Referenceabstract

A base type that provides container features for different tracks. More...

#include <track.h>

+ Inheritance diagram for Mezzanine::TrackBase< InterpolatorType >:

Public Types

typedef InterpolatorType::Storage DataContainerType
 The type of the internal container storing the interpolatable data. This is a single point to change all the tracks. More...
 
typedef
InterpolatorType::InterpolatableType 
InterpolatableType
 The type this class and the interpolator it uses works with.
 
typedef SmoothTrackIterator
< InterpolatorType > 
SmoothIteratorType
 An iterator than can take an arbitrary amount of steps by interpolation.
 

Public Member Functions

 TrackBase (typename DataContainerType::iterator Begin, typename DataContainerType::iterator End)
 
 TrackBase (const DataContainerType &DataSet)
 
virtual void Add (const InterpolatableType &AddedValue)
 Add another data point to the end of the track. More...
 
virtual SmoothIteratorType begin (Integer Steps=100) const
 Get an Smooth iterator to the beginning of the track. More...
 
virtual SmoothIteratorType Begin (Integer Steps=100) const
 Get an Smooth iterator to the beginning of the track. More...
 
void clear ()
 Remove all the points from the track.
 
void Clear ()
 Remove all the points from the track. More...
 
virtual SmoothIteratorType end (Integer Steps=0) const
 Get an Smooth iterator to the end (not one past) of the track. More...
 
virtual SmoothIteratorType End (Integer Steps=0) const
 Get an Smooth iterator to the end (not one past) of the track. More...
 
virtual InterpolatableType GetInterpolated (Real Percentage) const =0
 Get a value between the beginning and the end. More...
 
virtual void push_back (const InterpolatableType &AddedValue)
 Add another data point to the end of the track. More...
 
size_t size () const
 Get the amount of stored DataPoints. More...
 
size_t Size () const
 Get the amount of stored DataPoints. More...
 

Protected Attributes

DataContainerType DataPoints
 The underlying container of Discrete datapoints.
 

Detailed Description

template<typename InterpolatorType>
class Mezzanine::TrackBase< InterpolatorType >

A base type that provides container features for different tracks.

Tracks are containers of a Discrete set of points, that are presented as a continuous range from 0 to 1. Interpolators are used to generate the data between the points as it is needed. For example, lets say there is an interpolator provided for integers and a track contains only two data points 0 and 100, requesting 0.5 might return 50.

This uses std::vector underneath for its performance characteristics.

Definition at line 64 of file track.h.

Member Typedef Documentation

template<typename InterpolatorType >
typedef InterpolatorType::Storage Mezzanine::TrackBase< InterpolatorType >::DataContainerType

The type of the internal container storing the interpolatable data. This is a single point to change all the tracks.

If an interpolator requires a special container this can be re-implemented to have the TrackBase use that instead. The type must implement at least:

  • size()
  • push_back(InterpolatableType)
  • clear()
  • A copy constructor
  • A constructor that accepts an iterator range
  • An iterator type

Definition at line 79 of file track.h.

Member Function Documentation

template<typename InterpolatorType >
virtual void Mezzanine::TrackBase< InterpolatorType >::Add ( const InterpolatableType AddedValue)
inlinevirtual

Add another data point to the end of the track.

Parameters
AddedValueThe data point to add to theend of the track.
Note
Name for consistency with naming conventions and implemented in terms of push_back().

Definition at line 121 of file track.h.

template<typename InterpolatorType >
virtual SmoothIteratorType Mezzanine::TrackBase< InterpolatorType >::begin ( Integer  Steps = 100) const
inlinevirtual

Get an Smooth iterator to the beginning of the track.

A Smooth iterator will take a fixed number of steps across a data set, interpolating values not actually present.

Parameters
StepsHow many steps to take, defaults to 100.

Definition at line 135 of file track.h.

template<typename InterpolatorType >
virtual SmoothIteratorType Mezzanine::TrackBase< InterpolatorType >::Begin ( Integer  Steps = 100) const
inlinevirtual

Get an Smooth iterator to the beginning of the track.

A Smooth iterator will take a fixed number of steps across a data set, interpolating values not actually present.

Parameters
StepsHow many steps to take, defaults to 100.

Definition at line 142 of file track.h.

template<typename InterpolatorType >
void Mezzanine::TrackBase< InterpolatorType >::Clear ( )
inline

Remove all the points from the track.

Definition at line 128 of file track.h.

template<typename InterpolatorType >
virtual SmoothIteratorType Mezzanine::TrackBase< InterpolatorType >::end ( Integer  Steps = 0) const
inlinevirtual

Get an Smooth iterator to the end (not one past) of the track.

A Smooth iterator will take a fixed number of steps across a data set, interpolating values not actually present.

Parameters
StepsHow many steps to take if any, defaults to 0.

Definition at line 150 of file track.h.

template<typename InterpolatorType >
virtual SmoothIteratorType Mezzanine::TrackBase< InterpolatorType >::End ( Integer  Steps = 0) const
inlinevirtual

Get an Smooth iterator to the end (not one past) of the track.

A Smooth iterator will take a fixed number of steps across a data set, interpolating values not actually present.

Parameters
StepsHow many steps to take if any, defaults to 0.

Definition at line 157 of file track.h.

template<typename InterpolatorType >
virtual InterpolatableType Mezzanine::TrackBase< InterpolatorType >::GetInterpolated ( Real  Percentage) const
pure virtual

Get a value between the beginning and the end.

in derived classes this will perform some simple(hopefully fast) calculation to get interpolated value between the beginning and the end fo the track. Depending on algorithm this may or may not respect the nodes.

Parameters
PercentageA value from 0 to 1 indicating when between the beginning and end the point should be.
Returns
An InterpolatableType

Implemented in Mezzanine::Track< InterpolatorType >.

template<typename InterpolatorType >
virtual void Mezzanine::TrackBase< InterpolatorType >::push_back ( const InterpolatableType AddedValue)
inlinevirtual

Add another data point to the end of the track.

Parameters
AddedValueThe data point to add to theend of the track.
Note
Name for compatibility with std templates.

Reimplemented in Mezzanine::TrackLooped< InterpolatorType >.

Definition at line 116 of file track.h.

template<typename InterpolatorType >
size_t Mezzanine::TrackBase< InterpolatorType >::size ( ) const
inline

Get the amount of stored DataPoints.

Note
Name chosen to match standard containers
Returns
How many data points exist on this track
Note
Name for compatibility with std templates

Definition at line 104 of file track.h.

template<typename InterpolatorType >
size_t Mezzanine::TrackBase< InterpolatorType >::Size ( ) const
inline

Get the amount of stored DataPoints.

Note
Name chosen to match standard containers
Returns
How many data points exist on this track
Note
Name for consistency with naming conventions and implemented in terms of size().

Definition at line 110 of file track.h.


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