Running Manager  1.7
API for Running Manager (https://github.com/HWiman-ICONIC/running-manager)
D:/dev/running-manager/Section.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Defines.h>
4 #include <boost/shared_ptr.hpp>
5 #include <wx/datetime.h>
6 #include <list>
7 
8 struct SectionBase;
9 typedef boost::shared_ptr<SectionBase> SectionPtr;
10 
16 struct SectionBase {
17  SectionBase( PTZone azone ) : zone(azone) {}
19  wxString shortName;
20  wxString description;
21  std::list<SectionPtr> subSections;
22  virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime = true) = 0;
23  static SectionPtr Create( PTZone zone, wxTimeSpan time );
24  static SectionPtr Create( PTZone zone, double distance, PTUnit unit );
25  static SectionPtr Create( PTZone, int nRepetitions );
26  void Add( SectionPtr pSubSection );
27  virtual void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan ) = 0;
28  virtual void GetDistance( double &minDist, double &maxDist, double &avgDist, PTUnit const &unit ) = 0;
29 };
30 
34 struct SectionGroup : public SectionBase {
36  virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime = true);
38  void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan );
39  void GetDistance( double &minDist, double &maxDist, double &avgDist, PTUnit const &unit );
40 };
41 
45 struct SectionDistance : public SectionBase {
47 
48  double distance;
50  virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime = true);
51 
52  void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan );
53  void GetDistance( double &minDist, double &maxDist, double &avgDist, PTUnit const &unit );
54 };
55 
59 struct SectionTime : public SectionBase {
60  SectionTime(PTZone zone, wxTimeSpan time) :
61  SectionBase(zone) {
62  this->time = time;
63  }
64  wxTimeSpan time;
65  virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime = true);
66  void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan );
67  void GetDistance( double &minDist, double &maxDist, double &avgDist, PTUnit const &unit );
68 };
SectionGroup(PTZone zone, int nRepetitions)
PTUnit
Unit.
Definition: Defines.h:69
void GetDistance(double &minDist, double &maxDist, double &avgDist, PTUnit const &unit)
virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime=true)
virtual void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan)=0
SectionDistance(PTZone zone, double distance, PTUnit unit)
virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime=true)
boost::shared_ptr< SectionBase > SectionPtr
Smart pointer to a section.
Definition: Section.h:8
virtual void GetDistance(double &minDist, double &maxDist, double &avgDist, PTUnit const &unit)=0
SectionTime(PTZone zone, wxTimeSpan time)
Definition: Section.h:60
void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan)
static SectionPtr Create(PTZone zone, wxTimeSpan time)
SectionBase(PTZone azone)
Definition: Section.h:17
PTZone zone
Definition: Section.h:18
Base class for a section.
Definition: Section.h:16
A section defined by a time/duration.
Definition: Section.h:59
void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan)
PTUnit unit
Definition: Section.h:49
virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime=true)
A section defined by a distance.
Definition: Section.h:45
PTZone
Intensity zones.
Definition: Defines.h:57
wxString shortName
Definition: Section.h:19
void Add(SectionPtr pSubSection)
int nRepetitions
Definition: Section.h:37
virtual wxString ToString(PTUnit const &outUnit, bool bZone=true, bool bTime=true)=0
wxTimeSpan time
Definition: Section.h:64
wxString description
Definition: Section.h:20
void GetTime(wxTimeSpan &minTime, wxTimeSpan &maxTime, wxTimeSpan &avgSpan)
A collection of sections, e.g. multiple repetitions of interval/pause.
Definition: Section.h:34
double distance
Definition: Section.h:48
std::list< SectionPtr > subSections
Definition: Section.h:21
void GetDistance(double &minDist, double &maxDist, double &avgDist, PTUnit const &unit)
void GetDistance(double &minDist, double &maxDist, double &avgDist, PTUnit const &unit)