TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
Stop.h
1#pragma once
2
3#include <tt/io/Message.h>
4#include <tt/world/Ending.h>
5#include <tt/Role.h>
6
7#ifndef STOP_H
8#define STOP_H
9
10namespace tt {
38 class Stop : public Message {
39 public:
46 std::string message;
47
54 Stop(Role role);
61 Stop(const std::string& message);
62
63 Stop();
64
65 std::string toString() const override;
66
73 const Ending *getEnding() const;
74
75 std::string type() const override {
76 return "Stop";
77 }
78
79 friend void from_json(const nlohmann::json& j, Stop& msg);
80 friend void to_json(nlohmann::json& j, const Stop& msg);
81
82 private:
88 std::unique_ptr<Ending> ending;
89 };
90
91 void from_json(const nlohmann::json& j, Stop& msg);
92 void to_json(nlohmann::json& j, const Stop& msg);
93}
94
95#endif
An ending is a signed asset that represents one of several possible ways a story can end.
Definition Ending.h:17
Message()
Constructs a message.
Definition Message.h:32
The stop message can be sent from either the server or the client to indicate that no more turns will...
Definition Stop.h:38
std::string type() const override
Type used for JSON deserialization.
Definition Stop.h:75
Stop(Role role)
Constructs a stop message for the role who stopped the session before it reached a pre-defined ending...
Definition Stop.cpp:7
Role role
The participant who ended the session, or null if the session reached a pre-defined ending or was end...
Definition Stop.h:44
const Ending * getEnding() const
Returns the ending object sent in this message, or nullptr if there isn't one.
Definition Stop.cpp:33
std::string toString() const override
Returns a string representation of this object.
Definition Stop.cpp:28
std::string message
A message explaining how the session ended.
Definition Stop.h:46
Tandem Tales is a platform that enables short, paired storytelling exercises between two agents over ...
Definition Client.h:22
Role
Represents the two roles in a collaborative storytelling session: the Player, who typically controls ...
Definition Role.h:16