CSCE 412 - Project 3 Load Balancer
Loading...
Searching...
No Matches
RequestQueue Class Reference

A class to represent a queue of requests. More...

#include <requestqueue.h>

Public Member Functions

void addRequest (const Request &r)
 Adds a request to the queue.
 
Request getRequest ()
 Retrieves and removes a request from the queue.
 
bool isEmpty () const
 Checks if the queue is empty.
 
size_t size () const
 Gets the current size of the queue.
 

Detailed Description

A class to represent a queue of requests.

The RequestQueue class manages a queue of Request objects, allowing requests to be added, retrieved, and checked for size and emptiness.

Member Function Documentation

◆ addRequest()

void RequestQueue::addRequest ( const Request & r)

Adds a request to the queue.

This method inserts the specified request into the queue for later processing.

Parameters
rThe request to be added to the queue.

◆ getRequest()

Request RequestQueue::getRequest ( )

Retrieves and removes a request from the queue.

This method returns the front request from the queue and removes it from the queue.

Returns
The request at the front of the queue.

This method returns the front request from the queue and removes it from the queue. If the queue is empty, it returns a default-constructed Request object.

Returns
The request at the front of the queue, or a default Request if the queue is empty.

◆ isEmpty()

bool RequestQueue::isEmpty ( ) const

Checks if the queue is empty.

This method determines whether the queue contains any requests.

Returns
True if the queue is empty, false otherwise.

◆ size()

size_t RequestQueue::size ( ) const

Gets the current size of the queue.

This method returns the number of requests currently in the queue.

Returns
The number of requests in the queue.

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