A class that represents a client connected to the server.
More...
#include <ServerClient.hpp>
|
| | Client (int socket_fd, struct sockaddr_in client_addr, double start_y_pos) |
| | Constructor for Client class.
|
| |
|
| ~Client () |
| | Destructor for Client class.
|
| |
| | Client (const Client &) |
| | Copy constructor for Client class.
|
| |
| Client & | operator= (const Client &) |
| | Assignment operator for Client class.
|
| |
| const std::string & | getNextCommand () const |
| | Gets the next command to be executed.
|
| |
| void | setNextCommand (const std::string &nextCommand) |
| | Sets the next command to be executed.
|
| |
| const int & | getSocketFd () const |
| | Gets the socket file descriptor.
|
| |
| const struct sockaddr_in & | getClientAddr () const |
| | Gets the client address.
|
| |
| const std::string & | getPseudo () const |
| | Gets the pseudo of the client.
|
| |
| void | setPseudo (const std::string &pseudo) |
| | Sets the pseudo of the client.
|
| |
| const std::array< double, 2 > & | getPosition () const |
| | Gets the position of the client.
|
| |
| void | setPosition (const std::array< double, 2 > &position) |
| | Sets the position of the client.
|
| |
| const std::size_t & | getScore () const |
| | Gets the score of the client.
|
| |
| void | setScore (std::size_t score) |
| | Sets the score of the client.
|
| |
| const bool & | isAlive () const |
| | Gets the alive status of the client.
|
| |
| void | setAlive (bool alive) |
| | Sets the alive status of the client.
|
| |
| const bool & | useJetpack () const |
| | Gets the jetpack status of the client.
|
| |
| void | setJetpack (bool jetpack) |
| | Sets the jetpack status of the client.
|
| |
| const double & | getSpeed () const |
| | Gets the speed of the client.
|
| |
| void | setSpeed (double speed) |
| | Sets the speed of the client.
|
| |
| std::vector< std::array< std::size_t, 2 > > & | getCoinsList () |
| | Gets the list of coins collected by the client.
|
| |
|
|
std::string | _next_command |
| |
|
const int | _socket_fd |
| |
|
const struct sockaddr_in | _client_addr |
| |
|
std::string | _pseudo |
| |
|
std::array< double, 2 > | _position = {0.0, 0.0} |
| |
|
std::size_t | _score = 0 |
| |
|
bool | _alive = true |
| |
|
bool | _jetpack = false |
| |
|
double | _speed = 0.0 |
| |
|
std::vector< std::array< std::size_t, 2 > > | _coins_list |
| |
A class that represents a client connected to the server.
◆ Client() [1/2]
| Client |
( |
int | socket_fd, |
|
|
struct sockaddr_in | client_addr, |
|
|
double | start_y_pos ) |
Constructor for Client class.
- Parameters
-
| socket_fd | The socket file descriptor of the client |
| client_addr | The address of the client |
| start_y_pos | The starting y position of the client |
◆ Client() [2/2]
Copy constructor for Client class.
- Parameters
-
| client | The Client object to copy from |
◆ getClientAddr()
| const struct sockaddr_in & getClientAddr |
( |
| ) |
const |
Gets the client address.
- Returns
- The client address
◆ getCoinsList()
| std::vector< std::array< std::size_t, 2 > > & getCoinsList |
( |
| ) |
|
Gets the list of coins collected by the client.
- Returns
- The list of coins collected by the client
◆ getNextCommand()
| const std::string & getNextCommand |
( |
| ) |
const |
Gets the next command to be executed.
- Returns
- The next command to be executed
◆ getPosition()
| const std::array< double, 2 > & getPosition |
( |
| ) |
const |
Gets the position of the client.
- Returns
- The position of the client
◆ getPseudo()
| const std::string & getPseudo |
( |
| ) |
const |
Gets the pseudo of the client.
- Returns
- The pseudo of the client
◆ getScore()
| const std::size_t & getScore |
( |
| ) |
const |
Gets the score of the client.
- Returns
- The score of the client
◆ getSocketFd()
| const int & getSocketFd |
( |
| ) |
const |
Gets the socket file descriptor.
- Returns
- The socket file descriptor
◆ getSpeed()
| const double & getSpeed |
( |
| ) |
const |
Gets the speed of the client.
- Returns
- The speed of the client
◆ isAlive()
| const bool & isAlive |
( |
| ) |
const |
Gets the alive status of the client.
- Returns
- The alive status of the client
◆ operator=()
Assignment operator for Client class.
- Parameters
-
| client | The Client object to assign from |
- Returns
- Reference to the current object
◆ setAlive()
| void setAlive |
( |
bool | alive | ) |
|
Sets the alive status of the client.
- Parameters
-
| alive | The alive status of the client |
◆ setJetpack()
| void setJetpack |
( |
bool | jetpack | ) |
|
Sets the jetpack status of the client.
- Parameters
-
| jetpack | The jetpack status of the client |
◆ setNextCommand()
| void setNextCommand |
( |
const std::string & | nextCommand | ) |
|
Sets the next command to be executed.
- Parameters
-
| nextCommand | The next command to be executed |
◆ setPosition()
| void setPosition |
( |
const std::array< double, 2 > & | position | ) |
|
Sets the position of the client.
- Parameters
-
| position | The position of the client |
◆ setPseudo()
| void setPseudo |
( |
const std::string & | pseudo | ) |
|
Sets the pseudo of the client.
- Parameters
-
| pseudo | The pseudo of the client |
◆ setScore()
| void setScore |
( |
std::size_t | score | ) |
|
Sets the score of the client.
- Parameters
-
| score | The score of the client |
◆ setSpeed()
| void setSpeed |
( |
double | speed | ) |
|
Sets the speed of the client.
- Parameters
-
| speed | The speed of the client |
◆ useJetpack()
| const bool & useJetpack |
( |
| ) |
const |
Gets the jetpack status of the client.
- Returns
- The jetpack status of the client
The documentation for this class was generated from the following files: