TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
World.h
1#include <string>
2#include <vector>
3#include <tt/world/Entity.h>
4#include <tt/world/Variable.h>
5#include <tt/world/Action.h>
6#include <tt/world/Ending.h>
7
8#pragma once
9
10#ifndef WORLD_H
11#define WORLD_H
12
13namespace tt {
20 class World {
21 public:
23 std::string name;
25 std::string title;
27 std::string description;
28
29 // default constructor for JSON deserialization
30 World() {};
31
37 std::string toString() const;
38
45 const std::vector<const Entity *>& getEntities() const;
46
53 const std::vector<const Variable *>& getVariables() const;
54
61 const std::vector<const Action *>& getActions() const;
62
69 const std::vector<const Ending *>& getEndings() const;
70
71 friend std::ostream& operator<<(std::ostream& os, const World& a);
72 friend void from_json(const nlohmann::json& j, World& obj);
73 friend void to_json(nlohmann::json& j, const World& obj);
74
75 private:
77 std::vector<std::unique_ptr<Entity>> entities;
79 std::vector<std::unique_ptr<Variable>> variables;
81 std::vector<std::unique_ptr<Action>> actions;
83 std::vector<std::unique_ptr<Ending>> endings;
84
85 mutable std::vector<const Entity *> entitiesPtrs;
86 mutable std::vector<const Variable *> variablesPtrs;
87 mutable std::vector<const Action *> actionsPtrs;
88 mutable std::vector<const Ending *> endingsPtrs;
89 };
90
91 void from_json(const nlohmann::json& j, World& obj);
92 void to_json(nlohmann::json& j, const World& obj);
93
101 std::ostream& operator<<(std::ostream& os, const World& a);
102}
103
104#endif
A story world is a collection of assets needed for two partners in a session to tell a collaborative ...
Definition World.h:20
std::string toString() const
Returns a string representation of this object.
Definition World.cpp:7
const std::vector< const Action * > & getActions() const
Returns an unmodifiable list of all actions defined in this story world ordered by the ID numbers.
Definition World.cpp:41
std::string description
The longer natural language description of the world.
Definition World.h:27
const std::vector< const Variable * > & getVariables() const
Returns an unmodifiable list of all variables defined in this story world ordered by the ID numbers.
Definition World.cpp:29
std::string title
The short natural language title of the world.
Definition World.h:25
std::string name
The unique name of this story world.
Definition World.h:23
friend std::ostream & operator<<(std::ostream &os, const World &a)
Override stream insertion operator to allow printing the World class.
const std::vector< const Entity * > & getEntities() const
Returns an unmodifiable list of all entities defined in this story world ordered by the ID numbers.
Definition World.cpp:17
const std::vector< const Ending * > & getEndings() const
Returns an unmodifiable list of all endings defined in this story world ordered by the ID numbers.
Definition World.cpp:53
Tandem Tales is a platform that enables short, paired storytelling exercises between two agents over ...
Definition Client.h:22
std::ostream & operator<<(std::ostream &os, const Client &a)
Override stream insertion operator to allow printing the Client class.
Definition Client.cpp:556