Closed michaelrfraser closed 6 years ago
Note: RPR v2 FOM modules can be downloaded from https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=43284
PR submitted at https://github.com/openlvc/portico/pull/257
Merged into master
Problem Statement
Before we introduced datatype parsing, the FOM parse and merge process followed the following sequence:
As part of the NIST work we introduced datatype parsing to the FOM parser. Datatypes may reference other types in their declaration (E.g. a FixedRecordDatatype declares fields, each which has their own type.
As there is no garuantee that these dependent datatypes have been declared in the xml before the containing type is declared, we introduced a linking system, whereby containing types are constructed with placeholders for their dependent types. Once the FOM is parsed, these placeholders are resolved to their concrete IDatatype in memory.
As a result the FOM parsing process became:
When we developed the datatype parsing system, we worked under the assumption that all FOM modules were standalone in their own right - e.g. the datatypes has declarations for all datatypes that are referenced in the module.
However in the modular RPR FOM this is not the case. For example:
RPR-Enumerations_v2.0.xml
declares an enumeratedData typeAcknowledgeFlagEnum16
which has a representation datatypeRPRunsignedInteger16BE
RPRunsignedInteger16BE
is declared in the module `RPR-Foundation_v2.0.xmlAs such, the module
RPR-Enumerations_v2.0.xml
will fail to parse as the linking step will not be able to find the definition ofRPRunsignedInteger16BE
.This problem also manifests when assigning datatypes to Attribute and Parameter metadata instances. In the RPR FOM the attribute/parameter datatypes may not have been declared in the same file.
What needs to happen
If the RPRv2 modular FOM is a reflection of reality, then we need to defer when the linking phase occurs until after all FOMs have been parsed. For example:
Under the previous model, linking was only required for datatypes as we could be certain that all datatypes were in place when we came to process attributes and parameters. However now as there is no garuntee that all datatypes are available at parsing time, we must defer link attribute and parameter datatypes also.