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.
Appendix E. openETCS Generator<br />
46<br />
47 } // e l s e i f ( Object−>second−>m_Type == "SubFunction ")<br />
48<br />
49 } // f o r ( Object = pFunctionBlock−>m_ObjectSet . begin ( ) ; Object !=<br />
pFunctionBlock−>m_ObjectSet . end ( ) ; Object++)<br />
50<br />
51 } // void CCPPGenerator : : BuildAbstractModel ( )<br />
Listing E.2: Abstract data flow model full creation<br />
1 // proc<strong>es</strong>s a l l nod<strong>es</strong> found ( i n c l u d i n g sub−graphs )<br />
2 f o r ( n = FBNod<strong>es</strong> . b e g i n ( ) ; n != FBNod<strong>es</strong> . end ( ) ; n++)<br />
3 {<br />
4 // proc<strong>es</strong>s a l l i n p u t s o f current node<br />
5 f o r ( i = n−>second . m_Inputs . b e g i n ( ) ; i != n−>second . m_Inputs . end ( ) ; i ++)<br />
6 {<br />
7 // s t o r e OID o f current output node<br />
8 OID = (∗ i )−>m_OID;<br />
9<br />
10 // d e l e t e current undefined o b j e c t<br />
11 delete (∗ i ) ;<br />
12<br />
13 // use p o i n t e r to a c t u a l node at i t e r a t o r s p l a c e<br />
14 ∗ i = &FBNod<strong>es</strong> [ OID ] ;<br />
15<br />
16 } // f o r ( i = n−>second . m_Inputs . begin ( ) ; i != n−>second . m_Inputs . end ( ) ; i++)<br />
17<br />
18 } // f o r (n = FBNod<strong>es</strong> . begin ( ) ; n != FBNod<strong>es</strong> . end ( ) ; n++)<br />
Listing E.3: Abstract data flow model proc<strong>es</strong>sing<br />
1 void CCPPGenerator : : P r o c e s s A b s t r a c t M o d e l ( const oETCS : : GEN : : CFBNode & Node , : : s t d : : l i s t <<br />
: : s t d : : s t r i n g >& ExecutionOr<strong>der</strong> , : : s t d : : v e c t o r < const oETCS : : GEN : : CFBNode ∗ >& NodeStack )<br />
throw ( )<br />
2 {<br />
3 d e c l t y p e ( Node . m_Inputs . b e g i n ( ) ) i ;<br />
4 d e c l t y p e ( ExecutionOr<strong>der</strong> . b e g i n ( ) ) s ;<br />
5 d e c l t y p e ( NodeStack . b e g i n ( ) ) ns ;<br />
6 bool bFound ( f a l s e ) ;<br />
7 bool bOnStack ( f a l s e ) ;<br />
8<br />
9<br />
10 // check i f t h i s node i s already on node s t a c k<br />
11 f o r ( ns = NodeStack . b e g i n ( ) ; ns != NodeStack . end ( ) && not bOnStack ; ns++)<br />
12 {<br />
13 // check i f current node on s t a c k i s current node<br />
14 bOnStack = (∗ ns == &Node ) ;<br />
15<br />
16 } // f o r ( ns = NodeStack . begin ( ) ; ns != NodeStack . end ( ) && not bOnStack ; ns++)<br />
17<br />
18<br />
19 // only proc<strong>es</strong>s node i f i t i s not on s t a c k to avoid i n f i n i t e r e c u r s i o n s on data f l o w l o o p s<br />
20 i f ( not bOnStack )<br />
21 {<br />
22 // check i f current node already e x i s t s on execution or<strong>der</strong> s t a c k<br />
23 f o r ( s = ExecutionOr<strong>der</strong> . b e g i n ( ) ; s != ExecutionOr<strong>der</strong> . end ( ) && not bFound ; s++)<br />
24 {<br />
25 // check i f current s t a c k element corr<strong>es</strong>ponds to current node ’ s OID<br />
26 bFound = (∗ s == Node .m_OID) ;<br />
27<br />
28 } // f o r ( s = ExecutionOr<strong>der</strong> . begin ( ) ; s != ExecutionOr<strong>der</strong> . end ( ) && not bFound ; s++)<br />
29<br />
30<br />
31 // check i f node has any input<br />
32 i f ( Node . m_Inputs . empty ( ) )<br />
33 {<br />
34 // check i f node i s already on s t a c k<br />
35 i f ( not bFound )<br />
36 {<br />
37 // node i s a flow−chain s t a r t point and i s d i r e c t l y added to the execution or<strong>der</strong><br />
38 ExecutionOr<strong>der</strong> . push_back ( Node .m_OID) ;<br />
39<br />
40 } // i f ( not bFound)<br />
41<br />
42 } // i f (Node . m_Inputs . empty ( ) )<br />
43 e l s e<br />
44 {<br />
45 // proc<strong>es</strong>s a l l input nod<strong>es</strong><br />
46 f o r ( i = Node . m_Inputs . b e g i n ( ) ; i != Node . m_Inputs . end ( ) ; i ++)<br />
47 {<br />
48 // p l a c e current node on s t a c k<br />
264