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 ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
E.3. Generator Application Source Reference<br />
284<br />
285<br />
286 <br />
E.3. Generator Application Source Reference<br />
The source code reference documentation is also part of the openETCS domain framework<br />
reference documentation in Section D.1.<br />
E.4. Generator Model<br />
The UML model is also part of the openETCS domain framework model in Section D.3.<br />
E.5. Generator Source Code<br />
The source code is also part of the openETCS domain framework source code in Section D.2.<br />
The following C++ source code listings are used as exampl<strong>es</strong> for the main part of this document.<br />
Listing E.1: Abstract data flow model initial creation<br />
1 void CCPPGenerator : : BuildAbstractModel (GOPPRR : : CGraph ∗ const pFunctionBlock , : : s t d : : map<<br />
: : s t d : : s t r i n g , oETCS : : GEN : : CFBNode >& FBNod<strong>es</strong> ) throw ( : : GOPPRR : : E r r o r : : CException )<br />
2 {<br />
3 d e c l t y p e ( : : GOPPRR : : CGraph : : m_ObjectSet . b e g i n ( ) ) Object ;<br />
4 d e c l t y p e ( : : GOPPRR : : CGraph : : m_RoleSet ) I n p u t s ;<br />
5 d e c l t y p e ( : : GOPPRR : : CGraph : : m_RoleSet . b e g i n ( ) ) Input ;<br />
6 : : GOPPRR : : CRole∗ pOutput ( n u l l p t r ) ;<br />
7 : : GOPPRR : : CObject ∗ pOutputNode ( n u l l p t r ) ;<br />
8<br />
9<br />
10 // proc<strong>es</strong>s a l l o b j e c t s in sub f u n c t i o n b l o c k<br />
11 f o r ( Object = pFunctionBlock−>m_ObjectSet . b e g i n ( ) ; Object != pFunctionBlock−>m_ObjectSet . end ( ) ;<br />
Object++)<br />
12 {<br />
13 // check i f current o b j e c t i s a concrete f u n c t i o n b l o c k element<br />
14 i f (m_FBMap. f i n d ( Object−>second−>m_Type) != m_FBMap. end ( ) )<br />
15 {<br />
16 // add current o b j e c t to node l i s t<br />
17 FBNod<strong>es</strong> [ Object−>second−>m_OID] = : : oETCS : : GEN : : CFBNode( Object−>second−>m_OID,<br />
: : oETCS : : GEN : : CFBNode : : DEFINED) ;<br />
18<br />
19 // g e t a l l input r o l e s o f current f u n c t i o n b l o c k o b j e c t<br />
20 I n p u t s = pFunctionBlock−>R o l e s ( Object−>second , " DataInput " , f a l s e , f a l s e ) ;<br />
21<br />
22 // proc<strong>es</strong>s a l l i n p u t s<br />
23 f o r ( Input = I n p u t s . b e g i n ( ) ; Input != I n p u t s . end ( ) ; Input++)<br />
24 {<br />
25 // g e t connected output r o l e<br />
26 pOutput = pFunctionBlock−>R o l e s ( Input−>second , " DataOutput " , f a l s e , true ) . b e g i n ( )−>second ;<br />
27<br />
28 // g e t connected f u n c t i o n b l o c k o b j e c t<br />
29 pOutputNode = pFunctionBlock−>O b j e c t s ( pOutput , true ) . b e g i n ( )−>second ;<br />
30<br />
31 // add input o b j e c t as undefined node in outputs<br />
32 FBNod<strong>es</strong> [ Object−>second−>m_OID ] . m_Inputs . push_back (new<br />
: : oETCS : : GEN : : CFBNode( pOutputNode−>m_OID, : : oETCS : : GEN : : CFBNode : : UNDEFINED) ) ; // TODO:<br />
handle e x c e p t i o n s<br />
33<br />
34 } // f o r ( Input = Inputs . begin ( ) ; Input != Inputs . end ( ) ; Input++)<br />
35<br />
36 } // i f (m_FBMap. f i n d ( Object−>second−>m_Type) != m_FBMap. end ( ) )<br />
37 e l s e i f ( Object−>second−>m_Type == " SubFunction " )<br />
38 {<br />
39 // check i f o b j e c t has a decomposition<br />
40 i f ( Object−>second−>m_pDecomposition != 0 )<br />
41 {<br />
42 // c a l l t h i s method r e c u r s i v e l y on decomposition<br />
43 this−>BuildAbstractModel ( Object−>second−>m_pDecomposition , FBNod<strong>es</strong> ) ;<br />
44<br />
45 } // i f ( Object−>second−>m_pDecomposition != 0)<br />
263