Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Wheel.cpp
Go to the documentation of this file.
1 
7 #include "Wheel.h"
8 #include "tracer/tracer.h"
9 
10 namespace ODemo {
11 using std::string;
12 
13 Wheel::Wheel() : m_speed(0.0), m_rotating(false) { COMP_MISC_MEMBER_TRACER; }
14 
15 Wheel::Wheel(const Wheel& ori) : m_speed(ori.m_speed), m_rotating(ori.m_rotating) { COMP_MISC_MEMBER_TRACER; }
16 
17 Wheel::Wheel(Wheel&& ori) noexcept : m_speed(ori.m_speed), m_rotating(ori.m_rotating) { COMP_MISC_MEMBER_TRACER; }
18 
20 {
22  if (this != &rhs) {
23  m_speed = rhs.m_speed;
24  m_rotating = rhs.m_rotating;
25  }
26  return *this;
27 }
28 
29 Wheel& Wheel::operator=(Wheel&& rhs) noexcept
30 {
32  if (this != &rhs) {
33  m_speed = rhs.m_speed;
34  m_rotating = rhs.m_rotating;
35  }
36  return *this;
37 }
38 
40 
42 {
44  if (!m_rotating) {
45  m_rotating = true;
46  }
47 }
48 
50 {
52  if (m_rotating) {
53  m_rotating = false;
54  }
55 }
56 
57 bool Wheel::is_rotating() const
58 {
60  return m_rotating;
61 }
62 
63 } // namespace ODemo
Comprehensive include file for all tracer classes.
A really simple class for Wheel.
Definition: Wheel.h:13
bool m_rotating
Definition: Wheel.h:45
Wheel()
Default constructor.
Definition: Wheel.cpp:13
double m_speed
Definition: Wheel.h:44
Wheel & operator=(const Wheel &rhs)
Copy assignment operator.
Definition: Wheel.cpp:19
bool is_rotating() const
Indicate whether wheel is rotating or not.
Definition: Wheel.cpp:57
#define COMP_MISC_MEMBER_TRACER
Macro for tracking member scope.
Definition: MemberTracer.h:21
void start()
Start turning.
Definition: Wheel.cpp:41
void stop()
Stop turning.
Definition: Wheel.cpp:49
~Wheel()
destructor.
Definition: Wheel.cpp:39
Header for the Wheel class used to demo object aggregation features.