refactored createObject
The application-provided function now simply has to check that "type" is in range and then create the object from the object definition parameters.
The stream provided by the object definition is limited to the length provided in the object descriptor, so that it's not possible for code to read past the end. This makes it easier to write objects
that take variable-length data (e.g. an unknown number of id_chains.)