Saving and loading the states
We can reuse some of the save and load code we created in the previous chapters when saving and loading the current state of custom data types. The moveState and moveDirection enum class types will be stored as integer values in the YAML configuration file of the application. The three new struct types, IdleWalkRunBlending, ActionAnimation, and ModelSettings, are deconstructed into their elements when saving them to the configuration file and reassembled when reading the values. The C++ maps and sets are created by using the known combination of YAML sequences and YAML maps.
Storing the new data types
For the moveState and moveDirection structs, we create a new convert template in the YamlParserTypes.h file in the tools folder that will simply cast to int and back:
template<>
struct convert<moveState> {
static Node encode(const moveState& rhs) {
Node node;
node = static_cast<int>(rhs);
return...