NASA-Tensegrity-Robotics-Toolkit/NTRTsim — pull request #40 by PerryBhandal (2014-08-26 20:08:04+00:00)
Title: Serialization

This pull implements serialization.

See examples/3_prism_serialize for a basic demonstration of instantiating a structure from a flat file, rather than based on attributes in a config struct. You'll also want to give the CMakeLists.txt for 3_prism_serialize a look, as it shows how you can copy non-source files into your build dir.

As we see common use cases, we'll begin adding helper classes to ease their extraction. For example, we'll create a helper class for extracting rods from a json file. We'll call RodSerializer.getRods("rods.json") and it returns a vector of rod objects based on the data in rods.json. That seems to strike a nice balance between ease-of-use and control. For the common cases we'll create and use helpers, but for unique cases you can still drop down right to jsoncpp and interact directly with the json document.