Created
February 12, 2015 00:16
-
-
Save cjameshuff/32bc668f4ad0aa1f263f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TEST_DEFS_H | |
#define TEST_DEFS_H | |
#include "flexproto.h" | |
using namespace flexproto; | |
struct Point { | |
int32_t x; | |
int32_t y; | |
}; | |
inline auto encode_other(uint8_t *& data, const Point & value) -> void | |
{ | |
encode(data, value.x); | |
encode(data, value.y); | |
} | |
inline auto decode_other(const uint8_t *& data, Point & value) -> void | |
{ | |
value.x = decode<int32_t>(data); | |
value.y = decode<int32_t>(data); | |
} | |
struct Thing { | |
std::string name; | |
std::vector<uint8_t> data; | |
Point location; | |
}; | |
inline auto encode_other(uint8_t *& data, const Thing & value) -> void | |
{ | |
encode_other(data, value.name); | |
encode_other(data, value.data); | |
encode_other(data, value.location); | |
} | |
inline auto decode_other(const uint8_t *& data, Thing & value) -> void | |
{ | |
decode_other(data, value.name); | |
decode_other(data, value.data); | |
decode_other(data, value.location); | |
} | |
#endif // TEST_DEFS_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment