Thursday, February 11, 2010

Table Class – Data Members

The Table class will contain these data members:

    entry      pointer to the table entries array (TableEntry)
    index_code pointer to the code to index array
    range      array of Range structures (with begin and end index members)

The constructor will initialize all the Table data including setting the entry pointer to the table entry array (a local static in the table.cpp source file), allocating the index_code array, and setting up the index_code and range arrays.  The destructor will delete the index_code array.

The initialization includes the recording the index of each code in the table to the index_code array (recording an error for any duplicates found), checking and recording an error for any missing codes, setting the search type range being and end indexes, checking if the begin index is not greater than the end index for each range (recording an error for any range errors found), and checking that the indexes of the ranges do not overlap each other (recording an error for any overlap errors found). Any errors will be appended to an error list. At the end of initialization, if this error list is not empty, an exception with the error list will be thrown.  An error list will be used so that all errors in the table will be reported. 

Updated Wednesday, February 17, 2010; 8:40 pm: changed to reflect the four different type of table errors.

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)