openETCS
case study for the European Train Control System developed for the authors dissertation
FunctionBlocks.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010-2012
3  Johannes Feuser <feuser@uni-bremen.de>
4  This file is part of the openETCS library.
5 
6  The openETCS library is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  any later version.
10 
11  The openETCS library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with the openETCS library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /*!
21  * \author Johannes Feuser <feuser@uni-bremen.de>
22  * \brief all local function block classes
23  */
24 
25 #include "FunctionBlocks.h"
26 #include "EVCStateMachine.h"
28 
29 
30 
31 
32 namespace oETCS {
33 
34 namespace DF {
35 
36 
37 CAnd::CAnd(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
38 :CFunctionBlock(pStateMachine),
39  m_bInput1(false),
40  m_bInput2(false)
41 {
42  // Bouml preserved body begin 0004C582
43  // empty constructor
44  // Bouml preserved body end 0004C582
45 
46 } // CAnd::CAnd() throw()
47 
48 
49 
50 
51 CAnd::~CAnd() throw()
52 {
53  // Bouml preserved body begin 0004C602
54  // empty destructor
55  // Bouml preserved body end 0004C602
56 
57 } // CAnd::~CAnd() throw()
58 
59 
60 
61 
62 void CAnd::Calculate() throw(::oETCS::DF::Error::CException)
63 {
64  // Bouml preserved body begin 0004E082
65  const unsigned int NUMBER_RESULTS(m_Result.size());
66  unsigned int x(0);
67  bool bOutput(false);
68 
69 
70  // compute calculation result
71  bOutput = m_bInput1() && m_bInput2();
72 
73  // set result in all connected outputs
74  for (x = 0; x < NUMBER_RESULTS; x++)
75  {
76  // set result in current output
77  *m_Result[x] = bOutput;
78 
79  } // for (x = 0; x < NUMBER_RESULTS; x++)
80  // Bouml preserved body end 0004E082
81 
82 } // void CAnd::Calculate() throw(::oETCS::DF::Error::CException)
83 
84 
85 
86 
87 COr::COr(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
88 :CFunctionBlock(pStateMachine),
89  m_bInput1(false),
90  m_bInput2(false)
91 {
92  // Bouml preserved body begin 00050402
93  // empty constructor
94  // Bouml preserved body end 00050402
95 
96 } // COr::COr() throw()
97 
98 
99 
100 
101 COr::~COr() throw()
102 {
103  // Bouml preserved body begin 00050482
104  // empty destructor
105  // Bouml preserved body end 00050482
106 
107 } // COr::~COr() throw()
108 
109 
110 
111 
112 void COr::Calculate() throw(::oETCS::DF::Error::CException)
113 {
114  // Bouml preserved body begin 00050682
115  const unsigned int NUMBER_RESULTS(m_Result.size());
116  unsigned int x(0);
117  bool bOutput(false);
118 
119 
120  // compute calculation result
121  bOutput = m_bInput1() || m_bInput2();
122 
123  // set result in all connected outputs
124  for (x = 0; x < NUMBER_RESULTS; x++)
125  {
126  // set result in current output
127  *m_Result[x] = bOutput;
128 
129  } // for (x = 0; x < NUMBER_RESULTS; x++)
130  // Bouml preserved body end 00050682
131 
132 } // void COr::Calculate() throw(::oETCS::DF::Error::CException)
133 
134 
135 
136 
137 CDivision::CDivision(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
138 :CFunctionBlock(pStateMachine),
139  m_dDividend(0.0),
140  m_dDivisor(1.0)
141 {
142  // Bouml preserved body begin 00054802
143  // empty constructor
144  // Bouml preserved body end 00054802
145 
146 } // CDivision::CDivision() throw()
147 
148 
149 
150 
152 {
153  // Bouml preserved body begin 00054882
154  // empty destructor
155  // Bouml preserved body end 00054882
156 
157 } // CDivision::~CDivision() throw()
158 
159 
160 
161 
162 void CDivision::Calculate() throw(::oETCS::DF::Error::CException)
163 {
164  // Bouml preserved body begin 00054A82
165  const unsigned int NUMBER_RESULTS(m_Quotient.size());
166  unsigned int x(0);
167  double dQuotient(0.0);
168 
169 
170  // check, if divisor is not 0
171  if (m_dDivisor() == 0.0)
172  {
173  // throw exception
174  ::oETCS::DF::Error::CMath("division by zero not defined");
175 
176  } // if (m_dDivisor() == 0.0)
177 
178 
179  // compute calculation result
180  dQuotient = m_dDividend() / m_dDivisor();
181 
182  // set result in all connected outputs
183  for (x = 0; x < NUMBER_RESULTS; x++)
184  {
185  // set result in current output
186  *m_Quotient[x] = dQuotient;
187 
188  } // for (x = 0; x < NUMBER_RESULTS; x++)
189  // Bouml preserved body end 00054A82
190 
191 } // void CDivision::Calculate() throw(::oETCS::DF::Error::CException)
192 
193 
194 
195 
197 :CFunctionBlock(pStateMachine),
198  m_dInput1(1.0),
199  m_dInput2(1.0)
200 {
201  // Bouml preserved body begin 00054F02
202  // empty constructor
203  // Bouml preserved body end 00054F02
204 
205 } // CDoubleEqual::CDoubleEqual() throw()
206 
207 
208 
209 
211 {
212  // Bouml preserved body begin 00054F82
213  // empty destructor
214  // Bouml preserved body end 00054F82
215 
216 } // CDoubleEqual::~CDoubleEqual() throw()
217 
218 
219 
220 
221 void CDoubleEqual::Calculate() throw(::oETCS::DF::Error::CException)
222 {
223  // Bouml preserved body begin 00055182
224  const unsigned int NUMBER_RESULTS(m_Equal.size());
225  unsigned int x(0);
226  bool bEqual(false);
227 
228 
229  // compute calculation result
230  bEqual = (m_dInput1() == m_dInput2());
231 
232  // set result in all connected outputs
233  for (x = 0; x < NUMBER_RESULTS; x++)
234  {
235  // set result in current output
236  *m_Equal[x] = bEqual;
237 
238  } // for (x = 0; x < NUMBER_RESULTS; x++)
239  // Bouml preserved body end 00055182
240 
241 } // void CDoubleEqual::Calculate() throw(::oETCS::DF::Error::CException)
242 
243 
244 
245 
247 :CFunctionBlock(pStateMachine),
248  m_dMultiplicator1(1.0),
249  m_dMultiplicator2(1.0),
250  m_dMultiplicator3(1.0)
251 {
252  // Bouml preserved body begin 00054B02
253  // empty constructor
254  // Bouml preserved body end 00054B02
255 
256 } // CMultiplication::CMultiplication() throw()
257 
258 
259 
260 
262 {
263  // Bouml preserved body begin 00054B82
264  // empty destructor
265  // Bouml preserved body end 00054B82
266 
267 } // CMultiplication::~CMultiplication() throw()
268 
269 
270 
271 
272 void CMultiplication::Calculate() throw(::oETCS::DF::Error::CException)
273 {
274  // Bouml preserved body begin 00054D82
275  const unsigned int NUMBER_RESULTS(m_Product.size());
276  unsigned int x(0);
277  double dProduct(0.0);
278 
279 
280  // compute calculation result
282 
283  // set result in all connected outputs
284  for (x = 0; x < NUMBER_RESULTS; x++)
285  {
286  // set result in current output
287  *m_Product[x] = dProduct;
288 
289  } // for (x = 0; x < NUMBER_RESULTS; x++)
290  // Bouml preserved body end 00054D82
291 
292 } // void CMultiplication::Calculate() throw(::oETCS::DF::Error::CException)
293 
294 
295 
296 
297 CNot::CNot(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
298 :CFunctionBlock(pStateMachine),
299  m_bInput(false)
300 {
301  // Bouml preserved body begin 00052302
302  // empty constructor
303  // Bouml preserved body end 00052302
304 
305 } // CNot::CNot() throw()
306 
307 
308 
309 
310 CNot::~CNot() throw()
311 {
312  // Bouml preserved body begin 00052382
313  // empty destructor
314  // Bouml preserved body end 00052382
315 
316 } // CNot::~CNot() throw()
317 
318 
319 
320 
321 void CNot::Calculate() throw(::oETCS::DF::Error::CException)
322 {
323  // Bouml preserved body begin 00052582
324  const unsigned int NUMBER_RESULTS(m_Result.size());
325  unsigned int x(0);
326  bool bOutput(false);
327 
328 
329  // compute calculation result
330  bOutput = !m_bInput();
331 
332  // set result in all connected outputs
333  for (x = 0; x < NUMBER_RESULTS; x++)
334  {
335  // set result in current output
336  *m_Result[x] = bOutput;
337 
338  } // for (x = 0; x < NUMBER_RESULTS; x++)
339  // Bouml preserved body end 00052582
340 
341 } // void CNot::Calculate() throw(::oETCS::DF::Error::CException)
342 
343 
344 
345 
347 :CFunctionBlock(pStateMachine),
348  m_dMinuend(0.0),
349  m_dSubtrahend(0.0)
350 {
351  // Bouml preserved body begin 00052B82
352  // empty constructor
353  // Bouml preserved body end 00052B82
354 
355 } // CSubstraction::CSubstraction() throw()
356 
357 
358 
359 
361 {
362  // Bouml preserved body begin 00052C02
363  // empty destructor
364  // Bouml preserved body end 00052C02
365 
366 } // CSubstraction::~CSubstraction() throw()
367 
368 
369 
370 
371 void CSubstraction::Calculate() throw(::oETCS::DF::Error::CException)
372 {
373  // Bouml preserved body begin 00052E82
374  const unsigned int NUMBER_RESULTS(m_Difference.size());
375  unsigned int x(0);
376  double dDifference(0.0);
377 
378 
379  // compute calculation result
380  dDifference = m_dMinuend() - m_dSubtrahend();
381 
382  // set result in all connected outputs
383  for (x = 0; x < NUMBER_RESULTS; x++)
384  {
385  // set result in current output
386  *m_Difference[x] = dDifference;
387 
388  } // for (x = 0; x < NUMBER_RESULTS; x++)
389  // Bouml preserved body end 00052E82
390 
391 } // void CSubstraction::Calculate() throw(::oETCS::DF::Error::CException)
392 
393 
394 
395 
396 CSum::CSum(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
397 :CFunctionBlock(pStateMachine),
398  m_dAddend1(0.0),
399  m_dAddend2(0.0),
400  m_dAddend3(0.0)
401 {
402  // Bouml preserved body begin 00052602
403  // empty constructor
404  // Bouml preserved body end 00052602
405 
406 } // CSum::CSum() throw()
407 
408 
409 
410 
411 CSum::~CSum() throw()
412 {
413  // Bouml preserved body begin 00052682
414  // empty destructor
415  // Bouml preserved body end 00052682
416 
417 } // CSum::~CSum() throw()
418 
419 
420 
421 
422 void CSum::Calculate() throw(::oETCS::DF::Error::CException)
423 {
424  // Bouml preserved body begin 00052882
425  const unsigned int NUMBER_RESULTS(m_Sum.size());
426  unsigned int x(0);
427  double dSum(0.0);
428 
429 
430  // compute calculation result
431  dSum = m_dAddend1() + m_dAddend2() + m_dAddend3();
432 
433  // set result in all connected outputs
434  for (x = 0; x < NUMBER_RESULTS; x++)
435  {
436  // set result in current output
437  *m_Sum[x] = dSum;
438 
439  } // for (x = 0; x < NUMBER_RESULTS; x++)
440  // Bouml preserved body end 00052882
441 
442 } // void CSum::Calculate() throw(::oETCS::DF::Error::CException)
443 
444 
445 
446 
447 CXor::CXor(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
448 :CFunctionBlock(pStateMachine),
449  m_bInput1(false),
450  m_bInput2(false)
451 {
452  // Bouml preserved body begin 00052002
453  // empty constructor
454  // Bouml preserved body end 00052002
455 
456 } // CXor::CXor() throw()
457 
458 
459 
460 
461 CXor::~CXor() throw()
462 {
463  // Bouml preserved body begin 00052082
464  // empty destructor
465  // Bouml preserved body end 00052082
466 
467 } // CXor::~CXor() throw()
468 
469 
470 
471 
472 void CXor::Calculate() throw(::oETCS::DF::Error::CException)
473 {
474  // Bouml preserved body begin 00052282
475  const unsigned int NUMBER_RESULTS(m_Result.size());
476  unsigned int x(0);
477  bool bOutput(false);
478 
479 
480  // compute calculation result
481  bOutput = (m_bInput1() ^ m_bInput2());
482 
483  // set result in all connected outputs
484  for (x = 0; x < NUMBER_RESULTS; x++)
485  {
486  // set result in current output
487  *m_Result[x] = bOutput;
488 
489  } // for (x = 0; x < NUMBER_RESULTS; x++)
490  // Bouml preserved body end 00052282
491 
492 } // void CXor::Calculate() throw(::oETCS::DF::Error::CException)
493 
494 
495 
496 
498 :CFunctionBlock(pStateMachine),
499  m_Array(::std::vector< double >(0)),
500  m_iIndex(0)
501 {
502  // Bouml preserved body begin 00057A02
503  // empty constructor
504  // Bouml preserved body end 00057A02
505 
506 } // CDoubleArrayAccessor::CDoubleArrayAccessor() throw()
507 
508 
509 
510 
512 {
513  // Bouml preserved body begin 00057A82
514  // empty destructor
515  // Bouml preserved body end 00057A82
516 
517 } // CDoubleArrayAccessor::~CDoubleArrayAccessor() throw()
518 
519 
520 
521 
522 void CDoubleArrayAccessor::Calculate() throw(::oETCS::DF::Error::CException)
523 {
524  // Bouml preserved body begin 00057C82
525  const unsigned int NUMBER_RESULTS(m_Value.size());
526  const int SIZE_ARRAY(m_Array().size());
527  unsigned int x(0);
528  double dValue(0.0);
529 
530  // check, if index input value is valid
531  if (m_iIndex() >= SIZE_ARRAY)
532  {
533  // throw exception
534  throw (::oETCS::DF::Error::CInput("index value exceeds double array's size"));
535 
536  } // if (m_iIndex() >= SIZE_ARRAY)
537 
538  // compute calculation result
539  dValue = m_Array()[m_iIndex()];
540 
541  // set result in all connected outputs
542  for (x = 0; x < NUMBER_RESULTS; x++)
543  {
544  // set result in current output
545  *m_Value[x] = dValue;
546 
547  } // for (x = 0; x < NUMBER_RESULTS; x++)
548  // Bouml preserved body end 00057C82
549 
550 } // void CDoubleArrayAccessor::Calculate() throw(::oETCS::DF::Error::CException)
551 
552 
553 
554 
556 :CFunctionBlock(pStateMachine),
557  m_dInput1(0.0),
558  m_dInput2(0.0)
559 {
560  // Bouml preserved body begin 00055802
561  // empty constructor
562  // Bouml preserved body end 00055802
563 
564 } // CDoubleEqualOrGreater::CDoubleEqualOrGreater() throw()
565 
566 
567 
568 
570 {
571  // Bouml preserved body begin 00055882
572  // empty destructor
573  // Bouml preserved body end 00055882
574 
575 } // CDoubleEqualOrGreater::~CDoubleEqualOrGreater() throw()
576 
577 
578 
579 
580 void CDoubleEqualOrGreater::Calculate() throw(::oETCS::DF::Error::CException)
581 {
582  // Bouml preserved body begin 00055A82
583  const unsigned int NUMBER_RESULTS(m_EqualOrGreater.size());
584  unsigned int x(0);
585  bool bEqualOrGreater(false);
586 
587 
588  // compute calculation result
589  bEqualOrGreater = (m_dInput1() >= m_dInput2());
590 
591  // set result in all connected outputs
592  for (x = 0; x < NUMBER_RESULTS; x++)
593  {
594  // set result in current output
595  *m_EqualOrGreater[x] = bEqualOrGreater;
596 
597  } // for (x = 0; x < NUMBER_RESULTS; x++)
598  // Bouml preserved body end 00055A82
599 
600 } // void CDoubleEqualOrGreater::Calculate() throw(::oETCS::DF::Error::CException)
601 
602 
603 
604 
606 :CFunctionBlock(pStateMachine),
607  m_dInput1(0.0),
608  m_dInput2(0.0)
609 {
610  // Bouml preserved body begin 00055B02
611  // empty constructor
612  // Bouml preserved body end 00055B02
613 
614 } // CDoubleGreater::CDoubleGreater() throw()
615 
616 
617 
618 
620 {
621  // Bouml preserved body begin 00055B82
622  // empty destructor
623  // Bouml preserved body end 00055B82
624 
625 } // CDoubleGreater::~CDoubleGreater() throw()
626 
627 
628 
629 
630 void CDoubleGreater::Calculate() throw(::oETCS::DF::Error::CException)
631 {
632  // Bouml preserved body begin 00055D82
633  const unsigned int NUMBER_RESULTS(m_Greater.size());
634  unsigned int x(0);
635  bool bGreater(false);
636 
637 
638  // compute calculation result
639  bGreater = (m_dInput1() > m_dInput2());
640 
641  // set result in all connected outputs
642  for (x = 0; x < NUMBER_RESULTS; x++)
643  {
644  // set result in current output
645  *m_Greater[x] = bGreater;
646 
647  } // for (x = 0; x < NUMBER_RESULTS; x++)
648  // Bouml preserved body end 00055D82
649 
650 } // void CDoubleGreater::Calculate() throw(::oETCS::DF::Error::CException)
651 
652 
653 
654 
656 :CFunctionBlock(pStateMachine),
657  m_iInput1(0),
658  m_iInput2(0)
659 {
660  // Bouml preserved body begin 00055E02
661  // empty constructor
662  // Bouml preserved body end 00055E02
663 
664 } // CIntGreater::CIntGreater() throw()
665 
666 
667 
668 
670 {
671  // Bouml preserved body begin 00055E82
672  // empty constructor
673  // Bouml preserved body end 00055E82
674 
675 } // CIntGreater::~CIntGreater() throw()
676 
677 
678 
679 
680 void CIntGreater::Calculate() throw(::oETCS::DF::Error::CException)
681 {
682  // Bouml preserved body begin 00056082
683  const unsigned int NUMBER_RESULTS(m_Greater.size());
684  unsigned int x(0);
685  bool bGreater(false);
686 
687 
688  // compute calculation result
689  bGreater = (m_iInput1() > m_iInput2());
690 
691  // set result in all connected outputs
692  for (x = 0; x < NUMBER_RESULTS; x++)
693  {
694  // set result in current output
695  *m_Greater[x] = bGreater;
696 
697  } // for (x = 0; x < NUMBER_RESULTS; x++)
698  // Bouml preserved body end 00056082
699 
700 } // void CIntGreater::Calculate() throw(::oETCS::DF::Error::CException)
701 
702 
703 
704 
706 :CFunctionBlock(pStateMachine),
707  m_Input1(""),
708  m_Input2("")
709 {
710  // Bouml preserved body begin 00055502
711  // empty constructor
712  // Bouml preserved body end 00055502
713 
714 } // CStringEqual::CStringEqual() throw()
715 
716 
717 
718 
720 {
721  // Bouml preserved body begin 00055582
722  // empty constructor
723  // Bouml preserved body end 00055582
724 
725 } // CStringEqual::~CStringEqual() throw()
726 
727 
728 
729 
730 void CStringEqual::Calculate() throw(::oETCS::DF::Error::CException)
731 {
732  // Bouml preserved body begin 00055782
733  const unsigned int NUMBER_RESULTS(m_Equal.size());
734  unsigned int x(0);
735  bool bEqual(false);
736 
737 
738  // compute calculation result
739  bEqual = (m_Input1() == m_Input2());
740 
741  // set result in all connected outputs
742  for (x = 0; x < NUMBER_RESULTS; x++)
743  {
744  // set result in current output
745  *m_Equal[x] = bEqual;
746 
747  } // for (x = 0; x < NUMBER_RESULTS; x++)
748  // Bouml preserved body end 00055782
749 
750 } // void CStringEqual::Calculate() throw(::oETCS::DF::Error::CException)
751 
752 
753 
754 
755 CBoolGate::CBoolGate(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
756 :CFunctionBlock(pStateMachine),
757  m_bGateInput(false),
758  m_bOpen(false)
759 {
760  // Bouml preserved body begin 0005A282
761  // empty constructor
762  // Bouml preserved body end 0005A282
763 
764 } // CBoolGate::CBoolGate() throw()
765 
766 
767 
768 
770 {
771  // Bouml preserved body begin 0005A302
772  // empty destructor
773  // Bouml preserved body end 0005A302
774 
775 } // CBoolGate::~CBoolGate() throw()
776 
777 
778 
779 
780 void CBoolGate::Calculate() throw(::oETCS::DF::Error::CException)
781 {
782  // Bouml preserved body begin 0005A502
783  const unsigned int NUMBER_RESULTS(m_GateOutput.size());
784  unsigned int x(0);
785 
786 
787  // check, if gate is opened
788  if (m_bOpen())
789  {
790  // set result in all connected outputs
791  for (x = 0; x < NUMBER_RESULTS; x++)
792  {
793  // set result in current output
794  *m_GateOutput[x] = m_bGateInput();
795 
796  } // for (x = 0; x < NUMBER_RESULTS; x++)
797 
798  } // if (m_bOpen())
799  // Bouml preserved body end 0005A502
800 
801 } // void CBoolGate::Calculate() throw(::oETCS::DF::Error::CException)
802 
803 
804 
805 
807 :CFunctionBlock(pStateMachine),
808  m_bInput1(false),
809  m_bInput2(false),
810  m_bUseInput1(false)
811 {
812  // Bouml preserved body begin 0005AB82
813  // empty constructor
814  // Bouml preserved body end 0005AB82
815 
816 } // CBoolSwitch::CBoolSwitch() throw()
817 
818 
819 
820 
822 {
823  // Bouml preserved body begin 0005AC02
824  // empty constructor
825  // Bouml preserved body end 0005AC02
826 
827 } // CBoolSwitch::~CBoolSwitch() throw()
828 
829 
830 
831 
832 void CBoolSwitch::Calculate() throw(::oETCS::DF::Error::CException)
833 {
834  // Bouml preserved body begin 0005AE02
835  const unsigned int NUMBER_RESULTS(m_SwitchOutput.size());
836  unsigned int x(0);
837  bool bOutput(false);
838 
839 
840  // set first or second input depending on input
841  bOutput = (m_bUseInput1() ? m_bInput1(): m_bInput2());
842 
843  // set result in all connected outputs
844  for (x = 0; x < NUMBER_RESULTS; x++)
845  {
846  // set result in current output
847  *m_SwitchOutput[x] = bOutput;
848 
849  } // for (x = 0; x < NUMBER_RESULTS; x++)
850  // Bouml preserved body end 0005AE02
851 
852 } // void CBoolSwitch::Calculate() throw(::oETCS::DF::Error::CException)
853 
854 
855 
856 
858 :CFunctionBlock(pStateMachine),
859  m_dGateInput(0.0),
860  m_bOpen(false)
861 {
862  // Bouml preserved body begin 0005A582
863  // empty constructor
864  // Bouml preserved body end 0005A582
865 
866 } // CDoubleGate::CDoubleGate() throw()
867 
868 
869 
870 
872 {
873  // Bouml preserved body begin 0005A602
874  // empty destructor
875  // Bouml preserved body end 0005A602
876 
877 } // CDoubleGate::~CDoubleGate() throw()
878 
879 
880 
881 
882 void CDoubleGate::Calculate() throw(::oETCS::DF::Error::CException)
883 {
884  // Bouml preserved body begin 0005A802
885  const unsigned int NUMBER_RESULTS(m_GateOutput.size());
886  unsigned int x(0);
887 
888 
889  // check, if gate is opened
890  if (m_bOpen())
891  {
892  // set result in all connected outputs
893  for (x = 0; x < NUMBER_RESULTS; x++)
894  {
895  // set result in current output
896  *m_GateOutput[x] = m_dGateInput();
897 
898  } // for (x = 0; x < NUMBER_RESULTS; x++)
899 
900  } // if (m_bOpen())
901  // Bouml preserved body end 0005A802
902 
903 } // void CDoubleGate::Calculate() throw(::oETCS::DF::Error::CException)
904 
905 
906 
907 
909 :CFunctionBlock(pStateMachine),
910  m_dInput1(0.0),
911  m_dInput2(0.0),
912  m_bUseInput1(false)
913 {
914  // Bouml preserved body begin 0005AF02
915  // empty constructor
916  // Bouml preserved body end 0005AF02
917 
918 } // CDoubleSwitch::CDoubleSwitch() throw()
919 
920 
921 
922 
924 {
925  // Bouml preserved body begin 0005AF82
926  // empty constructor
927  // Bouml preserved body end 0005AF82
928 
929 } // CDoubleSwitch::~CDoubleSwitch() throw()
930 
931 
932 
933 
934 void CDoubleSwitch::Calculate() throw(::oETCS::DF::Error::CException)
935 {
936  // Bouml preserved body begin 0005B202
937  const unsigned int NUMBER_RESULTS(m_SwitchOutput.size());
938  unsigned int x(0);
939  double dOutput(0.0);
940 
941 
942  // set first or second input depending on input
943  dOutput = (m_bUseInput1() ? m_dInput1() : m_dInput2());
944 
945  // set result in all connected outputs
946  for (x = 0; x < NUMBER_RESULTS; x++)
947  {
948  // set result in current output
949  *m_SwitchOutput[x] = dOutput;
950 
951  } // for (x = 0; x < NUMBER_RESULTS; x++)
952  // Bouml preserved body end 0005B202
953 
954 } // void CDoubleSwitch::Calculate() throw(::oETCS::DF::Error::CException)
955 
956 
957 
958 
960 :CFunctionBlock(pStateMachine),
961  m_GateInput(""),
962  m_bOpen(false)
963 {
964  // Bouml preserved body begin 0005A882
965  // empty constructor
966  // Bouml preserved body end 0005A882
967 
968 } // CStringGate::CStringGate() throw()
969 
970 
971 
972 
974 {
975  // Bouml preserved body begin 0005A902
976  // empty destructor
977  // Bouml preserved body end 0005A902
978 
979 } // CStringGate::~CStringGate() throw()
980 
981 
982 
983 
984 void CStringGate::Calculate() throw(::oETCS::DF::Error::CException)
985 {
986  // Bouml preserved body begin 0005AB02
987  const unsigned int NUMBER_RESULTS(m_GateOutput.size());
988  unsigned int x(0);
989 
990 
991  // check, if gate is opened
992  if (m_bOpen())
993  {
994  // set result in all connected outputs
995  for (x = 0; x < NUMBER_RESULTS; x++)
996  {
997  // set result in current output
998  *m_GateOutput[x] = m_GateInput();
999 
1000  } // for (x = 0; x < NUMBER_RESULTS; x++)
1001 
1002  } // if (m_bOpen())
1003  // Bouml preserved body end 0005AB02
1004 
1005 } // void CStringGate::Calculate() throw(::oETCS::DF::Error::CException)
1006 
1007 
1008 
1009 
1011 :CFunctionBlock(pStateMachine),
1012  m_GradientDistances(::std::vector< double >(0)),
1013  m_GradientValues(::std::vector< double >(0)),
1014  m_dCurrentAbsoluteDistance(0.0),
1015  m_dCurrentVelocity(0.0),
1016  m_dDistanceOfPermittedVelocity(0.0),
1017  m_dPermittedVelocity(0.0),
1018  m_dAdhesionFactor(1.0)
1019 {
1020  // Bouml preserved body begin 00059602
1021  // empty constructor
1022  // Bouml preserved body end 00059602
1023 
1024 } // CBrakingToTargetSpeed::CBrakingToTargetSpeed() throw()
1025 
1026 
1027 
1028 
1030 {
1031  // Bouml preserved body begin 00059682
1032  // empty destructor
1033  // Bouml preserved body end 00059682
1034 
1035 } // CBrakingToTargetSpeed::~CBrakingToTargetSpeed() throw()
1036 
1037 
1038 
1039 
1040 void CBrakingToTargetSpeed::Calculate() throw(::oETCS::DF::Error::CException)
1041 {
1042  // Bouml preserved body begin 00059882
1043  double dAccelration(0.0);
1044  double dBrakeIntensity(0.0);
1045  const double HARD_LIMIT(1.05 * m_dPermittedVelocity() * m_dAdhesionFactor());
1046  const double SOFT_LIMIT(m_dPermittedVelocity() * m_dAdhesionFactor());
1047  const long double FRICTION_COEFICIENT(0.25);
1048  const long double GRAVITATION_ACCELERATION(9.81);
1049  const double V0(m_dCurrentVelocity());
1050  const double V1(m_dPermittedVelocity());
1052  const double MAXIMAL_ACCELRATION(FRICTION_COEFICIENT * GRAVITATION_ACCELERATION * m_dAdhesionFactor());
1053  decltype (m_ServiceBrakeValue.begin()) sv;
1054  decltype (m_ServiceBrakeApplied.begin()) sa;
1055  decltype (m_EmergencyBrakeValue.begin()) ev;
1056  decltype (m_EmergencyBrakeApplied.begin()) ea;
1057  decltype (m_SpeedWarning.begin()) sw;
1058  bool bSpeedWarning(false);
1059  bool bServiceApplied(false);
1060  bool bEmergencyApplied(false);
1061 
1062 
1063 
1064  // check, if current speed is over hard limit
1065  if (m_dCurrentVelocity() > HARD_LIMIT)
1066  {
1067  // calculate negative acceleration for this time point
1068  dAccelration = (V0 - V1) * (3 * V0 - V1) / (2 * S1);
1069 
1070  // calculate brake intensity in [%] by acceleration ratio
1071  dBrakeIntensity = dAccelration / MAXIMAL_ACCELRATION * 100.0;
1072 
1073  // check, if brake intensity is greater than 100%
1074  if (dBrakeIntensity > 100.0)
1075  {
1076  // reset brake intensity to 100%, more are not allowed
1077  dBrakeIntensity = 100.0;
1078 
1079  // set service brake activation flag to true
1080  bServiceApplied = true;
1081 
1082  // also activate emergency brake, because target speed cannot be met
1083  bEmergencyApplied = true;
1084 
1085  // set speed warning flag to true
1086  bSpeedWarning = true;
1087 
1088  } // if (dBrakeIntensity > 100.0)
1089  else if (dBrakeIntensity < 1.0)
1090  {
1091  // small brake intensities are ignored due to granularity of control
1092  dBrakeIntensity = 0.0;
1093 
1094  } // else if (dBrakeIntensity < 1.0)
1095  else
1096  {
1097  // set service brake activation flag to true
1098  bServiceApplied = true;
1099 
1100  // set speed warning flag to true
1101  bSpeedWarning = true;
1102 
1103  } // else
1104 
1105  } // if (m_dCurrentVelocity() > HARD_LIMIT)
1106  else if (m_dCurrentVelocity() <= HARD_LIMIT && m_dCurrentVelocity() > SOFT_LIMIT)
1107  {
1108  // set speed warning flag to true
1109  bSpeedWarning = true;
1110 
1111  } // else if (m_dCurrentVelocity() <= HARD_LIMIT && m_dCurrentVelocity() > SOFT_LIMIT)
1112 
1113 
1114 
1115  // copy brake intensity to all service brakes
1116  for (sv = m_ServiceBrakeValue.begin(); sv != m_ServiceBrakeValue.end(); sv++)
1117  {
1118  // copy value to current element
1119  **sv = dBrakeIntensity;
1120 
1121  } // for (sv = m_ServiceBrakeValue.begin(); sv != m_ServiceBrakeValue.end(); sv++)
1122 
1123  // copy brake activation to all service emergency brakes
1124  for (ev = m_EmergencyBrakeValue.begin(); ev != m_EmergencyBrakeValue.end(); ev++)
1125  {
1126  // copy value to current element
1127  **ev = bEmergencyApplied;
1128 
1129  } // for (ev = m_EmergencyBrakeValue.begin(); ev != m_EmergencyBrakeValue.end(); ev++)
1130 
1131  // copy speed warning to all outputs
1132  for (sw = m_SpeedWarning.begin(); sw != m_SpeedWarning.end(); sw++)
1133  {
1134  // copy value to current output
1135  **sw = bSpeedWarning;
1136 
1137  } // for (sw = m_SpeedWarning.begin(); sw != m_SpeedWarning.end(); sw++)
1138 
1139  // copy service brake applied flag to all outputs
1140  for (sa = m_ServiceBrakeApplied.begin(); sa != m_ServiceBrakeApplied.end(); sa++)
1141  {
1142  // copy value to current output
1143  **sa = bServiceApplied;
1144 
1145  } // for (sa = m_ServiceBrakeApplied.begin(); sa != m_ServiceBrakeApplied.end(); sa++)
1146 
1147  // copy emergency brake applied flag to all outputs
1148  for (ea = m_EmergencyBrakeApplied.begin(); ea != m_EmergencyBrakeApplied.end(); ea++)
1149  {
1150  // copy value to current output
1151  **ea = bEmergencyApplied;
1152 
1153  } // for (ea = m_EmergencyBrakeApplied.begin(); ea != m_EmergencyBrakeApplied.end(); ea++)
1154  // Bouml preserved body end 00059882
1155 
1156 } // void CBrakingToTargetSpeed::Calculate() throw(::oETCS::DF::Error::CException)
1157 
1158 
1159 
1160 
1162 :CFunctionBlock(pStateMachine),
1163  m_GradientDistances(::std::vector< double >(0)),
1164  m_GradientValues(::std::vector< double >(0)),
1165  m_dCurrentAbsoluteDistance(0.0),
1166  m_dCurrentVelocity(0.0),
1167  m_dPermittedVelocity(0.0),
1168  m_dAdhesionFactor(1.0)
1169 {
1170  // Bouml preserved body begin 000BB282
1171  // empty constructor
1172  // Bouml preserved body end 000BB282
1173 
1174 } // CCeelingSpeedControl::CCeelingSpeedControl() throw()
1175 
1176 
1177 
1178 
1180 {
1181  // Bouml preserved body begin 000BB302
1182  // empty destructor
1183  // Bouml preserved body end 000BB302
1184 
1185 } // CCeelingSpeedControl::~CCeelingSpeedControl() throw()
1186 
1187 
1188 
1189 
1190 void CCeelingSpeedControl::Calculate() throw(::oETCS::DF::Error::CException)
1191 {
1192  // Bouml preserved body begin 000BB382
1193  double dBrakeIntensity(0.0);
1194  const double HARD_LIMIT(1.05 * m_dPermittedVelocity() * m_dAdhesionFactor());
1195  const double SOFT_LIMIT(m_dPermittedVelocity() * m_dAdhesionFactor());
1196  decltype (m_ServiceBrakeValue.begin()) sv;
1197  decltype (m_ServiceBrakeApplied.begin()) sa;
1198  decltype (m_EmergencyBrakeValue.begin()) ev;
1199  decltype (m_EmergencyBrakeApplied.begin()) ea;
1200  decltype (m_SpeedWarning.begin()) sw;
1201  bool bSpeedWarning(false);
1202  bool bServiceApplied(false);
1203  bool bEmergencyApplied(false);
1204 
1205 
1206 
1207  // compare current speed with ceeling speed with limits
1208  if (m_dCurrentVelocity() > HARD_LIMIT)
1209  {
1210  // check, if any service brake is connected
1211  if (not m_ServiceBrakeValue.empty())
1212  {
1213  // calculate brake intensity
1214  dBrakeIntensity = (m_dCurrentVelocity() - SOFT_LIMIT) / SOFT_LIMIT * 2.0 * 100.0;
1215 
1216  // check, if brake intensity is greater than 100%
1217  if (dBrakeIntensity > 100.0)
1218  {
1219  // reset brake intensity to 100%, more are not allowed
1220  dBrakeIntensity = 100.0;
1221 
1222  // also activate emergency brake, because target speed cannot be met
1223  bEmergencyApplied = true;
1224 
1225  } // if (dBrakeIntensity > 100.0)
1226  else if (dBrakeIntensity < 0.1)
1227  {
1228  // small brake intensities are ignored due to granularity of control
1229  dBrakeIntensity = 0.0;
1230 
1231  } // else if (dBrakeIntensity < 0.1)
1232 
1233  // set service brake applied flag to true
1234  bServiceApplied = true;
1235 
1236  } // if (not m_ServiceBrakeValue.empty())
1237  else
1238  {
1239  // set emergency applied flag to true;
1240  bEmergencyApplied = true;
1241 
1242  } // else
1243 
1244  // set speed warning to true
1245  bSpeedWarning = true;
1246 
1247  } // if (m_dCurrentVelocity() > HARD_LIMIT)
1248  else if (m_dCurrentVelocity() <= HARD_LIMIT && m_dCurrentVelocity() > SOFT_LIMIT)
1249  {
1250  // only set speed warning to true
1251  bSpeedWarning = true;
1252 
1253  } // else if (m_dCurrentVelocity() <= HARD_LIMIT && m_dCurrentVelocity() > SOFT_LIMIT)
1254 
1255 
1256 
1257 
1258  // copy brake intensity to all service brakes
1259  for (sv = m_ServiceBrakeValue.begin(); sv != m_ServiceBrakeValue.end(); sv++)
1260  {
1261  // copy value to current element
1262  **sv = dBrakeIntensity;
1263 
1264  } // for (sv = m_ServiceBrakeValue.begin(); sv != m_ServiceBrakeValue.end(); sv++)
1265 
1266  // copy brake activation to all service emergency brakes
1267  for (ev = m_EmergencyBrakeValue.begin(); ev != m_EmergencyBrakeValue.end(); ev++)
1268  {
1269  // copy value to current element
1270  **ev = bEmergencyApplied;
1271 
1272  } // for (ev = m_EmergencyBrakeValue.begin(); ev != m_EmergencyBrakeValue.end(); ev++)
1273 
1274  // copy speed warning to all outputs
1275  for (sw = m_SpeedWarning.begin(); sw != m_SpeedWarning.end(); sw++)
1276  {
1277  // copy value to current output
1278  **sw = bSpeedWarning;
1279 
1280  } // for (sw = m_SpeedWarning.begin(); sw != m_SpeedWarning.end(); sw++)
1281 
1282  // copy service brake applied flag to all outputs
1283  for (sa = m_ServiceBrakeApplied.begin(); sa != m_ServiceBrakeApplied.end(); sa++)
1284  {
1285  // copy value to current output
1286  **sa = bServiceApplied;
1287 
1288  } // for (sa = m_ServiceBrakeApplied.begin(); sa != m_ServiceBrakeApplied.end(); sa++)
1289 
1290  // copy emergency brake applied flag to all outputs
1291  for (ea = m_EmergencyBrakeApplied.begin(); ea != m_EmergencyBrakeApplied.end(); ea++)
1292  {
1293  // copy value to current output
1294  **ea = bEmergencyApplied;
1295 
1296  } // for (ea = m_EmergencyBrakeApplied.begin(); ea != m_EmergencyBrakeApplied.end(); ea++)
1297  // Bouml preserved body end 000BB382
1298 
1299 } // void CCeelingSpeedControl::Calculate() throw(::oETCS::DF::Error::CException)
1300 
1301 
1302 
1303 
1305 :CFunctionBlock(pStateMachine)
1306 {
1307  // Bouml preserved body begin 0005B602
1308  // empty constructor
1309  // Bouml preserved body end 0005B602
1310 
1311 } // CEnteredTrigger::CEnteredTrigger() throw()
1312 
1313 
1314 
1315 
1317 {
1318  // Bouml preserved body begin 0005B682
1319  // empty destructor
1320  // Bouml preserved body end 0005B682
1321 
1322 } // CEnteredTrigger::~CEnteredTrigger() throw()
1323 
1324 
1325 
1326 
1327 void CEnteredTrigger::Calculate() throw(::oETCS::DF::Error::CException)
1328 {
1329  // Bouml preserved body begin 0005B902
1330  const unsigned int NUMBER_RESULTS(m_Entered.size());
1331  unsigned int x(0);
1332 
1333 
1334  // set result in all connected outputs
1335  for (x = 0; x < NUMBER_RESULTS; x++)
1336  {
1337  // set result in current output
1339 
1340  } // for (x = 0; x < NUMBER_RESULTS; x++)
1341  // Bouml preserved body end 0005B902
1342 
1343 } // void CEnteredTrigger::Calculate() throw(::oETCS::DF::Error::CException)
1344 
1345 
1346 
1347 
1348 /*!
1349  * \brief class global flag for a newly entered data flow
1350  */
1352 
1353 
1354 
1356 :CFunctionBlock(pStateMachine),
1357  m_Input1(""),
1358  m_Input2(""),
1359  m_bUseInput1(false)
1360 {
1361  // Bouml preserved body begin 0005B282
1362  // empty constructor
1363  // Bouml preserved body end 0005B282
1364 
1365 } // CStringSwitch::CStringSwitch() throw()
1366 
1367 
1368 
1369 
1371 {
1372  // Bouml preserved body begin 0005B302
1373  // empty destructor
1374  // Bouml preserved body end 0005B302
1375 
1376 } // CStringSwitch::~CStringSwitch() throw()
1377 
1378 
1379 
1380 
1381 void CStringSwitch::Calculate() throw(::oETCS::DF::Error::CException)
1382 {
1383  // Bouml preserved body begin 0005B582
1384  const unsigned int NUMBER_RESULTS(m_SwitchOutput.size());
1385  unsigned int x(0);
1386  ::std::string Output;
1387 
1388 
1389  // set first or second input depending on input
1390  Output = (m_bUseInput1() ? m_Input1() : m_Input2());
1391 
1392  // set result in all connected outputs
1393  for (x = 0; x < NUMBER_RESULTS; x++)
1394  {
1395  // set result in current output
1396  *m_SwitchOutput[x] = Output;
1397 
1398  } // for (x = 0; x < NUMBER_RESULTS; x++)
1399  // Bouml preserved body end 0005B582
1400 
1401 } // void CStringSwitch::Calculate() throw(::oETCS::DF::Error::CException)
1402 
1403 
1404 
1405 
1406 CIntEqual::CIntEqual(oETCS::DF::CEVCStateMachine * const pStateMachine) throw()
1407 :CFunctionBlock(pStateMachine),
1408  m_iInput1(0),
1409  m_iInput2(0)
1410 {
1411  // Bouml preserved body begin 00055202
1412  // empty constructor
1413  // Bouml preserved body end 00055202
1414 
1415 } // CIntEqual::CIntEqual() throw()
1416 
1417 
1418 
1419 
1421 {
1422  // Bouml preserved body begin 00055282
1423  // empty constructor
1424  // Bouml preserved body end 00055282
1425 
1426 } // CIntEqual::~CIntEqual() throw()
1427 
1428 
1429 
1430 
1431 void CIntEqual::Calculate() throw(::oETCS::DF::Error::CException)
1432 {
1433  // Bouml preserved body begin 00055482
1434  const unsigned int NUMBER_RESULTS(m_Equal.size());
1435  unsigned int x(0);
1436  bool bEqual(false);
1437 
1438 
1439  // compute calculation result
1440  bEqual = (m_iInput1() == m_iInput2());
1441 
1442  // set result in all connected outputs
1443  for (x = 0; x < NUMBER_RESULTS; x++)
1444  {
1445  // set result in current output
1446  *m_Equal[x] = bEqual;
1447 
1448  } // for (x = 0; x < NUMBER_RESULTS; x++)
1449  // Bouml preserved body end 00055482
1450 
1451 } // void CIntEqual::Calculate() throw(::oETCS::DF::Error::CException)
1452 
1453 
1454 
1455 
1456 CComBlockIn::CComBlockIn(oETCS::DF::CEVCStateMachine * const pStateMachine, const ::std::vector< oETCS::DF::CBaliseDeviceIn * >& InDevices, const ::std::vector< unsigned char > & PacketIDs) throw()
1457 :CFunctionBlock(pStateMachine),
1458  m_PacketIDs(PacketIDs),
1459  m_InDevices(InDevices)
1460 {
1461  // Bouml preserved body begin 00059E82
1462  // empty constructor
1463  // Bouml preserved body end 00059E82
1464 
1465 } // CComBlockIn::CComBlockIn() throw()
1466 
1467 
1468 
1469 
1471 {
1472  // Bouml preserved body begin 00059F02
1473  unsigned int x(0);
1474 
1475 
1476  // delete all in devices
1477  for (x = 0; x < m_InDevices.size(); x++)
1478  {
1479  // delete current device
1480  delete m_InDevices[x];
1481 
1482  } // for (x = 0; x < m_InDevices.size(); x++)
1483  // Bouml preserved body end 00059F02
1484 
1485 } // CComBlockIn::~CComBlockIn() throw()
1486 
1487 
1488 
1489 
1490 void CComBlockIn::Calculate() throw(::oETCS::DF::Error::CException)
1491 {
1492  // Bouml preserved body begin 00059F82
1493  const unsigned int NUMBER_RESULTS(m_Received.size());
1494  const unsigned int NUMBER_DEVICES(m_InDevices.size());
1495  unsigned int x(0);
1496  bool bTelegramReceived(false);
1497  ::std::vector< unsigned char > IDs;
1498  decltype (m_PacketIDs.begin()) vid;
1499  decltype (IDs.begin()) id;
1500 
1501 
1502  // get result from all included devices
1503  for (x = 0; x < NUMBER_DEVICES; x++)
1504  {
1505  // get received flag from current device
1506  IDs = m_InDevices[x]->HasNewTelegram();
1507 
1508  // check, if any ID in current telegram is valid
1509  for (id = IDs.begin(); id != IDs.end() && not bTelegramReceived; id++)
1510  {
1511  // check all valid packet IDs
1512  for (vid = m_PacketIDs.begin(); vid != m_PacketIDs.end(); vid++)
1513  {
1514  // compare current packet IDs
1515  bTelegramReceived |= (*id == *vid);
1516 
1517  } // for (vid = m_PacketIDs.begin(); vid != m_PacketIDs.end(); vid++)
1518 
1519  } // for (id = IDs.begin(); id != IDs.end() && not bTelegramReceived; id++)
1520 
1521 
1522 
1523  } // for (x = 0; x < NUMBER_DEVICES; x++)
1524 
1525  // set result in all connected outputs
1526  for (x = 0; x < NUMBER_RESULTS; x++)
1527  {
1528  // set result in current output
1529  *m_Received[x] = bTelegramReceived;
1530 
1531  } // for (x = 0; x < NUMBER_RESULTS; x++)
1532  // Bouml preserved body end 00059F82
1533 
1534 } // void CComBlockIn::Calculate() throw(::oETCS::DF::Error::CException)
1535 
1536 
1537 
1538 
1539 void CComBlockIn::Clear() throw()
1540 {
1541  // Bouml preserved body begin 000FE282
1542  decltype (m_InDevices.begin()) id;
1543 
1544  // process all connected in devices
1545  for (id = m_InDevices.begin(); id != m_InDevices.end(); id++)
1546  {
1547  // clear all bit arrays from balise in device
1548  (*id)->Clear();
1549 
1550  } // for (id = m_InDevices.begin(); id != m_InDevices.end(); id++)
1551  // Bouml preserved body end 000FE282
1552 
1553 } // void CComBlockIn::Clear() throw()
1554 
1555 
1556 
1557 
1558 CComBlockOut::CComBlockOut(oETCS::DF::CEVCStateMachine * const pStateMachine, const ::std::vector< oETCS::DF::CBaliseDeviceOut * >& OutDevices) throw()
1559 :CFunctionBlock(pStateMachine),
1560  m_bSendTelegram(false),
1561  m_OutDevices(OutDevices)
1562 {
1563  // Bouml preserved body begin 0005A082
1564  // empty constructor
1565  // Bouml preserved body end 0005A082
1566 
1567 } // CComBlockOut::CComBlockOut() throw()
1568 
1569 
1570 
1571 
1573 {
1574  // Bouml preserved body begin 0005A102
1575  unsigned int x(0);
1576 
1577 
1578 
1579  // delete all out devices
1580  for (x = 0; x < m_OutDevices.size(); x++)
1581  {
1582  // delete current device
1583  delete m_OutDevices[x];
1584 
1585  } // for (x = 0; x < m_OutDevices.size(); x++)
1586  // Bouml preserved body end 0005A102
1587 
1588 } // CComBlockOut::~CComBlockOut() throw()
1589 
1590 
1591 
1592 
1593 void CComBlockOut::Calculate() throw(::oETCS::DF::Error::CException)
1594 {
1595  // Bouml preserved body begin 0005A182
1596  const unsigned int NUMBER_DEVICES(m_OutDevices.size());
1597  unsigned int x(0);
1598 
1599 
1600  // check, if send input is true
1601  if (m_bSendTelegram())
1602  {
1603  // process all out devices
1604  for (x = 0; x < NUMBER_DEVICES; x++)
1605  {
1606  // execute sending via current device
1607  m_OutDevices[x]->SendTelegram();
1608 
1609  } // for (x = 0; x < NUMBER_DEVICES; x++)
1610 
1611  } // if (m_bSendTelegram())
1612  // Bouml preserved body end 0005A182
1613 
1614 } // void CComBlockOut::Calculate() throw(::oETCS::DF::Error::CException)
1615 
1616 
1617 
1618 
1619 CDMIInput::CDMIInput(oETCS::DF::CEVCStateMachine * const pStateMachine, const oETCS::DF::DATA_T & eType, const ::std::string & Label, const bool & bInitialVisible) throw()
1620 :CFunctionBlock(pStateMachine),
1621  m_bBool(false),
1622  m_dDouble(0.0),
1623  m_iInt(0),
1624  m_String(""),
1625  m_bVisible(bInitialVisible),
1626  m_Label(Label),
1627  m_eType(eType)
1628 {
1629  // Bouml preserved body begin 0005D702
1630  // empty constructor
1631  // Bouml preserved body end 0005D702
1632 
1633 } // CDMIInput::CDMIInput() throw()
1634 
1635 
1636 
1637 
1639 {
1640  // Bouml preserved body begin 0005D782
1641  // empty destructor
1642  // Bouml preserved body end 0005D782
1643 
1644 } // CDMIInput::~CDMIInput() throw()
1645 
1646 
1647 
1648 
1649 void CDMIInput::Calculate() throw(::oETCS::DF::Error::CException)
1650 {
1651  // Bouml preserved body begin 0005D682
1652  decltype (m_BoolMessage.begin()) b(0);
1653  decltype (m_IntMessage.begin()) i(0);
1654  decltype (m_DoubleMessage.begin()) d(0);
1655  decltype (m_StringMessage.begin()) s(0);
1656  decltype (m_EnteredData.begin()) e(0);
1657  bool bDataEntered(false);
1658 
1659 
1660 
1661  // check data type used for this instance
1662  switch (m_eType)
1663  {
1665 
1666  // copy input value to all outputs
1667  for (b = m_BoolMessage.begin(); b != m_BoolMessage.end(); b++)
1668  {
1669  // copy value to current output
1670  **b = m_bBool();
1671 
1672  } // for (b = m_BoolMessage.begin(); b != m_BoolMessage.end(); b++)
1673 
1674  // set data entered flag from input
1675  bDataEntered = m_bBool.IsModified();
1676 
1677  break;
1678 
1679 
1681 
1682  // copy input value to all outputs
1683  for (i = m_IntMessage.begin(); i != m_IntMessage.end(); i++)
1684  {
1685  // copy value to current output
1686  **i = m_iInt();
1687 
1688  } // for (i = m_IntMessage.begin(); i != m_IntMessage.end(); i++)
1689 
1690  // set data entered flag from input
1691  bDataEntered = m_iInt.IsModified();
1692 
1693  break;
1694 
1695 
1697 
1698  // copy input value to all outputs
1699  for (d = m_DoubleMessage.begin(); d != m_DoubleMessage.end(); d++)
1700  {
1701  // copy value to current output
1702  **d = m_dDouble();
1703 
1704  } // for (d = m_DoubleMessage.begin(); d != m_DoubleMessage.end(); d++)
1705 
1706  // set data entered flag from input
1707  bDataEntered = m_dDouble.IsModified();
1708 
1709  break;
1710 
1711 
1713 
1714  // copy input value to all outputs
1715  for (s = m_StringMessage.begin(); s != m_StringMessage.end(); s++)
1716  {
1717  // copy value to current output
1718  **s = m_String();
1719 
1720  } // for (s = m_StringMessage.begin(); s != m_StringMessage.end(); s++)
1721 
1722  // set data entered flag from input
1723  bDataEntered = m_String.IsModified();
1724 
1725  break;
1726 
1727 
1729 
1730  // not (yet) implemented
1731 
1732  break;
1733 
1734  } // switch (m_eType)
1735 
1736 
1737  // copy all data entered flag to all outputs
1738  for (e = m_EnteredData.begin(); e != m_EnteredData.end(); e++)
1739  {
1740  // copy value to current output
1741  **e = bDataEntered;
1742 
1743  } // for (e = m_EnteredData.begin(); e != m_EnteredData.end(); e++)
1744 
1745  // Bouml preserved body end 0005D682
1746 
1747 } // void CDMIInput::Calculate() throw(::oETCS::DF::Error::CException)
1748 
1749 
1750 
1751 
1752 CDMIOutput::CDMIOutput(oETCS::DF::CEVCStateMachine * const pStateMachine, const oETCS::DF::DATA_T & eType, const ::std::string& Label, const bool & bInitialVisible) throw()
1753 :CFunctionBlock(pStateMachine),
1754  m_bBoolMessage(false),
1755  m_dDoubleMessage(0.0),
1756  m_DoubleArrayMessage(::std::vector< double >(0)),
1757  m_iIntMessage(0),
1758  m_StringMessage(""),
1759  m_bVisible(bInitialVisible),
1760  m_Label(Label),
1761  m_eType(eType)
1762 {
1763  // Bouml preserved body begin 0005D282
1764  // empty constructor
1765  // Bouml preserved body end 0005D282
1766 
1767 } // CDMIOutput::CDMIOutput() throw()
1768 
1769 
1770 
1771 
1773 {
1774  // Bouml preserved body begin 0005D302
1775  // empty destructor
1776  // Bouml preserved body end 0005D302
1777 
1778 } // CDMIOutput::~CDMIOutput() throw()
1779 
1780 
1781 
1782 
1783 void CDMIOutput::Calculate() throw(::oETCS::DF::Error::CException)
1784 {
1785  // Bouml preserved body begin 0005D602
1786  bool bModified(false);
1787 
1788 
1789 
1790  // check data type used for this instance
1791  switch (m_eType)
1792  {
1794 
1795  // check, if input was changed
1796  bModified = m_bBoolMessage.IsModified();
1797 
1798  break;
1799 
1800 
1802 
1803  // check, if input was changed
1804  bModified = m_iIntMessage.IsModified();
1805 
1806  break;
1807 
1808 
1810 
1811  // check, if input was changed
1812  bModified = m_dDoubleMessage.IsModified();
1813 
1814  break;
1815 
1816 
1818 
1819  // check, if input was changed
1820  bModified = m_StringMessage.IsModified();
1821 
1822  break;
1823 
1824 
1826 
1827  // check, if input was changed
1828  bModified = m_DoubleArrayMessage.IsModified();
1829 
1830  break;
1831 
1832  } // switch (m_eType)
1833 
1834 
1835  // check, if the relevant input was modified
1836  if (bModified)
1837  {
1838  // notify all observers via the parent EVC state object
1840 
1841  } // if (bModified)
1842  // Bouml preserved body end 0005D602
1843 
1844 } // void CDMIOutput::Calculate() throw(::oETCS::DF::Error::CException)
1845 
1846 
1847 
1848 
1849 
1850 
1851 } // namespace oETCS::DF
1852 
1853 } // namespace oETCS

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.