Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Bicycle.cpp
Go to the documentation of this file.
1 
7 #include "Bicycle.h"
8 #include "tracer/tracer.h"
9 
10 namespace ODemo {
11 
12 using namespace std;
13 
14 Bicycle::Bicycle() : PassengerRoadVehicle(2), m_model("Unknown model"), m_color("Unknown color")
15 {
17 }
18 
19 Bicycle::Bicycle(std::string model, std::string color)
20  : PassengerRoadVehicle(2), m_model(std::move(model)), m_color(std::move(color))
21 {
23 }
24 
25 Bicycle::Bicycle(const Bicycle& ori) : PassengerRoadVehicle(ori), m_model(ori.m_model), m_color(ori.m_color)
26 {
28 }
29 
30 Bicycle::Bicycle(Bicycle&& ori) noexcept
31  : PassengerRoadVehicle(std::move(ori)), m_model(std::move(ori.m_model)), m_color(std::move(ori.m_color))
32 {
34 }
35 
37 {
39  if (this != &rhs) {
41  this->m_model = rhs.m_model;
42  this->m_color = rhs.m_color;
43  }
44  return *this;
45 }
46 
48 {
50  if (this != &rhs) {
51  PassengerRoadVehicle::operator=(std::move(rhs));
52  m_model = std::move(rhs.m_model);
53  m_color = std::move(rhs.m_color);
54 
55  // Leave the argument in an indeterminate state.
56  rhs.m_model = "";
57  rhs.m_color = "";
58  }
59  return *this;
60 }
61 
63 
64 string Bicycle::getModel() const
65 {
67  return m_model;
68 }
69 
70 string Bicycle::getColor() const
71 {
73  return m_color;
74 }
75 
76 void Bicycle::setModel(string model)
77 {
79  m_model = std::move(model);
80 }
81 
82 void Bicycle::setColor(string color)
83 {
85  m_color = std::move(color);
86 }
87 
88 void Bicycle::info() const
89 {
91  const string s = {"I'm a bicycle: model = " + m_model + ", color = " + m_color};
93 }
94 
95 } // namespace ODemo
std::string getModel() const
Return the model of the bike.
Definition: Bicycle.cpp:64
Comprehensive include file for all tracer classes.
std::string m_model
Definition: Bicycle.h:56
PassengerRoadVehicle & operator=(PassengerRoadVehicle const &rhs)
Copy assignment.
void setColor(std::string color)
Set the color of the bike.
Definition: Bicycle.cpp:82
std::string getColor() const
Return the color of the bike.
Definition: Bicycle.cpp:70
~Bicycle() override
Destructor.
Definition: Bicycle.cpp:62
void info() const override
Display info on model and color of the bike.
Definition: Bicycle.cpp:88
#define COMP_MISC_MEMBER_TRACER
Macro for tracking member scope.
Definition: MemberTracer.h:21
A PassengerRoadVehicle transports one or more passengers.
std::string m_color
Definition: Bicycle.h:57
#define COMP_MISC_LOG_TRACER(MSG)
Macro for inserting log message into tracker output at current severity level.
Definition: TracerOutput.h:17
Header for Bicycle class.
Bicycle & operator=(const Bicycle &rhs)
Copy assignment.
Definition: Bicycle.cpp:36
Represents a simple Bicycle.
Definition: Bicycle.h:16
Bicycle()
Default constructor.
Definition: Bicycle.cpp:14
void setModel(std::string model)
Set the model of the bike.
Definition: Bicycle.cpp:76