Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
SailBoat.cpp
Go to the documentation of this file.
1 
7 #include "objtracer/SailBoat.h"
8 #include "tracer/tracer.h"
9 
10 namespace ODemo {
11 
12 using namespace std;
13 
14 SailBoat::SailBoat(string name) : WaterVehicle(), m_name(std::move(name)), m_sails_up(false)
15 {
17 }
18 
19 SailBoat::SailBoat(const SailBoat& ori) : WaterVehicle(ori), m_name(ori.m_name), m_sails_up(ori.m_sails_up)
20 {
22 }
23 
25  : WaterVehicle(std::move(ori)), m_name(std::move(ori.m_name)), m_sails_up(ori.m_sails_up)
26 {
28 }
29 
31 {
33  if (this != &rhs) {
35  m_name = rhs.m_name;
36  m_sails_up = rhs.m_sails_up;
37  }
38  return *this;
39 }
40 
42 {
44  if (this != &rhs) {
46  m_name = std::move(rhs.m_name);
47  m_sails_up = rhs.m_sails_up;
48  }
49  return *this;
50 }
51 
53 
54 void SailBoat::info() const
55 {
57  string s{"I'm a sailboat named \"" + m_name + "\" and my sails are "};
58  if (m_sails_up) {
59  s.append("up.");
60  } else {
61  s.append("down.");
62  }
64 }
65 
66 void SailBoat::move(double, vector<double>)
67 {
69  m_sails_up = true;
70 }
71 
72 } // namespace ODemo
void info() const override
Return identification info.
Definition: SailBoat.cpp:54
Comprehensive include file for all tracer classes.
WaterVehicle & operator=(const WaterVehicle &rhs)
Copy assignment.
Header for the SailBoat class.
Abstract WaterVehicle class.
Definition: WaterVehicle.h:15
std::string m_name
Definition: SailBoat.h:43
void move(double speed, std::vector< double > direction) override
Sailboat motion.
Definition: SailBoat.cpp:66
bool m_sails_up
Definition: SailBoat.h:44
#define COMP_MISC_MEMBER_TRACER
Macro for tracking member scope.
Definition: MemberTracer.h:21
SailBoat(std::string name)
Parametrized constructor initializes the name of the boat.
Definition: SailBoat.cpp:14
#define COMP_MISC_LOG_TRACER(MSG)
Macro for inserting log message into tracker output at current severity level.
Definition: TracerOutput.h:17
A simple SailBoat class.
Definition: SailBoat.h:15
~SailBoat() override
Destructor.
Definition: SailBoat.cpp:52
SailBoat & operator=(const SailBoat &rhs)
Copy assignment.
Definition: SailBoat.cpp:30