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

The stop message can be sent from either the server or the client to indicate that no more turns will happen in the session (though reports may still happen) and that the session should end soon. More...

#include <tt/io/Stop.h>

Inheritance diagram for tt::Stop:
Collaboration diagram for tt::Stop:

Public Member Functions

 Stop (Role role)
 Constructs a stop message for the role who stopped the session before it reached a pre-defined ending.
 Stop (const std::string &message)
 Constructs a stop message with a string explaining how the session ended before it reached a pre-defined ending.
std::string toString () const override
 Returns a string representation of this object.
const Ending * getEnding () const
 Returns the ending object sent in this message, or nullptr if there isn't one.
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

Role role
 The participant who ended the session, or null if the session reached a pre-defined ending or was ended by the server.
std::string message
 A message explaining how the session ended.

Detailed Description

The stop message can be sent from either the server or the client to indicate that no more turns will happen in the session (though reports may still happen) and that the session should end soon.

An agent can send the stop message (1) if they want to stop a session early before the story had reached one of its defined endings, or (2) to indicate they are finished and have no more reports to send. After an agent sends the stop message, they may not send any more messages (including reports), though they may stay connected to wait for the end message.

The server will send the stop message to notify both agents that no more turns can be taken. This will happen when (1) the story reaches one of its defined endings, (2) one of the agents in the session stops it early, (3) one of the agents in the session disconnects, or (4) the server shuts down.

Once an agent receives the stop message, it cannot take any more turns, even if the story has not reached one of its defined endings. However, an agent may still send reports. When an agent is done sending reports, it should send a stop message to indicate this.

After both agents have either sent stop messages or disconnected, the end message will be sent to both agents.

Author
Gage Birchmeier

Constructor & Destructor Documentation

◆ Stop() [1/2]

tt::Stop::Stop ( Role role)

Constructs a stop message for the role who stopped the session before it reached a pre-defined ending.

Parameters
rolethe role who stopped the story

◆ Stop() [2/2]

tt::Stop::Stop ( const std::string & message)

Constructs a stop message with a string explaining how the session ended before it reached a pre-defined ending.

Parameters
messagea string explaining why the session ended

Member Function Documentation

◆ getEnding()

const Ending * tt::Stop::getEnding ( ) const

Returns the ending object sent in this message, or nullptr if there isn't one.

Returns
the ending included in this message

◆ toString()

std::string tt::Stop::toString ( ) const
overridevirtual

Returns a string representation of this object.

Returns
a string describing this object

Reimplemented from tt::Message.

◆ type()

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

Type used for JSON deserialization.

Implements tt::Message.


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