Spinning Topp Logo BlackTopp Studios
inc
track.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _track_h
41 #define _track_h
42 
43 #include "datatypes.h"
44 #include "exception.h"
45 #include "enumerations.h"
46 #include "interpolator.h"
47 #include "trackiterator.h"
48 
49 #ifndef SWIG // STD headers are bad for Swig
50  #include <cmath>
51  #include <iterator>
52 #endif
53 
54 namespace Mezzanine
55 {
56  /// @brief A base type that provides container features for different tracks
57  /// @details Tracks are containers of a Discrete set of points, that are presented as
58  /// a continuous range from 0 to 1. Interpolators are used to generate the data between
59  /// the points as it is needed. For example, lets say there is an interpolator provided
60  /// for integers and a track contains only two data points 0 and 100, requesting 0.5
61  /// might return 50.
62  /// @n @n
63  /// This uses std::vector underneath for its performance characteristics.
64  template <typename InterpolatorType>
65  class Track
66  {
67  public:
68  /// @brief The type this class and the interpolator it uses works with.
69  typedef typename InterpolatorType::InterpolatableType InterpolatableType;
70 
71  /// @brief The type of the internal container storing the interpolatable data. This is a single point to change all the tracks.
72  /// @details If an interpolator requires a special container this can be re-implemented
73  /// to have the TrackBase use that instead. The type must implement at least:
74  /// - size()
75  /// - push_back(InterpolatableType)
76  /// - clear()
77  /// - A copy constructor
78  /// - A constructor that accepts an iterator range
79  /// - An iterator type
80  typedef typename InterpolatorType::Storage DataContainerType;
81 
82  /// @brief An iterator type for the elements stored and interpolated within this track.
83  typedef typename DataContainerType::iterator DataIteratorType;
84 
85  /// @brief A const iterator type for the elements stored and interpolated within this track.
86  typedef typename DataContainerType::const_iterator ConstDataIteratorType;
87 
88  /// @brief An iterator than can take an arbitrary amount of steps by interpolation.
90 
91  protected:
92  /// @brief The underlying container of Discrete datapoints.
93  DataContainerType DataPoints;
94 
95  /// @brief Name of the track, primarily for serialization.
97 
98  public:
99  /// @brief Create a Track from a range of data points
100  /// @param Begin An iterator pointing to the beginning of a range to copy
101  /// @param End an iterator pointing to one past the rang to copy.
102  Track(DataIteratorType Begin,
103  DataIteratorType End)
104  : DataPoints(Begin,End)
105  {}
106  /// @brief Create a track from a DataContainerType instance, likely a vector and copthe data from it.
107  /// @param DataSet A collection of data points to copy.
108  Track(const DataContainerType& DataSet) : DataPoints(DataSet)
109  {}
110  /// @brief Create a default empty track.
112  {}
113  /// @brief Virtual Deconstructor.
114  virtual ~Track()
115  {}
116 
117  /// @brief Get the amount of stored DataPoints
118  /// @note Name chosen to match standard containers
119  /// @return How many data points exist on this track
120  /// @note Name for compatibility with std templates
121  size_t size() const
122  { return DataPoints.size(); }
123  /// @brief Get the amount of stored DataPoints
124  /// @note Name chosen to match standard containers
125  /// @return How many data points exist on this track
126  /// @note Name for consistency with naming conventions and implemented in terms of size().
127  size_t Size() const
128  { return size(); }
129 
130  /// @brief Add another data point to the end of the track.
131  /// @param AddedValue The data point to add to theend of the track.
132  /// @note Name for compatibility with std templates.
133  virtual void push_back(const InterpolatableType& AddedValue)
134  { DataPoints.push_back(AddedValue); }
135  /// @brief Add another data point to the end of the track.
136  /// @param AddedValue The data point to add to theend of the track.
137  /// @note Name for consistency with naming conventions and implemented in terms of push_back().
138  virtual void Add(const InterpolatableType& AddedValue)
139  { push_back(AddedValue); }
140 
141  /// @brief Remove all the points from the track
142  void clear()
143  { DataPoints.clear(); }
144  /// @copydoc clear
145  void Clear()
146  { clear(); }
147 
148  /// @brief Get an Smooth iterator to the beginning of the track.
149  /// @details A Smooth iterator will take a fixed number of steps across
150  /// a data set, interpolating values not actually present.
151  /// @param Steps How many steps to take, defaults to 100.
152  virtual SmoothIteratorType begin(Integer Steps=100) const
153  {
154  return SmoothIteratorType(this, 0.0,
155  (Steps?(PreciseReal(1.0)/PreciseReal(Steps)):0.0)
156  );
157  }
158  /// @copydoc begin
159  virtual SmoothIteratorType Begin(Integer Steps=100) const
160  { return begin(Steps); }
161 
162  /// @brief Get an Smooth iterator to the end (not one past) of the track.
163  /// @details A Smooth iterator will take a fixed number of steps across
164  /// a data set, interpolating values not actually present.
165  /// @param Steps How many steps to take if any, defaults to 0.
166  virtual SmoothIteratorType end(Integer Steps=0) const
167  {
168  return SmoothIteratorType(this, 1.0,
169  (Steps?(PreciseReal(1.0)/PreciseReal(Steps)):0.0)
170  );
171  }
172  /// @copydoc end
173  virtual SmoothIteratorType End(Integer Steps=0) const
174  { return end(Steps); }
175 
176  /// @brief Get a value from somewhere on the track with 0.0 being the beginning and 1.0 being the end.
177  /// @param Percentage A Value between 0 and 1 that the interpolator will use to pick a point on or between the datapoints.
178  /// @return InterpolatableType that is Percentage from through the track.
179  virtual InterpolatableType GetInterpolated(Real Percentage) const
180  {
181  return InterpolatorType::Interpolate(
182  this->DataPoints.begin(),
183  this->DataPoints.end(),
184  Percentage
185  );
186  }
187 
188  /// @brief Get a value between two points on the track with 0.0 being a specified datapoint and 1.0 being the next datapoint.
189  /// @param Index The Nth datapoint which will define the start of the range to interpolate. Max allowed value is: size - 2.
190  /// @param Percentage A Value between 0 and 1 that the interpolator will use to pick a point on or between the datapoints.
191  /// @return Returns a InterpolatableType that is the interpolated value between the two data points starting at the specified index.
192  virtual InterpolatableType GetInterpolated(size_t Index, Real Percentage) const
193  {
194  if( Index <= this->Size() - 2 ) {
195  ConstDataIteratorType RangeBegin = this->DataPoints.begin(), RangeEnd = this->DataPoints.begin();
196  std::advance( RangeBegin, Index );
197  std::advance( RangeEnd, Index + 2 );
198  return InterpolatorType::Interpolate(RangeBegin,RangeEnd,Percentage);
199  }else{
200  MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_RANGE_EXCEPTION,"Attempting to get the interpolated value of a datapoint that is not in the valid range.");
201  }
202  }
203 
204  /// @brief Set the name for serialization.
205  /// @param Name the Name for finding this track in serialized streams.
206  void SetTrackName(String Name)
207  { RawName = Name; }
208 
209  /// @brief Set the name to something that serialization definitely will not duplicate
210  /// @details Because serialization of racks must have a name unique numbers are assigned
211  /// when a nameisnot present. This function will set the name either to the pased value
212  /// if serialzation will never touch it, or to some value that serialization cannot clobber.
213  /// @param Name The name you would like if it is compatible.
214  /// @return Whatever was actually set for a name.
216  {
217  if(Name.size() && 0==ConvertTo<ConvertiblePointer>(Name))
218  {
219  SetTrackName(Name);
220  }else{
222  }
223  return RawName;
224  }
225 
226  /// @brief Get the given name or generate a default name.
227  /// @return This will either return whatever was set with SetTrackName(String Name) or some value that likely unique.
228  /// @warning Do not set one tracks name to another and these will remain under all but the most extreme situations.
229  /// @warning 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.
231  {
232  if(RawName.empty())
233  { return ToString(ConvertiblePointer(this)); }
234  return RawName;
235  }
236 
237  /// @brief This is just like the const version of the function but it will set the name if unset and retrieve it.
238  /// @return A name of some kind in string.
240  {
241  if(RawName.empty())
242  { SetTrackNameUnique(); }
243  return RawName;
244  }
245 
246  /// @brief Convert this to a node on an XML graph
247  /// @param CurrentRoot the node that will become the parent for the one this creates.
248  /// @details This function is also used to serialize Looped Tracks.
249  /// This serializes the interpoator in use and each data point.
250  virtual void ProtoSerialize(XML::Node& CurrentRoot) const
251  {
252  Mezzanine::XML::Node TrackNode = CurrentRoot.AppendChild(DerivedSerializableName());
253 
254  if(TrackNode)
255  {
256  Mezzanine::XML::Attribute VersionAttr = TrackNode.AppendAttribute("Version");
257  if( VersionAttr )
258  {
259  if( !VersionAttr.SetValue("1") )
260  { SerializeError("Create XML Version Attribute Values", DerivedSerializableName()); }
261  }else{
262  SerializeError("Create XML Version Attributes", DerivedSerializableName());
263  }
264 
265 
266  Mezzanine::XML::Attribute NameAttr = TrackNode.AppendAttribute("Name");
267  if( NameAttr )
268  {
269  if( !NameAttr.SetValue(GetTrackName()) )
270  { SerializeError("Create XML Name Values", DerivedSerializableName()); }
271  }else{
272  SerializeError("Create XML Name Attributes", DerivedSerializableName());
273  }
274 
275  Mezzanine::XML::Node InterpolatorNode = TrackNode.AppendChild("Interpolator");
276  if(InterpolatorNode)
277  {
278  InterpolatorType::ProtoSerialize(InterpolatorNode);
279  }else{
280  SerializeError("Create XML Interpolator Node", DerivedSerializableName());
281  }
282 
283  Mezzanine::XML::Node DataNode = TrackNode.AppendChild("DataPoints");
284  if(DataNode)
285  {
286  for(typename DataContainerType::const_iterator Iter = DataPoints.begin();
287  DataPoints.end()!=Iter;
288  ++Iter)
289  { Iter->ProtoSerialize(DataNode);}
290  }else{
291  SerializeError("Create XML DataPoints Node", DerivedSerializableName());
292  }
293 
294  }else{
295  SerializeError("Create XML Serialization Node", DerivedSerializableName());
296  }
297  }
298 
299  /// @brief Convert a node on an XML into a track.
300  /// @details This will convert and XML into Track or LoopedTrack templated
301  /// on the type that matches this instance of this class.
302  virtual void ProtoDeSerialize(const XML::Node& OneNode)
303  {
304  if ( String(OneNode.Name())==String(DerivedSerializableName()) )
305  {
306  if(OneNode.GetAttribute("Version").AsInt() == 1)
307  {
308  Mezzanine::XML::Node InterpolatorNode = OneNode.GetChild("Interpolator").GetFirstChild();
309  if(InterpolatorNode.Name() == InterpolatorType::GetSerializableName())
310  {
311  InterpolatorType::ProtoDeSerialize(InterpolatorNode);
312  }else{
313  //DeSerializeError(); // Maybe use this instead?
314  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_INVALID_EXCEPTION,"Incompatible Interpolator Type Version for " + DerivedSerializableName() + ": Not " + InterpolatorType::GetSerializableName());
315  }
316 
317  SetTrackNameUnique(OneNode.GetAttribute("Name").AsString());
318  Mezzanine::XML::Node DataNode = OneNode.GetChild("DataPoints");
319  if(DataNode)
320  {
321  XML::Node Iter=DataNode.GetFirstChild();
322  while(Iter)
323  {
324  InterpolatableType Scratch;
325  Scratch.ProtoDeSerialize(Iter);
326  DataPoints.push_back(Scratch);
327  Iter = Iter.GetNextSibling();
328  }
329  }// No else the track could be empty
330  }else{
331  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + DerivedSerializableName() + ": Not Version 1.");
332  }
333  }else{
334  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + DerivedSerializableName() + ", found a " + String(OneNode.Name()) + ".");
335  }
336 
337  }
338 
339  /// @Polymorphicaly get the classnae at runtime
340  /// @return A String Containing a class name,likely"Track" or "TrackLooped"
342  { return Track::GetSerializableName(); }
343 
344  /// @brief Get the name of this class "Track"
345  /// @return A string containing "Track"
347  { return String("Track"); }
348 
349 
350  };
351 
352  /// @brief A track that keeps an extra data point in the track to make sure it loops.
353  /// @details when Add or push_back is called and there are 2 or more points the track,
354  /// this seamlessly adds a copy of the first data point to the end of the track. When
355  /// Iterating with a Smooth iterator this creates the impression of a loop inside the simulation.
356  template <typename InterpolatorType>
357  class TrackLooped : public Track<InterpolatorType>
358  {
359  protected:
360  /// @brief The base most class of this type.
362 
363  public:
364  /// @brief The type this class and the interpolator it uses works with.
365  typedef typename InterpolatorType::InterpolatableType InterpolatableType;
366  /// @brief The type of the Container storing the interpolatable data. This is a single point to change all the tracks
367  typedef std::vector<InterpolatableType> DataContainerType;
368  /// @brief The iterator type for the interpolated data stored in this track.
369  typedef typename DataContainerType::iterator DataIteratorType;
370  /// @brief An iterator than can take an arbitrary amount of steps by interpolation.
372 
373  /// @brief Create a Track from a range of data points, and enforce its being a loop.
374  /// @param Begin An iterator pointing to the beginning of a range to copy.
375  /// @param End an iterator pointing to one past the rang to copy.
376  TrackLooped(DataIteratorType Begin,
377  DataIteratorType End)
378  : BaseType(Begin,End)
379  { EnforceLoop(); }
380  /// @brief Create a track from a DataContainerType instance, likely a vector and copy the data from it, and enforce it being a loop
381  /// @param DataSet A collection of data points to copy.
382  /// @details if the last item does not match the first this fixes that.
383  TrackLooped(const DataContainerType& DataSet)
384  : BaseType(DataSet)
385  { EnforceLoop(); }
386  /// @brief Create a default empty looped track.
388  {}
389  /// @brief Virtual Deconstructor.
390  virtual ~TrackLooped()
391  {}
392 
393  /// @brief If this track has more than one datapoint, does the first match the last, if not fix it.
394  void EnforceLoop()
395  {
397  { BaseType::DataPoints.push_back(*(BaseType::DataPoints.begin())); }
398  }
399 
400  /// @brief Add another data point, and preserve the track's loopwhile doing so.
401  /// @param AddedValue The data point to add.
402  virtual void push_back(const InterpolatableType& AddedValue)
403  {
404  if(BaseType::DataPoints.size()>1)
405  {
406  *(BaseType::DataPoints.end()-1) = AddedValue;
408  }else if(BaseType::DataPoints.size()==1){
409  BaseType::DataPoints.push_back(AddedValue);
411  }else{
412  BaseType::DataPoints.push_back(AddedValue);
413  }
414  }
415 
416  /// @Polymorphicaly get the classnae at runtime
417  /// @return A String Containing a class name,likely"Track" or "TrackLooped"
420 
421  /// @brief Get the name of this class "TrackLooped"
422  /// @return A string containing "TrackLooped"
424  { return String("TrackLooped"); }
425  };
426 
427 
428 }//Mezzanine
429 
430 #ifndef SWIG
431 
432 /// @brief Used to Serialize an Mezzanine::Track to a human readable stream.
433 /// @param Lint The Mezzanine::Track to be converted to characters.
434 /// @param stream The place to send the characters, that define the Mezzanine::Track.
435 /// @return Get an std::ostream that was written to, this allow chaining of the << operators.
436 template<typename T>
437 std::ostream& operator << (std::ostream& stream, const Mezzanine::Track<T>& Lint)
438 {
439  Serialize(stream,Lint);
440  return stream;
441 }
442 
443 /// @brief Used to de-serialize an Mezzanine::Track from a stream
444 /// @param Lint The Mezzanine::Track that will accept the values from the xml.
445 /// @param stream The place to get the characters from, that define the Mezzanine::Track.
446 /// @return Get an std::ostream that was read from, this allow chaining of the >> operators.
447 template<typename T>
448 std::istream& operator >> (std::istream& stream, Mezzanine::Track<T>& Lint)
449  { return DeSerialize(stream, Lint); }
450 
451 
452 /// @brief Used to Serialize an Mezzanine::TrackLooped to a human readable stream.
453 /// @param Lint The Mezzanine::TrackLooped to be converted to characters.
454 /// @param stream The place to send the characters, that define the Mezzanine::TrackLooped.
455 /// @return Get an std::ostream that was written to, this allow chaining of the << operators.
456 template<typename T>
457 std::ostream& operator << (std::ostream& stream, const Mezzanine::TrackLooped<T>& Lint)
458 {
459  Serialize(stream,Lint);
460  return stream;
461 }
462 
463 /// @brief Used to de-serialize an Mezzanine::TrackLooped from a stream
464 /// @param Lint The Mezzanine::TrackLooped that will accept the values from the xml.
465 /// @param stream The place to get the characters from, that define the Mezzanine::TrackLooped.
466 /// @return Get an std::ostream that was read from, this allow chaining of the >> operators.
467 template<typename T>
468 std::istream& operator >> (std::istream& stream, Mezzanine::TrackLooped<T>& Lint)
469  { return DeSerialize(stream, Lint); }
470 
471 #endif
472 
473 #endif
474 
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...
Definition: track.h:192
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
String GetTrackName() const
Get the given name or generate a default name.
Definition: track.h:230
A track that keeps an extra data point in the track to make sure it loops.
Definition: track.h:357
String ToString(const T &Datum)
Converts whatever to a String as long as a streaming operator is available for it.
Definition: datatypes.h:242
void EnforceLoop()
If this track has more than one datapoint, does the first match the last, if not fix it...
Definition: track.h:394
TrackLooped(DataIteratorType Begin, DataIteratorType End)
Create a Track from a range of data points, and enforce its being a loop.
Definition: track.h:376
Node GetFirstChild() const
Get the first child Node of this Node.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Definition: exception.h:3048
All the definitions for datatypes as well as some basic conversion functions are defined here...
std::ostream & Serialize(std::ostream &Stream, const T &Converted, const String &Indent=String(""))
Convert any class that supports serialization or has a serializer to a string of chars in a stream...
virtual void push_back(const InterpolatableType &AddedValue)
Add another data point, and preserve the track's loopwhile doing so.
Definition: track.h:402
int Integer
A datatype used to represent any integer close to.
Definition: datatypes.h:154
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
std::vector< InterpolatableType > DataContainerType
The type of the Container storing the interpolatable data. This is a single point to change all the t...
Definition: track.h:367
void clear()
Remove all the points from the track.
Definition: track.h:142
Any global enumerations shared between multiple classes is to be declared here.
size_t size() const
Get the amount of stored DataPoints.
Definition: track.h:121
virtual SmoothIteratorType begin(Integer Steps=100) const
Get an Smooth iterator to the beginning of the track.
Definition: track.h:152
Track< InterpolatorType > BaseType
The base most class of this type.
Definition: track.h:361
This implements the exception hiearchy for Mezzanine.
Track(const DataContainerType &DataSet)
Create a track from a DataContainerType instance, likely a vector and copthe data from it...
Definition: track.h:108
DataContainerType::const_iterator ConstDataIteratorType
A const iterator type for the elements stored and interpolated within this track. ...
Definition: track.h:86
SmoothTrackIterator< InterpolatableType > SmoothIteratorType
An iterator than can take an arbitrary amount of steps by interpolation.
Definition: track.h:371
InterpolatorType::Storage DataContainerType
The type of the internal container storing the interpolatable data. This is a single point to change ...
Definition: track.h:80
Node GetNextSibling() const
Attempt to retrieve the next sibling of this Node.
TrackLooped()
Create a default empty looped track.
Definition: track.h:387
void SetTrackName(String Name)
Set the name for serialization.
Definition: track.h:206
SmoothTrackIterator< InterpolatorType > SmoothIteratorType
An iterator than can take an arbitrary amount of steps by interpolation.
Definition: track.h:89
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
virtual void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this to a node on an XML graph.
Definition: track.h:250
bool SetValue(const Char8 *rhs)
Set the value of this.
TrackLooped(const DataContainerType &DataSet)
Create a track from a DataContainerType instance, likely a vector and copy the data from it...
Definition: track.h:383
String RawName
Name of the track, primarily for serialization.
Definition: track.h:96
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
InterpolatorType::InterpolatableType InterpolatableType
The type this class and the interpolator it uses works with.
Definition: track.h:69
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...
Definition: track.h:179
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
DataContainerType::iterator DataIteratorType
The iterator type for the interpolated data stored in this track.
Definition: track.h:369
Thrown when a passed parameter is checked at runtime and not in the expected range.
Definition: exception.h:110
InterpolatorType::InterpolatableType InterpolatableType
The type this class and the interpolator it uses works with.
Definition: track.h:365
void Clear()
Remove all the points from the track.
Definition: track.h:145
virtual ~Track()
Virtual Deconstructor.
Definition: track.h:114
An Iterator that can take an arbitrary amount of steps through a track.
Definition: trackiterator.h:76
std::istream & DeSerialize(std::istream &Stream, T &Converted)
Deserialize the next xml tag in the stream into a specific in memory class instance.
DataContainerType DataPoints
The underlying container of Discrete datapoints.
Definition: track.h:93
size_t Size() const
Get the amount of stored DataPoints.
Definition: track.h:127
virtual SmoothIteratorType end(Integer Steps=0) const
Get an Smooth iterator to the end (not one past) of the track.
Definition: track.h:166
DataContainerType::iterator DataIteratorType
An iterator type for the elements stored and interpolated within this track.
Definition: track.h:83
static String GetSerializableName()
Get the name of this class "Track".
Definition: track.h:346
virtual void push_back(const InterpolatableType &AddedValue)
Add another data point to the end of the track.
Definition: track.h:133
static String GetSerializableName()
Get the name of this class "TrackLooped".
Definition: track.h:423
Track(DataIteratorType Begin, DataIteratorType End)
Create a Track from a range of data points.
Definition: track.h:102
Thrown when the identity string wasn't valid at all.
Definition: exception.h:93
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
virtual ~TrackLooped()
Virtual Deconstructor.
Definition: track.h:390
double PreciseReal
A Real number that is at least as precise as the Real and could be considerably moreso, perhaps Doubly precise. This type might be poorly aligned but very precise.
Definition: datatypes.h:146
std::istream & operator>>(std::istream &stream, Mezzanine::LinearInterpolator< T > &Lint)
Used to de-serialize an Mezzanine::LinearInterpolator from a stream.
Definition: interpolator.h:448
intptr_t ConvertiblePointer
A type that any pointer can be converted to and back from, and insures after the conversion back it w...
Definition: datatypes.h:112
virtual void Add(const InterpolatableType &AddedValue)
Add another data point to the end of the track.
Definition: track.h:138
virtual void ProtoDeSerialize(const XML::Node &OneNode)
Convert a node on an XML into a track.
Definition: track.h:302
const String & GetTrackName()
This is just like the const version of the function but it will set the name if unset and retrieve it...
Definition: track.h:239
const Char8 * Name() const
ptrdiff_tGet the name of this Node.
virtual SmoothIteratorType Begin(Integer Steps=100) const
Get an Smooth iterator to the beginning of the track.
Definition: track.h:159
String SetTrackNameUnique(String Name="")
Set the name to something that serialization definitely will not duplicate.
Definition: track.h:215
Track()
Create a default empty track.
Definition: track.h:111
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
Helper classes to assist in generating data points between two other data points. ...
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
virtual String DerivedSerializableName() const
Definition: track.h:418
A base type that provides container features for different tracks.
Definition: track.h:65
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual SmoothIteratorType End(Integer Steps=0) const
Get an Smooth iterator to the end (not one past) of the track.
Definition: track.h:173
virtual String DerivedSerializableName() const
Definition: track.h:341
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.