PongUIO/AndroidWars — Issue #4: ExtS::DefaultData improvements
Author: Thekian
Created: 2012-02-19 17:11:08+00:00
State: open
Labels: extsim

ExtS::DefaultData is currently only a light wrapper around Sim::DataCtr, but this is lacking considering it is intended as a template for ExtSim data types to abstract away many shared behaviours.

Primarily, DefaultData should implement a generic loadBlock() and postProcess() that automatically creates and calls the same functions for its contained data. For example: ProgramData::loadBlock() would call ExtProgram::loadBlock(). It should also take care of cases where a name is not defined (no type is created, placeholder for future warning messages), and cases where a type is already registered (the old object should call loadBlock() again on the new data).

There should be optional support for a ExtS::TypeRuleMgr, possibly added depending on a bool parameter for the template.

When it comes to TypeRuleMgr support where loadBlock() is called on a type that is already registered, an issue may occur due to double TypeRule for an object. This is because the initial creation of an object checks for any matching rules, and should only create an object if a rule matches. In cases where a type is already registered, having a matching new rule is optional. If a new rule matches, the old one is completely discarded, if no rule is defined or a mismatching rule the old one is still used (but in the case where rules mismatch, loading parameters and constraints for the rule should be ignored and an error message raised [placeholder error]).

A Sim::NameIdMgr should be provided and there should be access functions for this, similar to Sim::DataBehaviourT.

Any types inheriting and depending on DefaultData must also be updated with the changes.

See: extsim/BaseData.h, and relevant files in extsim/datatype/*