Miscellaneous scripts
This repository contains miscellaneous scripts that does not fit in one repository, yet I will use them sometimes for my personal use. Note that some of the scripts might contain hardcoded paths and opinionated presets, and you are advised to inspect them before actually using.
 
Loading...
Searching...
No Matches
Queue Class Reference
Collaboration diagram for Queue:

Public Member Functions

 Queue (unsigned int _id, unsigned int _numPeople, Lift *_lift)
 
auto operator< (const Queue &queue) const -> bool
 

Public Attributes

unsigned int id
 
const Liftlift
 
unsigned int numPeople
 
unsigned int waitingTime = 0
 

Friends

auto operator<< (std::ostream &os, const Queue &queue) -> std::ostream &
 

Detailed Description

Definition at line 81 of file lift.cpp.

Constructor & Destructor Documentation

◆ Queue()

Queue::Queue ( unsigned int _id,
unsigned int _numPeople,
Lift * _lift )
inline

Definition at line 89 of file lift.cpp.

90 : id(_id), numPeople(_numPeople), lift(_lift) {
91 static_assert(
92 numQueues == numLifts, "Number of queues must be equal to number of lifts");
93 static_assert(
94 numQueues > minNumPeople, "Number of queues must be greater than minNumPeople");
95 assert(_lift != nullptr);
96 }
unsigned int id
Definition lift.cpp:83
const Lift * lift
Definition lift.cpp:87
unsigned int numPeople
Definition lift.cpp:84
#define numLifts
Definition lift.cpp:27
@ minNumPeople
Definition lift.cpp:19
#define numQueues
Definition lift.cpp:26

References id, lift, minNumPeople, numLifts, numPeople, and numQueues.

Referenced by operator<(), and operator<<.

Here is the caller graph for this function:

Member Function Documentation

◆ operator<()

auto Queue::operator< ( const Queue & queue) const -> bool
inline

Definition at line 108 of file lift.cpp.

108 {
109 return this->waitingTime < queue.waitingTime;
110 }
unsigned int waitingTime
Definition lift.cpp:105

References Queue().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

auto operator<< ( std::ostream & os,
const Queue & queue ) -> std::ostream &
friend

Definition at line 99 of file lift.cpp.

99 {
100 os << queue.id << " " << queue.numPeople << " " << *queue.lift;
101 return os;
102 }

References Queue().

Member Data Documentation

◆ id

unsigned int Queue::id

Definition at line 83 of file lift.cpp.

Referenced by Queue(), and simulateTwoQueues().

◆ lift

const Lift* Queue::lift

Definition at line 87 of file lift.cpp.

Referenced by Queue().

◆ numPeople

unsigned int Queue::numPeople

Definition at line 84 of file lift.cpp.

Referenced by Queue().

◆ waitingTime

unsigned int Queue::waitingTime = 0

Definition at line 105 of file lift.cpp.


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