Skip to content

Instantly share code, notes, and snippets.

@aozturk
Last active January 3, 2016 05:39
Show Gist options
  • Save aozturk/8417754 to your computer and use it in GitHub Desktop.
Save aozturk/8417754 to your computer and use it in GitHub Desktop.
class TestMsg : public AMS::IMsgObj {
public:
// give unique id to each message
TestMsg() : IMsgObj(/*msg id*/1) {}
// primitive types and string can be used
std::string name;
double value;
// other class objects can be composed
AdditionalInfo info;
// standard vector and map containers can be used
std::vector<int> members;
std::map<int, int> mappings;
// allows serialization of selected members only
MSGPACK_DEFINE(name, value, info, members, mappings);
};
class AdditionalInfo {
public:
std::string address;
double offset;
MSGPACK_DEFINE(address);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment