Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
ODemo::Motorcycle Class Reference

Motorcycle with Engine and Owner. More...

#include <Motorcycle.h>

Collaboration diagram for ODemo::Motorcycle:
Collaboration graph

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...
 
Motorcycleoperator= (Motorcycle const &rhs)
 Copy assignment. More...
 
Motorcycleoperator= (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< Engineget_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< Enginem_engine
 
std::unique_ptr< Bodym_body
 
const Personm_owner
 
std::array< Wheel, 2 > m_wheels
 
double m_speed
 
double m_direction
 

Detailed Description

Motorcycle with Engine and Owner.

Definition at line 20 of file Motorcycle.h.

Constructor & Destructor Documentation

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.

ODemo::Motorcycle::Motorcycle ( std::shared_ptr< Engine > const &  enginePtr)
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.

ODemo::Motorcycle::Motorcycle ( Motorcycle &&  ori)
noexcept

Move constructor.

Definition at line 51 of file Motorcycle.cpp.

References COMP_MISC_MEMBER_TRACER.

ODemo::Motorcycle::~Motorcycle ( )

Destructor.

Definition at line 103 of file Motorcycle.cpp.

References COMP_MISC_MEMBER_TRACER.

Member Function Documentation

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.

Motorcycle & ODemo::Motorcycle::operator= ( Motorcycle &&  rhs)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Member Data Documentation

std::shared_ptr<Engine> ODemo::Motorcycle::m_engine
private
std::unique_ptr<Body> ODemo::Motorcycle::m_body
private

Definition at line 85 of file Motorcycle.h.

Referenced by operator=().

const Person* ODemo::Motorcycle::m_owner
private

Definition at line 86 of file Motorcycle.h.

Referenced by get_owner(), operator=(), and set_owner().

std::array<Wheel, 2> ODemo::Motorcycle::m_wheels
private

Definition at line 87 of file Motorcycle.h.

Referenced by Motorcycle(), and operator=().

double ODemo::Motorcycle::m_speed
private

Definition at line 88 of file Motorcycle.h.

Referenced by accelerate(), brake(), getSpeed(), operator=(), startEngine(), stopEngine(), and turn().

double ODemo::Motorcycle::m_direction
private

Definition at line 89 of file Motorcycle.h.

Referenced by operator=(), and turn().


The documentation for this class was generated from the following files: