TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
tt::Join Class Reference

The join message is the first message sent from a client to the server to provide the agent's credentials and its preferences for what story world, role, and partner they want for their session. More...

#include <tt/io/Join.h>

Inheritance diagram for tt::Join:
Collaboration diagram for tt::Join:

Public Member Functions

 Join (std::string name, std::string password, std::string world, Role role, std::string partner)
 Constructs a new join message with an agent's credentials and preferences.
std::string toString () const override
 Returns a string representation of this object.
bool matches (Join other)
 Returns true if this join request is compatible with another, meaning a session could be created between the agents who sent the messages.
std::string type () const override
 Type used for JSON deserialization.
Public Member Functions inherited from tt::Message
 Message ()
 Constructs a message.
const Client * getClient () const
 Returns the tt::Client who sent this message, or null if this message was sent by the server.
void setClient (const Client *client)
 Sets the tt::Client who sent this message.

Public Attributes

std::string name
 The new agent's name.
std::string password
 The new agent's password, which must be provided if the agent is using a name that is reserved on this server, or which should be empty if the agent is not using a reserved name.
std::string world
 The name of the story world this new agent wants to play in, or empty if they are willing to play in any story world.
Role role
 The role this new agent wants to have in their session, or empty if they are willing to play either role.
std::string partner
 The name of the partner this new agent wants to play with, or empty if they are willing to play with any partner.

Detailed Description

The join message is the first message sent from a client to the server to provide the agent's credentials and its preferences for what story world, role, and partner they want for their session.

Author
Gage Birchmeier

Constructor & Destructor Documentation

◆ Join()

Join::Join ( std::string name,
std::string password,
std::string world,
Role role,
std::string partner )

Constructs a new join message with an agent's credentials and preferences.

Parameters
namethe new agent's name
passwordthe new agent's password, or empty if they are not using a reserved name
worldthe world the new agent wants to play in, or empty if they have no preference
rolethe role the new agent wants to have, or empty if they have no preference
partnerthe name of the partner this new agent wants to play with, or empty if they have no preference

Member Function Documentation

◆ matches()

bool Join::matches ( Join other)

Returns true if this join request is compatible with another, meaning a session could be created between the agents who sent the messages.

This method will not match two requests which both specify no preference for a partner. In other words, at least one of the requests must specify a partner.

Parameters
otherthe join message of another agent waiting for a session
Returns
true if the join messages are compatible, or false if they are not compatible

◆ toString()

std::string Join::toString ( ) const
overridevirtual

Returns a string representation of this object.

Returns
a string describing this object

Reimplemented from tt::Message.

◆ type()

std::string tt::Join::type ( ) const
inlineoverridevirtual

Type used for JSON deserialization.

Implements tt::Message.


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