1#ifndef NETWORK_MESSAGE_HPP
2#define NETWORK_MESSAGE_HPP
5#include <nlohmann/json.hpp>
12enum class NetworkMessageType : uint8_t {
26 GET_RECEIVED_MESSAGES,
58 [[nodiscard]]
auto getType() const -> NetworkMessageType;
64 [[nodiscard]] auto
toJson() const -> nlohmann::json;
70 [[nodiscard]] auto
toString() const -> std::
string;
76 [[nodiscard]] auto
toZmqMessage() const -> std::unique_ptr<zmq::message_t>;
112 [[nodiscard]] auto
getTag() const -> std::
string;
124 [[nodiscard]] auto
getFrom() const -> std::
string;
136 [[nodiscard]] auto
getTo() const -> std::
string;
160 [[nodiscard]] auto
getVector() const -> std::vector<std::
string>;
163 NetworkMessageType type_;
164 nlohmann::json content_;
Class representing a message with a type and content.
Definition network_message.hpp:35
NetworkMessage(const NetworkMessageType &type)
Constructs a NetworkMessage with a specified type.
auto getFrom() const -> std::string
Gets the sender of the message.
auto getMessage() const -> std::string
Gets the message content.
void setUsername(const std::string &username)
Sets the username associated with the message.
auto getTo() const -> std::string
Gets the recipient of the message.
auto toString() const -> std::string
Converts the message to a string.
void setMessage(const std::string &message)
Sets the message content.
auto getUsername() const -> std::string
Gets the username associated with the message.
void setTag(const std::string &tag)
Sets the tag associated with the message.
void setFrom(const std::string &from)
Sets the sender of the message.
auto getType() const -> NetworkMessageType
Gets the type of the message.
auto getPassword() const -> std::string
Gets the password associated with the message.
auto toJson() const -> nlohmann::json
Converts the message to a JSON object.
void setVector(const std::vector< std::string > &vector)
Sets a vector of strings associated with the message.
auto toZmqMessage() const -> std::unique_ptr< zmq::message_t >
Converts the message to a ZMQ message.
auto getVector() const -> std::vector< std::string >
Gets the vector of strings associated with the message.
NetworkMessage(const std::string &str)
Constructs a NetworkMessage from a string.
void setTo(const std::string &to)
Sets the recipient of the message.
void setPassword(const std::string &password)
Sets the password associated with the message.
auto getTag() const -> std::string
Gets the tag associated with the message.
~NetworkMessage()
Destructor for the NetworkMessage class.