Table
└── Operand
├── Rem [remCommand, remOperator]
├── Const [constDbl]
│ ├── CosntInt [constInt]
│ └── CosntStr [constStr]
└── Var [var]
├── VarInt [varInt]
├── VarStr [varStr]
└── VarRef [varRef]
├── VarRefInt [varRefInt]
└── VarRefStr [varRefStr]
Wednesday, February 18, 2015
Table Class Hierarchy – Operand Entries
The last several commits involved the virtual encode, operand text, and remove table functions. These virtual functions will only be used by codes that contain operands (a second program word with an index of a dictionary entry). The table class hierarchy was implemented for these table entries. The resulting implementation for the operand table sub-class hierarchy is shown in this diagram:
The names in bold are the derived table entry classes used to instantiate the table entries (names shown in brackets). The italic-bold names are base classes and are not meant to be used to create instances. Eventually these will contain pure virtual functions preventing instantiation. Note that some of the derived table entry classes are also used as base classes for related derived table entry classes (Const, Var, and VarRef).
The REM recreate function contents were moved to the Rem class virtual recreate function. The constant string recreate function contents were moved to the ConstStr class virtual recreate function. This function was refactored a bit by separating out the replace double quotes with two function (mainly to simplify the recreate function and remove the necessity of a comment that might become stale).
A new table class append alternate function was implemented taking a reference to a Alternate Item structure and is called from the Operand class constructor. This append alternate function appends the entry pointer (this) to the alternate entry vector of the primary entry for the operand index if the primary entry pointer is not a null pointer (the default if entry is not an alternate). This functionality will probably be moved up into the base Table class since it will be needed for other table entries classes.
The names in bold are the derived table entry classes used to instantiate the table entries (names shown in brackets). The italic-bold names are base classes and are not meant to be used to create instances. Eventually these will contain pure virtual functions preventing instantiation. Note that some of the derived table entry classes are also used as base classes for related derived table entry classes (Const, Var, and VarRef).
The REM recreate function contents were moved to the Rem class virtual recreate function. The constant string recreate function contents were moved to the ConstStr class virtual recreate function. This function was refactored a bit by separating out the replace double quotes with two function (mainly to simplify the recreate function and remove the necessity of a comment that might become stale).
A new table class append alternate function was implemented taking a reference to a Alternate Item structure and is called from the Operand class constructor. This append alternate function appends the entry pointer (this) to the alternate entry vector of the primary entry for the operand index if the primary entry pointer is not a null pointer (the default if entry is not an alternate). This functionality will probably be moved up into the base Table class since it will be needed for other table entries classes.
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.)