Cade Royal CSCE 412 Project 3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Queue Class Reference

A class that represents a queue of Request objects. More...

#include <Queue.h>

Public Member Functions

 Queue ()
 Constructor to initialize an empty Queue.
 
 ~Queue ()
 Destructor to clean up resources used by the Queue.
 
 Queue (const Queue &other)
 Copy constructor to create a copy of a Queue.
 
Queueoperator= (const Queue &other)
 Copy assignment operator to assign a Queue.
 
 Queue (Queue &&other) noexcept=default
 Move constructor to transfer ownership of a Queue.
 
Queueoperator= (Queue &&other) noexcept=default
 Move assignment operator to transfer ownership of a Queue.
 
void enqueue (const Request &request)
 Enqueue a Request into the queue.
 
Requestdequeue ()
 Dequeue a Request from the queue.
 
bool isEmpty () const
 Check if the queue is empty.
 
size_t size () const
 Get the size of the queue.
 

Detailed Description

A class that represents a queue of Request objects.

The Queue class provides methods to manage a collection of Request objects, ensuring First-In-First-Out (FIFO) ordering. It allows adding (enqueueing) and removing (dequeuing) requests, and offers utility functions to check if the queue is empty and to get its size.

Constructor & Destructor Documentation

◆ Queue() [1/3]

Queue::Queue ( )

Constructor to initialize an empty Queue.

Constructs a Queue object.

Initializes an empty Queue object to hold Request objects.

◆ ~Queue()

Queue::~Queue ( )

Destructor to clean up resources used by the Queue.

Destructor for the Queue object.

Ensures proper cleanup of resources when a Queue object is destroyed.

◆ Queue() [2/3]

Queue::Queue ( const Queue other)

Copy constructor to create a copy of a Queue.

Copy constructor for Queue.

Parameters
otherThe Queue object to copy.

This constructor creates a new Queue object as a copy of another Queue object.

Parameters
otherThe Queue object to copy.

◆ Queue() [3/3]

Queue::Queue ( Queue &&  other)
defaultnoexcept

Move constructor to transfer ownership of a Queue.

Parameters
otherThe Queue object to move.

Member Function Documentation

◆ dequeue()

Request * Queue::dequeue ( )

Dequeue a Request from the queue.

Removes and returns the front Request object from the queue.

This method removes and returns a pointer to the Request at the front of the queue. If the queue is empty, it returns nullptr.

Returns
A pointer to the dequeued Request object, or nullptr if the queue is empty.

This function removes the front Request from the queue and returns a pointer to the dequeued Request. If the queue is empty, it returns nullptr.

Returns
A pointer to the dequeued Request object, or nullptr if the queue is empty.

◆ enqueue()

void Queue::enqueue ( const Request request)

Enqueue a Request into the queue.

Adds a Request object to the queue.

This method adds a Request object to the back of the queue.

Parameters
requestThe Request object to be added to the queue.

This function pushes a Request object into the queue.

Parameters
requestThe Request object to enqueue.

◆ isEmpty()

bool Queue::isEmpty ( ) const

Check if the queue is empty.

Checks if the queue is empty.

Returns
True if the queue is empty, false otherwise.
True if the queue is empty, false otherwise.

◆ operator=() [1/2]

Queue & Queue::operator= ( const Queue other)

Copy assignment operator to assign a Queue.

Copy assignment operator for Queue.

Parameters
otherThe Queue object to assign.
Returns
A reference to the assigned Queue object.

Assigns the contents of another Queue object to this Queue object.

Parameters
otherThe Queue object to copy.
Returns
A reference to this Queue object.

◆ operator=() [2/2]

Queue & Queue::operator= ( Queue &&  other)
defaultnoexcept

Move assignment operator to transfer ownership of a Queue.

Parameters
otherThe Queue object to move.
Returns
A reference to the moved Queue object.

◆ size()

size_t Queue::size ( ) const

Get the size of the queue.

Returns the number of Request objects in the queue.

Returns
The number of Request objects in the queue.
The size of the queue.

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