Tuesday, January 20, 2015

Table – Single Base Class

The Table and Table Entry classes are going to be combined into a single class, which will be the base class in the new table model class hierarchy.  The only members left in the Table class are static members and functions except for the constructor and entry member pointer, which is just pointing to the static array of initialized table entries.

The entry pointer member was removed and the static array is accessed directly.  The entry pointer and size arguments were removed from the constructor.  The constructor loops through each entry in the array calling the add function to add the necessary info to the static table members.  The alternate info initializer list is then iterated to add other alternates not automatically set up by the table entries in the add function.

Previously when the add function threw an error, the constructor caught the error and added it to a list.  At the end of the constructor, if this list is not empty, then the errors are output and the application is aborted.  With the new table model, it will not be possible to catch all errors in a list since errors thrown by static constructors abort the application immediately.  The add function was modified to catch its own error, output it and abort.  This is only a diagnostic tool during development, so trying to report all errors would be nice but not a necessity.

Both the add and add expected data type functions operated on a single table entry and therefore were moved to the Table Entry class.  These functions will be called by the constructors of the new table class hierarchy.  The function was renamed to add to table, but the entire function is too large and needs to be cleaned up (refactored, in other words, broken up into smaller functions; and this is certainly not the only function with this problem).

[branch table commit 07064dbde4]