Variadic template class that encodes / decodes its data to and from Packets.
#include <nrg_message.h>
Public Member Functions | |
Message (Args...args) | |
Standard Constructor for a Message to be sent over the network. | |
Message (Message &&)=default | |
Move Constructor. | |
Message (const Message &)=default | |
Copy Constructor. | |
template<class F > | |
Message (F &&func) | |
Internally used Constructor for a Message that will run a callback function. | |
template<size_t n> | |
const std::tuple_element< n, MsgTuple >::type & | get () const |
Returns the element of the Message specified by the template parameter n . | |
template<size_t n> | |
void | set (const typename tuple_element< n, MsgTuple >::type &val) |
Sets the element of the Message specified by the template parameter n to val . | |
uint16_t | getID () const |
Returns the user-defined Message ID. | |
void | onReceive (uint32_t creation_ms) |
Function called when the message has been received. | |
MessageBase * | clone () const |
Returns a copy of the derived class of this MessageBase. | |
MessageBase * | move_clone () |
Moves the derived class into the returned MessageBase. | |
size_t | writeToPacket (Packet &p) const |
Writes this Message to the Packet p . | |
size_t | readFromPacket (Packet &p) |
Reads this Message from the Packet p . | |
Public Member Functions inherited from nrg::MessageBase | |
virtual | ~MessageBase () |
Standard Destructor. | |