The design of the info dictionaries required the program model to create the instances for the additional info for the dictionary (in this case, the constant number and string dictionaries) and pass this instance for the creation of the dictionary. The program model owned and was responsible for these instances. This is possibly problematic because it did not guarantee that an additional info instance of the correct type was passed to the info dictionary.
The design was changed where new constant number and string classes derived from the base info dictionary class were added. In their constructors, the additional info instance is created of the correct type and they own the instance in the abstract info member pointer in the base class. A destructor was added to the base class to delete this instance, which required a virtual destructor in the abstract info class so that the derived info class destructor gets called.
While not needed until the run-time module is implemented, access functions for the arrays in the additional info of the constant string and number dictionaries were added. These functions simply call the access functions in the derived info classes. However, a type cast to the derived class is needed since the base class defines the additional info instance pointer as an abstract info class pointer.
[commit 451edd6346]
Subscribe to:
Post Comments (Atom)
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.)