Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Unicycle.cpp
Go to the documentation of this file.
1 
8 #include "objtracer/Unicycle.h"
9 #include "tracer/tracer.h"
10 
11 namespace ODemo {
12 using std::string;
13 
14 Unicycle::Unicycle() : m_wheel(), m_speed(0.0), m_direction(0.0) { COMP_MISC_MEMBER_TRACER; }
15 
16 // Perform a deep copy of the engine and a shallow copy of the owner
17 Unicycle::Unicycle(Unicycle const& ori) : m_wheel(ori.m_wheel), m_speed(ori.m_speed), m_direction(ori.m_direction)
18 {
20 }
21 
22 // Perform a deep copy of the engine and a shallow copy of the owner
24  : m_wheel(std::move(ori.m_wheel)), m_speed(ori.m_speed), m_direction(ori.m_direction)
25 {
27 }
28 
29 // Copy constructor does what the synthesized constructor would do..
31 {
33  if (this != &rhs) {
34  m_wheel = rhs.m_wheel;
35  m_speed = rhs.m_speed;
37  }
38  return *this;
39 }
40 
41 // Move constructor does what the synthesized constructor would do..
43 {
45  if (this != &rhs) {
46  m_wheel = std::move(rhs.m_wheel);
47  m_speed = rhs.m_speed;
48  m_direction = rhs.m_direction;
49  }
50  return *this;
51 }
52 
53 // Nothing to do here..
55 
56 void Unicycle::accelerate(double speed)
57 {
59  m_speed = speed;
60 }
61 
62 void Unicycle::brake(double speed)
63 {
65  m_speed = speed;
66 }
67 
68 void Unicycle::turn(double degrees)
69 {
71  if (m_speed > 0.0) {
72  m_direction += degrees;
73  }
74 }
75 
76 } // namespace ODemo
Comprehensive include file for all tracer classes.
double m_direction
Definition: Unicycle.h:47
double m_speed
Definition: Unicycle.h:46
void accelerate(double speed)
Accelerate up to given speed.
Definition: Unicycle.cpp:56
Unicycle & operator=(const Unicycle &rhs)
Copy assignment.
Definition: Unicycle.cpp:30
void brake(double speed)
Brake until given speed.
Definition: Unicycle.cpp:62
void turn(double degrees)
Definition: Unicycle.cpp:68
Unicycle()
Default constructor does not initialize association with engine and owner.
Definition: Unicycle.cpp:14
Header for the Unicycle class.
#define COMP_MISC_MEMBER_TRACER
Macro for tracking member scope.
Definition: MemberTracer.h:21
Unicycle interface.
Definition: Unicycle.h:14
~Unicycle()
Destructor.
Definition: Unicycle.cpp:54
Wheel m_wheel
Definition: Unicycle.h:45