TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
Variable.h
1#include <string>
2#include <memory>
3#include <tt/world/Signature.h>
4
5#pragma once
6
7#ifndef VARIABLE_H
8#define VARIABLE_H
9
10namespace tt {
19 class Variable {
20 public:
22 int id;
24 std::string name;
25
29 std::string encoding;
30
31 // default constructor for JSON
32 Variable(): id(0), signature(nullptr) {};
33
39 std::string toString() const;
40
46 const std::string& getDescription() const;
47
53 const Signature* getSignature() const;
54
55 bool operator==(const Variable& rhs) const;
56
57 friend void from_json(const nlohmann::json& j, Variable& obj);
58 friend void to_json(nlohmann::json& j, const Variable& obj);
59 friend std::ostream& operator<<(std::ostream& os, const Variable& a);
60
61 private:
63 std::unique_ptr<Signature> signature;
65 std::string description;
66 };
67
68 void from_json(const nlohmann::json& j, Variable& obj);
69 void to_json(nlohmann::json& j, const Variable& obj);
70
78 std::ostream& operator<<(std::ostream& os, const Variable& a);
79}
80
81#endif
A signature is a logical object that identifies a parameterized asset in a story world.
Definition Signature.h:22
A variable is an asset that represents a feature of the story world state that can change.
Definition Variable.h:19
int id
This asset's ID number, which is unique among other assets of the same type.
Definition Variable.h:22
const Signature * getSignature() const
Returns the signature of this object.
Definition Variable.cpp:16
const std::string & getDescription() const
Returns a human-readable natural language description of the object.
Definition Variable.cpp:11
std::string encoding
The name of the encoding this variable uses to encode its values.
Definition Variable.h:29
friend std::ostream & operator<<(std::ostream &os, const Variable &a)
Override stream insertion operator to allow printing the Variable class.
std::string name
This asset's name, which is unique among other assets of the same type.
Definition Variable.h:24
std::string toString() const
Returns a string representation of this object.
Definition Variable.cpp:6
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