|
TT Client Library 1.0.0
C++ library for Tandem Tales clients.
|
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>


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. | |
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.
| tt::Stop::Stop | ( | Role | role | ) |
Constructs a stop message for the role who stopped the session before it reached a pre-defined ending.
| role | the role who stopped the story |
| 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.
| message | a string explaining why the session ended |
| const Ending * tt::Stop::getEnding | ( | ) | const |
Returns the ending object sent in this message, or nullptr if there isn't one.
|
overridevirtual |
Returns a string representation of this object.
Reimplemented from tt::Message.
|
inlineoverridevirtual |
Type used for JSON deserialization.
Implements tt::Message.