Cade Royal CSCE 412 Project 3
Loading...
Searching...
No Matches
Request.h
Go to the documentation of this file.
1
10#ifndef REQUEST_H
11#define REQUEST_H
12
13#include <string>
14#include <memory>
15#include <mutex>
16
25class Request {
26public:
35 Request(const std::string& ip, const std::string& randomStr, int randomInt, std::mutex& coutMutex);
36
40 ~Request();
41
47 Request(const Request& other);
48
55 Request& operator=(const Request& other);
56
62 Request(Request&& other) noexcept = default;
63
70 Request& operator=(Request&& other) noexcept = default;
71
77 void send() const;
78
84 void printDetails() const;
85
91 int getSeconds();
92
98 friend class Queue;
99
100private:
101 std::string ipAddress_;
102 std::string randomString_;
103 int randomInteger_;
104 std::mutex& coutMutex_;
106};
107
108#endif // REQUEST_H
A class that represents a queue of Request objects.
Definition Queue.h:24
A class to represent a network request.
Definition Request.h:25
Request & operator=(Request &&other) noexcept=default
Move assignment operator to transfer ownership of a Request object.
void send() const
Simulate sending the request.
Definition Request.cpp:87
~Request()
Destructor to clean up resources.
Definition Request.cpp:41
int getSeconds()
Get the processing time for the request in seconds.
Definition Request.cpp:115
Request(Request &&other) noexcept=default
Move constructor to transfer ownership of a Request object.
Request & operator=(const Request &other)
Copy assignment operator to assign a Request object.
Definition Request.cpp:68
void printDetails() const
Print the details of the request to the console.
Definition Request.cpp:102
std::mutex coutMutex_
Definition main.cpp:17