Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Mezzanine::Track< InterpolatorType > Class Template Reference

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

#include <track.h>

+ Inheritance diagram for Mezzanine::Track< InterpolatorType >:
+ Collaboration diagram for Mezzanine::Track< InterpolatorType >:

Public Types

typedef DataContainerType::const_iterator ConstDataIteratorType
 A const iterator type for the elements stored and interpolated within this track.
 
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 DataContainerType::iterator DataIteratorType
 An iterator type for the elements stored and interpolated within this track.
 
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

 Track (DataIteratorType Begin, DataIteratorType End)
 Create a Track from a range of data points. More...
 
 Track (const DataContainerType &DataSet)
 Create a track from a DataContainerType instance, likely a vector and copthe data from it. More...
 
 Track ()
 Create a default empty track.
 
virtual ~Track ()
 Virtual Deconstructor.
 
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 String DerivedSerializableName () const
 
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
 Get a value from somewhere on the track with 0.0 being the beginning and 1.0 being the end. More...
 
virtual InterpolatableType GetInterpolated (size_t Index, Real Percentage) const
 Get a value between two points on the track with 0.0 being a specified datapoint and 1.0 being the next datapoint. More...
 
String GetTrackName () const
 Get the given name or generate a default name. More...
 
const StringGetTrackName ()
 This is just like the const version of the function but it will set the name if unset and retrieve it. More...
 
virtual void ProtoDeSerialize (const XML::Node &OneNode)
 Convert a node on an XML into a track. More...
 
virtual void ProtoSerialize (XML::Node &CurrentRoot) const
 Convert this to a node on an XML graph. More...
 
virtual void push_back (const InterpolatableType &AddedValue)
 Add another data point to the end of the track. More...
 
void SetTrackName (String Name)
 Set the name for serialization. More...
 
String SetTrackNameUnique (String Name="")
 Set the name to something that serialization definitely will not duplicate. More...
 
size_t size () const
 Get the amount of stored DataPoints. More...
 
size_t Size () const
 Get the amount of stored DataPoints. More...
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of this class "Track". More...
 

Protected Attributes

DataContainerType DataPoints
 The underlying container of Discrete datapoints.
 
String RawName
 Name of the track, primarily for serialization.
 

Detailed Description

template<typename InterpolatorType>
class Mezzanine::Track< 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 65 of file track.h.

Member Typedef Documentation

template<typename InterpolatorType>
typedef InterpolatorType::Storage Mezzanine::Track< 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 80 of file track.h.

Constructor & Destructor Documentation

template<typename InterpolatorType>
Mezzanine::Track< InterpolatorType >::Track ( DataIteratorType  Begin,
DataIteratorType  End 
)
inline

Create a Track from a range of data points.

Parameters
BeginAn iterator pointing to the beginning of a range to copy
Endan iterator pointing to one past the rang to copy.

Definition at line 102 of file track.h.

template<typename InterpolatorType>
Mezzanine::Track< InterpolatorType >::Track ( const DataContainerType DataSet)
inline

Create a track from a DataContainerType instance, likely a vector and copthe data from it.

Parameters
DataSetA collection of data points to copy.

Definition at line 108 of file track.h.

Member Function Documentation

template<typename InterpolatorType>
virtual void Mezzanine::Track< 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 138 of file track.h.

template<typename InterpolatorType>
virtual SmoothIteratorType Mezzanine::Track< 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 152 of file track.h.

template<typename InterpolatorType>
virtual SmoothIteratorType Mezzanine::Track< 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 159 of file track.h.

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

Remove all the points from the track.

Definition at line 145 of file track.h.

template<typename InterpolatorType>
virtual String Mezzanine::Track< InterpolatorType >::DerivedSerializableName ( ) const
inlinevirtual

get the classnae at runtime

Returns
A String Containing a class name,likely"Track" or "TrackLooped"

Reimplemented in Mezzanine::TrackLooped< InterpolatorType >.

Definition at line 341 of file track.h.

template<typename InterpolatorType>
virtual SmoothIteratorType Mezzanine::Track< 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 166 of file track.h.

