31.01.2014 Views

Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...

Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...

Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 9. openETCS Generator Application<br />

9.5.2. libDSM Implementation<br />

Since the base class CSyntaxTransformer only provid<strong>es</strong> general attribut<strong>es</strong> and methods for all<br />

concrete transformer class<strong>es</strong>, the implementation of CGOPPRRTransformer is explained in<br />

detail.<br />

The converting proc<strong>es</strong>s starts with the parsing of a GOPPRR XML file by the m_XMLParser<br />

object, which delivers the content of the file as DOM. Furthermore, the XML file is validated<br />

according to the GOPPRR XSD from Section 4.3 to ensure that only valid GOPPRR instanc<strong>es</strong><br />

are used. Since the DOM is mainly a repr<strong>es</strong>entation of the XML file in a certain C++ class<br />

or rather object structure, the whole document object model has to be proc<strong>es</strong>sed by the<br />

CGOPPRRTransformer.<br />

Due to the structure of the GOPPRR C++ abstract syntax model and the XSD, concrete<br />

instanc<strong>es</strong> of GOPPRR elements are only used on the project level while on lower levels for<br />

graphs, objects, ports, properti<strong>es</strong>, rol<strong>es</strong>, and relationships other elements are only referenced.<br />

For the implementation in C++, those are class instanc<strong>es</strong> and pointers [79] to them. In the<br />

XSD, a special XML element is defined for referenc<strong>es</strong> to elements, which us<strong>es</strong> the OID (see<br />

Section 4.2) instead of memory addr<strong>es</strong>s<strong>es</strong> [79] for pointers.<br />

A certain issue is the fact that graphs structur<strong>es</strong> can be defined in a quasi unlimited<br />

way by decompositions and explosions. Therefore, the first approach was also a recursive<br />

implementation of the CGOPPRRTransformer. This means if a reference to any element type<br />

was encountered in the DOM, this reference was followed (by the OID) until a concrete instance<br />

was met. The big advantage of this approach is that it is ensured that all referenc<strong>es</strong> are<br />

r<strong>es</strong>olved for the GOPPRR C++ abstract syntax model. Unfortunately, this also caused severe<br />

performance problems. Mainly, not by the recursion itself but by the usage of methods in the<br />

libxml++ library to r<strong>es</strong>olve XPath [42] expr<strong>es</strong>sions to find directly the referenced element.<br />

To handle this problem, a certain condition of the GOPPRR C++ abstract syntax model<br />

and XSD was used to implement the conversion in an iterative way: Since every GOPPRR<br />

element instance must exists in the parent project, all concrete instanc<strong>es</strong> can be created in<br />

the project by a single iterative step through the complete DOM while all referenc<strong>es</strong> are left<br />

unset. In only one further iterative step, all referenc<strong>es</strong> can be then easy initialised because all<br />

instanc<strong>es</strong> are guaranteed to exist, which is enforced by the GOPPRR XSD. This implementation<br />

approach provid<strong>es</strong> a much better performance than the recursive one and is finally used in the<br />

CGOPPRRTransformer class.<br />

Additionally, it implicitly solv<strong>es</strong> a problem with recursive sub-graph relations if a GOP-<br />

PRR object has a decomposition to a GOPPRR graph in which this object is again pr<strong>es</strong>ent.<br />

Proceeding such a relation in a recursive way would directly lead to an endl<strong>es</strong>s execution<br />

without termination. Of course, such recursive sub-graph relations are explicitly forbidden for<br />

a openETCS model by the static semantics in Subsection 7.5.2, but it must be emphasised that<br />

according to the tool chain and the integration of the OCL in Chapter 4, the corr<strong>es</strong>ponding<br />

constraints are checked on the GOPPRR C++ abstract syntax model. Thus, the GOPPRR<br />

XML file can always hold such an invalid relation. Neverthel<strong>es</strong>s, the recursive implementation<br />

is still available for referenc<strong>es</strong> purpos<strong>es</strong>. The issue to insure that the whole intermediate XML<br />

model is used is also related to Req.9.<br />

The CGOPPRRSyntaxTree mainly encapsulat<strong>es</strong> a CProject instance and do<strong>es</strong> not have to<br />

170

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!