Class netWorth::ServerManager
ClassList > netWorth > ServerManager
#include <ServerManager.hpp>
Public Attributes
Type | Name |
---|---|
unsigned short | m_max_client_port = = 55000 Port for initial client connection. |
Public Static Attributes
Type | Name |
---|---|
const constexpr unsigned short | m_init_connection_port = = 55000 Boolean that states if there are interfaces present on the server. |
Public Functions
Type | Name |
---|---|
ServerManager () = default Port that is incremented for client thread handoff. |
|
sf::Packet | actionMapToPacket () |
void | addToInterfaceSet (size_t agent_id) |
void | addToUpdatePairs (sf::IpAddress ip, unsigned short port) |
std::string | getSerializedAgents () |
bool | hasAgentsPresent () const |
void | increasePort () |
void | removeFromActionMap (size_t key) |
void | removeFromUpdatePairs (sf::IpAddress ip, unsigned short port) |
void | removeInterface (size_t id) |
void | sendGameUpdates () |
void | setNewAgent (bool hasNewAgent) |
void | setSerializedAgents (std::string & serializedAgents) |
void | writeToActionMap (size_t key, size_t val) |
Detailed Description
The server that will be running and that allows clients to connect to
Public Attributes Documentation
variable m_max_client_port
unsigned short m_max_client_port;
Public Static Attributes Documentation
variable m_init_connection_port
const constexpr unsigned short m_init_connection_port;
Public Functions Documentation
function ServerManager
Port that is incremented for client thread handoff.
netWorth::ServerManager::ServerManager () = default
Default constructor (AgentBase)
Parameters:
id
agent IDname
agent name
function actionMapToPacket
inline sf::Packet netWorth::ServerManager::actionMapToPacket ()
Convert action map to packet to send to client
Returns:
packet containing action map as series of integers
function addToInterfaceSet
inline void netWorth::ServerManager::addToInterfaceSet (
size_t agent_id
)
Adds and interface to the interface set
Parameters:
agent_id
function addToUpdatePairs
inline void netWorth::ServerManager::addToUpdatePairs (
sf::IpAddress ip,
unsigned short port
)
Adds an IP and port to a vector for group update
Parameters:
ip
IP address of client receiving updatesport
port of client receiving updates
function getSerializedAgents
inline std::string netWorth::ServerManager::getSerializedAgents ()
Returns the current serialized agents
Returns:
a string of the current serialized agents
function hasAgentsPresent
inline bool netWorth::ServerManager::hasAgentsPresent () const
Returns if there are agents present on the server as a boolean
Returns:
boolean representing if there are agents present on the server
function increasePort
inline void netWorth::ServerManager::increasePort ()
Increases the max client port
function removeFromActionMap
inline void netWorth::ServerManager::removeFromActionMap (
size_t key
)
Removes an interface from action map by key
Parameters:
key
function removeFromUpdatePairs
inline void netWorth::ServerManager::removeFromUpdatePairs (
sf::IpAddress ip,
unsigned short port
)
Removes ip and port from the update vector
Parameters:
ip
ip to removeport
port to remove
function removeInterface
inline void netWorth::ServerManager::removeInterface (
size_t id
)
Removes an interface by ID
Parameters:
id
function sendGameUpdates
inline void netWorth::ServerManager::sendGameUpdates ()
Sends game updates to all clients when a new agent joins
function setNewAgent
inline void netWorth::ServerManager::setNewAgent (
bool hasNewAgent
)
Sets a boolean stating if the server has received a new agent
Parameters:
hasNewAgent
boolean stating that a new agent has joined
function setSerializedAgents
inline void netWorth::ServerManager::setSerializedAgents (
std::string & serializedAgents
)
Sets the current serialized agents of the server
Parameters:
serializedAgents
string reference representing the serialized agents
function writeToActionMap
inline void netWorth::ServerManager::writeToActionMap (
size_t key,
size_t val
)
Writes to the action map
Parameters:
key
to referenceval
to write
The documentation for this class was generated from the following file source/Interfaces/NetWorth/server/ServerManager.hpp