Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem Description In this project, you have to manage a list of computer servers, where each server hosts multiple users. The server data is stored
Problem Description In this project, you have to manage a list of computer servers, where each server hosts multiple users. The server data is stored as an associative data structure type called ServerData whiclh is an STL map>. Thus, the keys of this map are strings that represent server names, and the values associated with each server name is an STL set of strings that are the names of users on that server. You will have to write functions that add a user to a server, disconnect a user from a server, balance the server load, etc. Program Specifications You are provided with a proj07 functions.h that contains the signatures of all the functions you must implement. You must implement those functions and turn in your results as proj07/proj07_functions.cpp to Mimir. You are also provided with proj07_main.cpp that does some minimal testing of these functions. Of course, the real test cases are on Mimir as always Functions bool AddConnection (ServerData &sd, ServerName sn, UserName un) This function tries to connect the user un to the server sn. If the server exists, it adds un to that server. If the server does not exist, it is created (added to sd) and the user un is added to that server. Both of those conditions return true If the user un is already connected to the server sn, then no action is taken, and the function returns false. bool DeleteConnection (ServerData &sd, ServerName sn, UserName un) This function tries to disconnect the user un from the server sn, and returns true if d is successfully updated with that information. If the user un is not connected to the server sn, then no action is taken, and the function returns false. ServerData ParseServerData (const std::string &fname) fname is the name of a file that contains an arbitrary number of lines of text where each line consists of three strings, each space separated. Each line is either of two forms user name join server name e user name Leave server name Problem Description In this project, you have to manage a list of computer servers, where each server hosts multiple users. The server data is stored as an associative data structure type called ServerData whiclh is an STL map>. Thus, the keys of this map are strings that represent server names, and the values associated with each server name is an STL set of strings that are the names of users on that server. You will have to write functions that add a user to a server, disconnect a user from a server, balance the server load, etc. Program Specifications You are provided with a proj07 functions.h that contains the signatures of all the functions you must implement. You must implement those functions and turn in your results as proj07/proj07_functions.cpp to Mimir. You are also provided with proj07_main.cpp that does some minimal testing of these functions. Of course, the real test cases are on Mimir as always Functions bool AddConnection (ServerData &sd, ServerName sn, UserName un) This function tries to connect the user un to the server sn. If the server exists, it adds un to that server. If the server does not exist, it is created (added to sd) and the user un is added to that server. Both of those conditions return true If the user un is already connected to the server sn, then no action is taken, and the function returns false. bool DeleteConnection (ServerData &sd, ServerName sn, UserName un) This function tries to disconnect the user un from the server sn, and returns true if d is successfully updated with that information. If the user un is not connected to the server sn, then no action is taken, and the function returns false. ServerData ParseServerData (const std::string &fname) fname is the name of a file that contains an arbitrary number of lines of text where each line consists of three strings, each space separated. Each line is either of two forms user name join server name e user name Leave server name
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started