template<typename InterpolatorType>
virtual SmoothIteratorType Mezzanine::Track< 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 173 of file track.h.

template<typename InterpolatorType>
virtual InterpolatableType Mezzanine::Track< InterpolatorType >::GetInterpolated ( Real  Percentage) const
inlinevirtual

Get a value from somewhere on the track with 0.0 being the beginning and 1.0 being the end.

Parameters
PercentageA Value between 0 and 1 that the interpolator will use to pick a point on or between the datapoints.
Returns
InterpolatableType that is Percentage from through the track.

Definition at line 179 of file track.h.

template<typename InterpolatorType>
virtual InterpolatableType Mezzanine::Track< InterpolatorType >::GetInterpolated ( size_t  Index,
Real  Percentage 
) const
inlinevirtual

Get a value between two points on the track with 0.0 being a specified datapoint and 1.0 being the next datapoint.

Parameters
IndexThe Nth datapoint which will define the start of the range to interpolate. Max allowed value is: size - 2.
PercentageA Value between 0 and 1 that the interpolator will use to pick a point on or between the datapoints.
Returns
Returns a InterpolatableType that is the interpolated value between the two data points starting at the specified index.

Definition at line 192 of file track.h.

template<typename InterpolatorType>
static String Mezzanine::Track< InterpolatorType >::GetSerializableName ( )
inlinestatic

Get the name of this class "Track".

Returns
A string containing "Track"

Definition at line 346 of file track.h.

template<typename InterpolatorType>
String Mezzanine::Track< InterpolatorType >::GetTrackName ( ) const
inline

Get the given name or generate a default name.

Returns
This will either return whatever was set with SetTrackName(String Name) or some value that likely unique.
Warning
Do not set one tracks name to another and these will remain under all but the most extreme situations.
The current implementations serializes a pointer an implementatin and instance specific number to this if there is no other name. This will change on deserialization and is only identified by being a number. Don't use numbers as your name of the track.

Definition at line 230 of file track.h.

template<typename InterpolatorType>
const String& Mezzanine::Track< InterpolatorType >::GetTrackName ( )
inline

This is just like the const version of the function but it will set the name if unset and retrieve it.

Returns
A name of some kind in string.

Definition at line 239 of file track.h.

template<typename InterpolatorType>
virtual void Mezzanine::Track< InterpolatorType >::ProtoDeSerialize ( const XML::Node OneNode)
inlinevirtual

Convert a node on an XML into a track.

This will convert and XML into Track or LoopedTrack templated on the type that matches this instance of this class.

Definition at line 302 of file track.h.

template<typename InterpolatorType>
virtual void Mezzanine::Track< InterpolatorType >::ProtoSerialize ( XML::Node CurrentRoot) const
inlinevirtual

Convert this to a node on an XML graph.

Parameters
CurrentRootthe node that will become the parent for the one this creates.

This function is also used to serialize Looped Tracks. This serializes the interpoator in use and each data point.

Definition at line 250 of file track.h.

template<typename InterpolatorType>
virtual void Mezzanine::Track< 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 133 of file track.h.

template<typename InterpolatorType>
void Mezzanine::Track< InterpolatorType >::SetTrackName ( String  Name)
inline

Set the name for serialization.

Parameters
Namethe Name for finding this track in serialized streams.

Definition at line 206 of file track.h.

template<typename InterpolatorType>
String Mezzanine::Track< InterpolatorType >::SetTrackNameUnique ( String  Name = "")
inline

Set the name to something that serialization definitely will not duplicate.

Because serialization of racks must have a name unique numbers are assigned when a nameisnot present. This function will set the name either to the pased value if serialzation will never touch it, or to some value that serialization cannot clobber.

Parameters
NameThe name you would like if it is compatible.
Returns
Whatever was actually set for a name.

Definition at line 215 of file track.h.

template<typename InterpolatorType>
size_t Mezzanine::Track< 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 121 of file track.h.

template<typename InterpolatorType>
size_t Mezzanine::Track< 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 127 of file track.h.


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