My Project
Public Member Functions | List of all members
Bus Class Reference

The main class to define bus. More...

#include <bus.h>

Collaboration diagram for Bus:
Collaboration graph

Public Member Functions

 Bus (std::string name, Route *out, Route *in, int capacity=60, double speed=1)
 Constructs a bus with a standard name, two route pointers, passenger capacity and speed. More...
 
bool LoadPassenger (Passenger *)
 
bool Move ()
 Method to decide if the bus is moving. More...
 
void Update ()
 Method to update the status of bus. More...
 
void Report (std::ostream &out)
 
bool IsTripComplete ()
 Method to indicate if the bus complete all routes. More...
 
int UnloadPassengers (Stop *stop)
 Method to unload passenger to a stop. More...
 
void UpdateBusData ()
 Method to update bus data. More...
 
BusData GetBusData ()
 Getter of bus data. More...
 
std::string GetName () const
 Getter of bus name. More...
 
StopGetNextStop ()
 Getter of pointer to next stop.
 
StopGetPreviousStop ()
 Getter of pointer to previous stop.
 
size_t GetNumPassengers ()
 Getter of number of passengers on bus. More...
 
int GetCapacity ()
 Getter of pointer to bus capacity.
 

Detailed Description

The main class to define bus.

Constructor & Destructor Documentation

◆ Bus()

Bus::Bus ( std::string  name,
Route out,
Route in,
int  capacity = 60,
double  speed = 1 
)

Constructs a bus with a standard name, two route pointers, passenger capacity and speed.

Parameters
[in]stringholding a name of a bus.
[in]Route* pointing to an outgoing route.
[in]Route* pointing to an incoming route.
[in]intholding the capacity.
[in]doubleholding the speed.

Member Function Documentation

◆ GetBusData()

BusData Bus::GetBusData ( )

Getter of bus data.

◆ GetName()

std::string Bus::GetName ( ) const

Getter of bus name.

Returns
a string

◆ GetNumPassengers()

size_t Bus::GetNumPassengers ( )

Getter of number of passengers on bus.

Returns
size_t

◆ IsTripComplete()

bool Bus::IsTripComplete ( )

Method to indicate if the bus complete all routes.

◆ Move()

bool Bus::Move ( )

Method to decide if the bus is moving.

If not moving, it reaches to a stop

Returns
a Boolean value

◆ UnloadPassengers()

int Bus::UnloadPassengers ( Stop stop)

Method to unload passenger to a stop.

Returns
a integer indication the number of passengers unloaded

◆ Update()

void Bus::Update ( )

Method to update the status of bus.

It update the distance to next stop, indicators to next stop, status of every passenger on bus It involves load and unload passengers at stops

◆ UpdateBusData()

void Bus::UpdateBusData ( )

Method to update bus data.


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