TODO Explain the NUClear network mesh


Serialisation is used to convert data to a type that can be written to files or sent over a network connection and be usable by the receiving device. See Wikipedia for further information.

NUClear provides helper functions for dealing with serialisation, from the namespace NUClear::util::serialise there are Searialise<T>::serialise, Searialise<T>::deserialise and Searialise<T>::hash for serialisation, deserialisation and hashing the type’s name respectively. The functions are used internally by NUClear to try to serialise/deserialise data sent/received via Network or UDP. These functions are only defined for specific types.

Trivial Data Types

NUClear defines serialisation for Trivial Types with some caveats. The serialisation of trivial data is dependant on both the endianness and the alignment of the data on the computer running the code.

NUClear also defines serialisation of iterators of trivial data types.

Google Protobuf Types

NUClear wraps the serialisation and deserialisation of google protobuf types. Use protobuf over trivial data types when communicating between machines or programs.

Custom Types

To add another type to be able to be serialised add another partial specialisation to Serialise<T, Check> declaring the type of Check. The easiest Check is is_same as this checks explicitly for an explicit type. Be careful about multiple declarations.

For this partial specialisation three static methods need to be defined.