Gobelijn API documentation
- generated for commit a0cbea7
|
Motorcycle with Engine and Owner. More...
#include <Motorcycle.h>
Public Member Functions | |
Motorcycle () | |
Default constructor does not initialize association with engine and owner. More... | |
Motorcycle (std::shared_ptr< Engine > const &enginePtr) | |
Constructor initializes association with engine only. More... | |
Motorcycle (std::shared_ptr< Engine > const &enginePtr, Person const *ownerPtr) | |
Constructor initializes association with engine and owner. More... | |
Motorcycle (Motorcycle const &ori) | |
Copy constructor. More... | |
Motorcycle (Motorcycle &&ori) noexcept | |
Move constructor. More... | |
Motorcycle & | operator= (Motorcycle const &rhs) |
Copy assignment. More... | |
Motorcycle & | operator= (Motorcycle &&rhs) noexcept |
Move assignment. More... | |
~Motorcycle () | |
Destructor. More... | |
void | startEngine () |
Start the motorcycle engine. More... | |
void | stopEngine () |
Stop the motorcycle engine. More... | |
void | accelerate (double speed) |
Accelerate up to given speed. More... | |
void | brake (double speed) |
Brake until given speed. More... | |
void | halt () |
Brake to zero speed, keep engine running. More... | |
void | turn (double degrees) |
double | getSpeed () const |
Return current speed. More... | |
bool | is_running () const |
Indicates whether engine is running or not. More... | |
std::shared_ptr< Engine > | get_engine () |
Returns pointer to the Engine (may be 0). More... | |
Person const * | get_owner () const |
Returns pointer to the owner (may be 0). More... | |
void | set_engine (std::shared_ptr< Engine > const &newEnginePtr) |
Resets engine. More... | |
void | set_owner (Person *newOwnerPtr) |
Resets owner. More... | |
Private Attributes | |
std::shared_ptr< Engine > | m_engine |
std::unique_ptr< Body > | m_body |
const Person * | m_owner |
std::array< Wheel, 2 > | m_wheels |
double | m_speed |
double | m_direction |
Motorcycle with Engine and Owner.
Definition at line 20 of file Motorcycle.h.
ODemo::Motorcycle::Motorcycle | ( | ) |
Default constructor does not initialize association with engine and owner.
Definition at line 18 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_wheels.
|
explicit |
Constructor initializes association with engine only.
ODemo::Motorcycle::Motorcycle | ( | std::shared_ptr< Engine > const & | enginePtr, |
Person const * | ownerPtr | ||
) |
Constructor initializes association with engine and owner.
ODemo::Motorcycle::Motorcycle | ( | Motorcycle const & | ori | ) |
Copy constructor.
Definition at line 41 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_engine.
|
noexcept |
ODemo::Motorcycle::~Motorcycle | ( | ) |
Motorcycle & ODemo::Motorcycle::operator= | ( | Motorcycle const & | rhs | ) |
Copy assignment.
Definition at line 64 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, m_body, m_direction, m_engine, m_owner, m_speed, and m_wheels.
|
noexcept |
Move assignment.
Definition at line 82 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, m_body, m_direction, m_engine, m_owner, m_speed, and m_wheels.
void ODemo::Motorcycle::startEngine | ( | ) |
Start the motorcycle engine.
Definition at line 105 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, m_engine, and m_speed.
void ODemo::Motorcycle::stopEngine | ( | ) |
Stop the motorcycle engine.
Definition at line 117 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, halt(), m_engine, and m_speed.
Referenced by app_copy().
void ODemo::Motorcycle::accelerate | ( | double | speed | ) |
Accelerate up to given speed.
Definition at line 131 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, m_engine, and m_speed.
Referenced by app_essentialops().
void ODemo::Motorcycle::brake | ( | double | speed | ) |
Brake until given speed.
Definition at line 142 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, m_engine, and m_speed.
Referenced by halt().
void ODemo::Motorcycle::halt | ( | ) |
Brake to zero speed, keep engine running.
Definition at line 153 of file Motorcycle.cpp.
References brake(), and COMP_MISC_MEMBER_TRACER.
Referenced by stopEngine().
void ODemo::Motorcycle::turn | ( | double | degrees | ) |
Definition at line 159 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, m_direction, and m_speed.
double ODemo::Motorcycle::getSpeed | ( | ) | const |
Return current speed.
Definition at line 167 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_speed.
bool ODemo::Motorcycle::is_running | ( | ) | const |
Indicates whether engine is running or not.
Definition at line 173 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_engine.
shared_ptr< Engine > ODemo::Motorcycle::get_engine | ( | ) |
Returns pointer to the Engine (may be 0).
Definition at line 182 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_engine.
const Person * ODemo::Motorcycle::get_owner | ( | ) | const |
Returns pointer to the owner (may be 0).
Definition at line 188 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_owner.
void ODemo::Motorcycle::set_engine | ( | std::shared_ptr< Engine > const & | newEnginePtr | ) |
Resets engine.
Definition at line 194 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_engine.
void ODemo::Motorcycle::set_owner | ( | Person * | newOwnerPtr | ) |
Resets owner.
Definition at line 200 of file Motorcycle.cpp.
References COMP_MISC_MEMBER_TRACER, and m_owner.
|
private |
Definition at line 84 of file Motorcycle.h.
Referenced by accelerate(), brake(), get_engine(), is_running(), Motorcycle(), operator=(), set_engine(), startEngine(), and stopEngine().
|
private |
Definition at line 85 of file Motorcycle.h.
Referenced by operator=().
|
private |
Definition at line 86 of file Motorcycle.h.
Referenced by get_owner(), operator=(), and set_owner().
|
private |
Definition at line 87 of file Motorcycle.h.
Referenced by Motorcycle(), and operator=().
|
private |
Definition at line 88 of file Motorcycle.h.
Referenced by accelerate(), brake(), getSpeed(), operator=(), startEngine(), stopEngine(), and turn().
|
private |
Definition at line 89 of file Motorcycle.h.
Referenced by operator=(), and turn().