TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
Connect.h
1#pragma once
2
3#include <tt/io/Message.h>
4#include <tt/io/Entry.h>
5
6#ifndef CONNECT_H
7#define CONNECT_H
8
9namespace tt {
17 class Connect : public Message {
18 public:
25 class Available {
26 public:
28 std::string world;
30 std::string agent;
38 Available(std::string world, std::string agent):
40
41 // default constructor for json deserialization
42 Available() {}
43
49 std::string toString() const {
50 return "[Available: world=\"" + world + "\"; agent=\"" + agent + "\"]";
51 }
52 };
53
55 std::string version;
56
61 std::vector<Entry> worlds;
62
67 std::vector<Entry> agents;
68
74 std::vector<Available> available;
75
76 Connect() {}
77
78 std::string toString() const override;
79
80 std::string type() const override {
81 return "Connect";
82 }
83 };
84
85 void from_json(const nlohmann::json& j, Connect& msg);
86 void to_json(nlohmann::json& j, const Connect& msg);
87 void from_json(const nlohmann::json& j, Connect::Available& obj);
88 void to_json(nlohmann::json& j, const Connect::Available& obj);
89}
90
91#endif
std::string agent
The name of the agent waiting for a match.
Definition Connect.h:30
std::string world
The name of the story world the waiting agent wants to play in.
Definition Connect.h:28
Available(std::string world, std::string agent)
Constructs an available world/agent pair from a world name and agent name.
Definition Connect.h:38
std::string toString() const
Returns a string representation of this object.
Definition Connect.h:49
std::vector< Entry > agents
A list of entries giving the names and descriptions of the publicly listed agents available on this s...
Definition Connect.h:67
std::vector< Available > available
A list of available world/agent pairs that lets an agent know whether a specific combination of a sto...
Definition Connect.h:74
std::string type() const override
Type used for JSON deserialization.
Definition Connect.h:80
std::string version
The server's software version.
Definition Connect.h:55
std::vector< Entry > worlds
A list of entries giving the names and descriptions of the publicly listed worlds available on this s...
Definition Connect.h:61
std::string toString() const override
Returns a string representation of this object.
Definition Connect.cpp:6
Message()
Constructs a message.
Definition Message.h:32
Tandem Tales is a platform that enables short, paired storytelling exercises between two agents over ...
Definition Client.h:22