Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Engine.cpp
Go to the documentation of this file.
1 
7 #include "objtracer/Engine.h"
8 #include "tracer/tracer.h"
9 
10 namespace ODemo {
11 
12 Engine::Engine(double power) : m_power(power), m_running(false) { COMP_MISC_MEMBER_TRACER; }
13 
14 Engine::Engine(Engine const& ori) : m_power(ori.m_power), m_running(ori.m_running) { COMP_MISC_MEMBER_TRACER; }
15 
16 Engine::Engine(Engine&& ori) noexcept : m_power(ori.m_power), m_running(ori.m_running) { COMP_MISC_MEMBER_TRACER; }
17 
19 {
21  if (this != &rhs) {
22  m_power = rhs.m_power;
23  m_running = rhs.m_running;
24  }
25  return *this;
26 }
27 
29 {
31  if (this != &rhs) {
32  m_power = rhs.m_power;
33  m_running = rhs.m_running;
34 
35  // Leave the argument in an indeterminate state.
36  rhs.m_power = 0.0;
37  rhs.m_running = false;
38  }
39  return *this;
40 }
41 
43 
45 {
47  if (!m_running) {
48  m_running = true;
49  }
50 }
51 
53 {
55  if (m_running) {
56  m_running = false;
57  }
58 }
59 
60 bool Engine::is_running() const
61 {
63  return m_running;
64 }
65 
66 } // namespace ODemo
Header for the Engine class used to demo object aggregation features.
Comprehensive include file for all tracer classes.
Engine & operator=(const Engine &rhs)
Copy assignment.
Definition: Engine.cpp:18
Engine that provides motion.
Definition: Engine.h:12
bool is_running() const
Indicates whether engine is running or not.
Definition: Engine.cpp:60
void stop()
Stops the engine, even if it was already stopped.
Definition: Engine.cpp:52
Engine(double power)
Constructor initializes the power, is_running status set to false.
Definition: Engine.cpp:12
~Engine()
Destructor does not do a thing.
Definition: Engine.cpp:42
void start()
Starts the engine, even if it already was running.
Definition: Engine.cpp:44
#define COMP_MISC_MEMBER_TRACER
Macro for tracking member scope.
Definition: MemberTracer.h:21
double m_power
Definition: Engine.h:43
bool m_running
Definition: Engine.h:44