private int addRegistry(int parentID, YoVariableRegistry registry, List<YoVariable<?>> variableListToPack, YoVariableRegistry rootRegistry)
{
int myID = registryID;
if (myID > handshake.getRegistries().capacity())
{
throw new RuntimeException("The number of registries exceeds the maximum number of registries for the logger (" + handshake.getRegistries().capacity() + ")");
}
registryID++;
YoRegistryDefinition yoRegistryDescription = handshake.getRegistries().add();
yoRegistryDescription.setName(registry.getName());
yoRegistryDescription.setParent((short) parentID);
addVariables(myID, registry, variableListToPack, rootRegistry);
for (YoVariableRegistry child : registry.getChildren())
{
addRegistry(myID, child, variableListToPack, rootRegistry);
}
return myID;
}