Skip to content

Instantly share code, notes, and snippets.

@JohnMurray
Last active July 26, 2020 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnMurray/0742c1e0c994764e1610b0b829c08702 to your computer and use it in GitHub Desktop.
Save JohnMurray/0742c1e0c994764e1610b0b829c08702 to your computer and use it in GitHub Desktop.
void network_receive(MessageWrapper const& wrapper) {
if (wrapper.type_id == get_message_type_id<std::string>()) {
this->receive(*dynamic_cast<std::string *>(wrapper.value));
}
else if (wrapper.type_id == get_message_type_id<SerializableHello>()) {
this->receive(*dynamic_cast<SerializableHello *>(wrapper.value));
}
else {
// unknown
this->send_dead_letters(wrapper);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment