|
TT Client Library 1.0.0
C++ library for Tandem Tales clients.
|
A message is information sent to or from a server in JSON format. More...
#include <tt/io/Message.h>

Public Member Functions | |
| Message () | |
| Constructs a message. | |
| const Client * | getClient () const |
Returns the tt::Client who sent this message, or null if this message was sent by the server. | |
| void | setClient (const Client *client) |
Sets the tt::Client who sent this message. | |
| virtual std::string | type () const =0 |
| Type used for JSON deserialization. | |
| virtual std::string | toString () const |
| Returns a string representation of this object. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Message &a) |
| Override stream insertion operator to allow printing the Message class. | |
A message is information sent to or from a server in JSON format.
Each message type has a to/from JSON function associated with it from the Nlohmann JSON Library.
| const Client * Message::getClient | ( | ) | const |
Returns the tt::Client who sent this message, or null if this message was sent by the server.
| void Message::setClient | ( | const Client * | client | ) |
Sets the tt::Client who sent this message.
For messages sent to the server, this method should be called soon after the message has been parsed.
| client | the agent who sent this message |
|
virtual |
Returns a string representation of this object.
Reimplemented in tt::Choice, tt::Connect, tt::End, tt::Error, tt::Join, tt::Report, tt::Start, tt::Stop, and tt::Update.
|
pure virtual |
Type used for JSON deserialization.
Implemented in tt::Choice, tt::Connect, tt::End, tt::Error, tt::Join, tt::Report, tt::Start, tt::Stop, and tt::Update.
|
friend |
Override stream insertion operator to allow printing the Message class.
| os | an output stream to insert into |
| a | a reference to a message object |