TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
Assignment.h
1#pragma once
2
3#include <string>
4#include <tt/world/Variable.h>
5#include <tt/world/Signature.h>
6
7#ifndef ASSIGNMENT_H
8#define ASSIGNMENT_H
9
10namespace tt {
18 class Assignment {
19 public:
26 bool visible;
27
28 Assignment(): variable(nullptr), value(nullptr), visible(false) {};
29
35 std::string toString() const;
36
42 const std::string& getDescription() const;
43
52 const std::string& getCode() const;
53
59 const Variable* getVariable() const;
60
66 const Value* getValue() const;
67
68 bool operator==(const Assignment& rhs) const;
69
70 friend void from_json(const nlohmann::json& j, Assignment& obj);
71 friend void to_json(nlohmann::json& j, const Assignment& obj);
72 friend std::ostream& operator<<(std::ostream& os, const Assignment& a);
73
74 private:
76 std::string description;
78 std::string code;
80 std::unique_ptr<Variable> variable;
82 std::unique_ptr<Value> value;
83 };
84
85 void from_json(const nlohmann::json& j, Assignment& obj);
86 void to_json(nlohmann::json& j, const Assignment& obj);
87
95 std::ostream& operator<<(std::ostream& os, const Assignment& a);
96}
97
98#endif
An assignment is a logical formula that asserts that some variable in a story world has a value.
Definition Assignment.h:18
std::string toString() const
Returns a string representation of this object.
Definition Assignment.cpp:8
const Value * getValue() const
Returns the value the variable is assigned.
Definition Assignment.cpp:28
const Variable * getVariable() const
Returns the variable being assigned a value.
Definition Assignment.cpp:23
const std::string & getDescription() const
Returns a human-readable natural language description of the object.
Definition Assignment.cpp:13
const std::string & getCode() const
Returns a string of 1's and 0's that uniquely represents this object among other objects of the same ...
Definition Assignment.cpp:18
bool visible
Whether or not this assignment can currently be observed.
Definition Assignment.h:26
friend std::ostream & operator<<(std::ostream &os, const Assignment &a)
Override stream insertion operator to allow printing the Assignment class.
A value is a logical expression which evaluates to itself.
Definition Value.h:17
A variable is an asset that represents a feature of the story world state that can change.
Definition Variable.h:19
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