26 #include "../DF/FunctionBlocks.h"
27 #include "../DF/Condition.h"
28 #include "../DF/Storage.h"
29 #include "../DF/ControlFlow.h"
30 #include "../../DSM/GOPPRRTransformer.h"
31 #include "../../GOPPRR/ConstraintChecker.h"
32 #include "../GEN/CPPGenerator.h"
65 m_pDoubleEqualOrGreater(0),
68 m_pDoubleArrayAccessor(0),
70 m_pBrakingToTargetSpeed(0),
71 m_pCeelingSpeedControl(0),
85 m_DoubleArrayInput(::std::vector<
double >(0)),
133 pPacket = new ::oETCS::DF::CPacket(&
m_StateMachine, 5, ::std::vector< ::oETCS::DF::CVariable* >(1, pVariable));
134 pTelegram = new ::oETCS::DF::CTelegram(&
m_StateMachine,::std::vector< ::oETCS::DF::CVariable* >(1, pHeader), ::std::vector< ::oETCS::DF::CPacket* >(1, pPacket));
135 pBaliseIn = new ::oETCS::DF::CBaliseDeviceIn(::std::vector< ::oETCS::DF::CTelegram* >(1, pTelegram));
136 pBaliseOut = new ::oETCS::DF::CBaliseDeviceOut(::std::vector< ::oETCS::DF::CTelegram* >(1, pTelegram));
234 CPPUNIT_ASSERT_MESSAGE(
"boolean and operation failed",
m_bBoolInput() ==
true);
244 CPPUNIT_ASSERT_MESSAGE(
"boolean and operation failed",
m_bBoolInput() ==
false);
257 CPPUNIT_ASSERT_MESSAGE(
"boolean and operation failed",
m_bBoolInput() ==
false);
270 CPPUNIT_ASSERT_MESSAGE(
"boolean and operation failed",
m_bBoolInput() ==
false);
292 CPPUNIT_ASSERT_MESSAGE(
"boolean or operation failed",
m_bBoolInput() ==
true);
305 CPPUNIT_ASSERT_MESSAGE(
"boolean or operation failed",
m_bBoolInput() ==
true);
318 CPPUNIT_ASSERT_MESSAGE(
"boolean or operation failed",
m_bBoolInput() ==
true);
331 CPPUNIT_ASSERT_MESSAGE(
"boolean or operation failed",
m_bBoolInput() ==
false);
353 CPPUNIT_ASSERT_MESSAGE(
"boolean exclusive or operation failed",
m_bBoolInput() ==
false);
366 CPPUNIT_ASSERT_MESSAGE(
"boolean exclusive or operation failed",
m_bBoolInput() ==
true);
379 CPPUNIT_ASSERT_MESSAGE(
"boolean exclusive or operation failed",
m_bBoolInput() ==
true);
392 CPPUNIT_ASSERT_MESSAGE(
"boolean exclusive or operation failed",
m_bBoolInput() ==
false);
413 CPPUNIT_ASSERT_MESSAGE(
"boolean not operation failed",
m_bBoolInput() ==
false);
425 CPPUNIT_ASSERT_MESSAGE(
"boolean not operation failed",
m_bBoolInput() ==
true);
436 const double ADDEND1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
437 const double ADDEND2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
438 const double ADDEND3(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
451 CPPUNIT_ASSERT_MESSAGE(
"addition of three double values failed",
m_dDoubleInput() == (ADDEND1 + ADDEND2 + ADDEND3));
462 const double MINUEND(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
463 const double SUBTRAHEND(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
475 CPPUNIT_ASSERT_MESSAGE(
"subtraction of double values failed",
m_dDoubleInput() == (MINUEND - SUBTRAHEND));
486 const double DIVIDEND(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
487 const double DIVISOR(200.0 *
double(rand()) /
double(RAND_MAX) + 0.1);
488 const double RESULT(DIVIDEND / DIVISOR);
500 CPPUNIT_ASSERT_MESSAGE(
"division of double values failed",
m_dDoubleInput() == RESULT);
511 const double MULTIPLICATOR1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
512 const double MULTIPLICATOR2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
513 const double MULTIPLICATOR3(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
514 const double RESULT(MULTIPLICATOR1 * MULTIPLICATOR2 * MULTIPLICATOR3);
527 CPPUNIT_ASSERT_MESSAGE(
"multiplication of three double factors failed", abs(
m_dDoubleInput() - RESULT) < 0.00001 );
538 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
539 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
551 CPPUNIT_ASSERT_MESSAGE(
"double equal computation failed",
m_bBoolInput() ==
false);
561 CPPUNIT_ASSERT_MESSAGE(
"double equal computation failed",
m_bBoolInput() ==
true);
572 const int VALUE1(rand());
573 const int VALUE2(rand());
585 CPPUNIT_ASSERT_MESSAGE(
"integer equal computation failed",
m_bBoolInput() ==
false);
595 CPPUNIT_ASSERT_MESSAGE(
"integer equal computation failed",
m_bBoolInput() ==
true);
607 ::std::string Value1;
608 ::std::string Value2;
613 for (x = 0; x < 20; x++)
616 Value1 += char(
double(rand()) /
double(RAND_MAX) * 94.0 + 32.0);
617 Value2 += char(
double(rand()) /
double(RAND_MAX) * 94.0 + 32.0);
632 CPPUNIT_ASSERT_MESSAGE(
"string equal computation failed",
m_bBoolInput() ==
false);
645 CPPUNIT_ASSERT_MESSAGE(
"string equal computation failed",
m_bBoolInput() ==
true);
656 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
657 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
669 CPPUNIT_ASSERT_MESSAGE(
"double equal or greater (>=) computation failed",
m_bBoolInput() == (VALUE1 >= VALUE2));
679 CPPUNIT_ASSERT_MESSAGE(
"double equal or greater (>=) computation failed",
m_bBoolInput() == (VALUE1 <= VALUE2));
689 CPPUNIT_ASSERT_MESSAGE(
"double equal or greater (>=) computation failed",
m_bBoolInput() ==
true);
700 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
701 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
713 CPPUNIT_ASSERT_MESSAGE(
"double greater computation failed",
m_bBoolInput() == (VALUE1 > VALUE2));
723 CPPUNIT_ASSERT_MESSAGE(
"double greater computation failed",
m_bBoolInput() == (VALUE1 < VALUE2));
734 const int VALUE1(rand());
735 const int VALUE2(rand());
747 CPPUNIT_ASSERT_MESSAGE(
"integer greater computation failed",
m_bBoolInput() == (VALUE1 > VALUE2));
757 CPPUNIT_ASSERT_MESSAGE(
"integer greater computation failed",
m_bBoolInput() == (VALUE1 < VALUE2));
768 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
769 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
770 const double VALUE3(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
771 ::std::vector< double> DoubleArray(3);
776 DoubleArray[0] = VALUE1;
777 DoubleArray[1] = VALUE2;
778 DoubleArray[2] = VALUE3;
788 CPPUNIT_ASSERT_MESSAGE(
"accessing of first element failed",
m_dDoubleInput() == VALUE1);
797 CPPUNIT_ASSERT_MESSAGE(
"accessing of second element failed",
m_dDoubleInput() == VALUE2);
806 CPPUNIT_ASSERT_MESSAGE(
"accessing of third/last element failed",
m_dDoubleInput() == VALUE3);
828 CPPUNIT_ASSERT_MESSAGE(
"closing of boolean gate failed",
m_bBoolInput() ==
false);
837 CPPUNIT_ASSERT_MESSAGE(
"opening of boolean gate failed",
m_bBoolInput() ==
true);
848 const double PERMITTED_VELOCITY(100.0);
849 const double VELOCITY(PERMITTED_VELOCITY * 0.90);
850 const double VELOCITY_SOFT(PERMITTED_VELOCITY * 1.025);
851 const double VELOCITY_HARD(PERMITTED_VELOCITY * 1.10);
852 const double VELOCITY_EMERGENCY(PERMITTED_VELOCITY * 2.0);
853 const double ADHESION_FACTOR(1.0);
854 const double ABSOLUTE_DISTANCE(1000.0);
855 const double ABSOLUTE_DISTANCE_TO_PERMITTED(ABSOLUTE_DISTANCE + 500.0);
870 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for permitted speed failed",
m_dDoubleInput() == 0.0);
871 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for permitted speed failed",
m_bBoolInput() ==
false);
872 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for permitted speed failed",
m_bBoolInput2() ==
false);
873 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag soft permitted speed failed",
m_bBoolInput3() ==
false);
874 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for permitted speed failed",
m_bBoolInput4() ==
false);
888 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for permitted speed failed",
m_dDoubleInput() == 0.0);
889 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for permitted speed failed",
m_bBoolInput() ==
false);
890 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for soft permitted speed failed",
m_bBoolInput2() ==
false);
891 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag soft permitted speed failed",
m_bBoolInput3() ==
false);
892 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for permitted speed failed",
m_bBoolInput4() ==
true);
906 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for speed over hard limit failed",
m_dDoubleInput() >= 1.0 &&
m_dDoubleInput() <= 100.0);
907 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for speed over hard limit failed",
m_bBoolInput() ==
false);
908 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for speed over hard limit failed",
m_bBoolInput2() ==
false);
909 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag for speed over hard limit failed",
m_bBoolInput3() ==
true);
910 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for speed over hard limit failed",
m_bBoolInput4() ==
true);
924 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for speed over emergency limit failed",
m_dDoubleInput() == 100.0);
925 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for speed over emergency limit failed",
m_bBoolInput() ==
true);
926 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for speed over emergency limit failed",
m_bBoolInput2() ==
true);
927 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag for speed over emergency limit failed",
m_bBoolInput3() ==
true);
928 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for speed over emergency limit failed",
m_bBoolInput4() ==
true);
939 const double PERMITTED_VELOCITY(100.0);
940 const double VELOCITY(PERMITTED_VELOCITY * 0.90);
941 const double VELOCITY_SOFT(PERMITTED_VELOCITY * 1.025);
942 const double VELOCITY_HARD(PERMITTED_VELOCITY * 1.10);
943 const double VELOCITY_EMERGENCY(PERMITTED_VELOCITY * 2.10);
944 const double ADHESION_FACTOR(1.0);
945 const double ABSOLUTE_DISTANCE(1000.0);
958 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for permitted speed failed",
m_dDoubleInput() == 0.0);
959 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for permitted speed failed",
m_bBoolInput() ==
false);
960 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for permitted speed failed",
m_bBoolInput2() ==
false);
961 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag soft permitted speed failed",
m_bBoolInput3() ==
false);
962 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for permitted speed failed",
m_bBoolInput4() ==
false);
975 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for soft permitted speed failed",
m_dDoubleInput() == 0.0);
976 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for soft permitted speed failed",
m_bBoolInput() ==
false);
977 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for soft permitted speed failed",
m_bBoolInput2() ==
false);
978 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag for soft permitted speed failed",
m_bBoolInput3() ==
false);
979 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for soft permitted speed failed",
m_bBoolInput4() ==
true);
991 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for speed over hard limit failed",
m_dDoubleInput() >= 1.0 &&
m_dDoubleInput() <= 100.0);
992 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for speed over hard limit failed",
m_bBoolInput() ==
false);
993 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for speed over hard limit failed",
m_bBoolInput2() ==
false);
994 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag for speed over hard limit failed",
m_bBoolInput3() ==
true);
995 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for speed over hard limit failed",
m_bBoolInput4() ==
true);
1007 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake intensity for speed over emergency limit failed",
m_dDoubleInput() == 100.0);
1008 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation for speed over emergency limit failed",
m_bBoolInput() ==
true);
1009 CPPUNIT_ASSERT_MESSAGE(
"calculation of emergency brake activation flag for speed over emergency limit failed",
m_bBoolInput2() ==
true);
1010 CPPUNIT_ASSERT_MESSAGE(
"calculation of service brake activation flag for speed over emergency limit failed",
m_bBoolInput3() ==
true);
1011 CPPUNIT_ASSERT_MESSAGE(
"calculation of speed warning flag for speed over emergency limit failed",
m_bBoolInput4() ==
true);
1023 ::std::string Value1;
1028 for (x = 0; x < 20; x++)
1031 Value1 += char(
double(rand()) /
double(RAND_MAX) * 94.0 + 32.0);
1046 CPPUNIT_ASSERT_MESSAGE(
"closing of string gate failed",
m_StringInput().empty());
1055 CPPUNIT_ASSERT_MESSAGE(
"opening of string gate failed",
m_StringInput() == Value1);
1066 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1067 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1082 CPPUNIT_ASSERT_MESSAGE(
"closing of double gate failed",
m_dDoubleInput() == VALUE2);
1091 CPPUNIT_ASSERT_MESSAGE(
"opening of double gate failed",
m_dDoubleInput() == VALUE1);
1114 CPPUNIT_ASSERT_MESSAGE(
"activating boolean switch failed",
m_bBoolInput() ==
true);
1123 CPPUNIT_ASSERT_MESSAGE(
"deactivating boolean switch failed",
m_bBoolInput() ==
false);
1134 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1135 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1136 const double VALUE3(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1152 CPPUNIT_ASSERT_MESSAGE(
"activating double switch failed",
m_dDoubleInput() == VALUE1);
1161 CPPUNIT_ASSERT_MESSAGE(
"deactivating double switch failed",
m_dDoubleInput() == VALUE2);
1173 ::std::string Value1;
1174 ::std::string Value2;
1179 for (x = 0; x < 20; x++)
1182 Value1 += char(
double(rand()) /
double(RAND_MAX) * 94.0 + 32.0);
1183 Value2 += char(
double(rand()) /
double(RAND_MAX) * 94.0 + 32.0);
1199 CPPUNIT_ASSERT_MESSAGE(
"activating string switch failed",
m_StringInput() == Value1);
1208 CPPUNIT_ASSERT_MESSAGE(
"deactivating string switch failed",
m_StringInput() == Value2);
1229 CPPUNIT_ASSERT_MESSAGE(
"setting of entered trigger failed",
m_bBoolInput() ==
false);
1238 CPPUNIT_ASSERT_MESSAGE(
"setting of entered trigger failed",
m_bBoolInput() ==
true);
1249 const double VALUE1(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1250 const double VALUE2(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1251 const double VALUE3(200.0 *
double(rand()) /
double(RAND_MAX) - 100.0);
1252 const int VALUE4(rand() - RAND_MAX / 2);
1253 const ::std::string VALUE5(
"3.14");
1254 ::std::stringstream Stream;
1255 ::std::vector< double > Array(2);
1266 Stream.str(::std::string());
1270 CPPUNIT_ASSERT_MESSAGE(
"copying of double failed",
m_dDoubleInput() == VALUE1);
1271 CPPUNIT_ASSERT_MESSAGE(
"double conversion to double array failed",
m_DoubleArrayInput().size() == 1);
1272 CPPUNIT_ASSERT_MESSAGE(
"double conversion to double array failed",
m_DoubleArrayInput()[0] == VALUE1);
1273 CPPUNIT_ASSERT_MESSAGE(
"double conversion to integer failed",
m_iIntInput() ==
int(VALUE1));
1274 CPPUNIT_ASSERT_MESSAGE(
"double conversion to string failed",
m_StringInput() == Stream.str());
1275 CPPUNIT_ASSERT_MESSAGE(
"double conversion to boolean failed",
m_bBoolInput() ==
bool(VALUE1));
1290 Stream.str(::std::string());
1294 CPPUNIT_ASSERT_MESSAGE(
"double array conversion to double failed",
m_dDoubleInput() == VALUE2);
1295 CPPUNIT_ASSERT_MESSAGE(
"copying of double array failed",
m_DoubleArrayInput().size() == 2);
1296 CPPUNIT_ASSERT_MESSAGE(
"copying of double array failed",
m_DoubleArrayInput()[0] == VALUE2);
1297 CPPUNIT_ASSERT_MESSAGE(
"copying of double array failed",
m_DoubleArrayInput()[1] == VALUE3);
1298 CPPUNIT_ASSERT_MESSAGE(
"double array conversion to integer failed",
m_iIntInput() ==
int(VALUE2));
1299 CPPUNIT_ASSERT_MESSAGE(
"double array conversion to string failed",
m_StringInput() == Stream.str());
1300 CPPUNIT_ASSERT_MESSAGE(
"copying of double array failed",
m_DoubleArrayInput() == Array);
1301 CPPUNIT_ASSERT_MESSAGE(
"double array conversion to boolean failed",
m_bBoolInput() ==
bool(VALUE2));
1312 Stream.str(::std::string());
1316 CPPUNIT_ASSERT_MESSAGE(
"integer conversion to double failed",
m_dDoubleInput() ==
double(VALUE4));
1317 CPPUNIT_ASSERT_MESSAGE(
"integer conversion to double array failed",
m_DoubleArrayInput().size() == 1);
1318 CPPUNIT_ASSERT_MESSAGE(
"integer conversion to double array failed",
m_DoubleArrayInput()[0] ==
double(VALUE4));
1319 CPPUNIT_ASSERT_MESSAGE(
"copying of integer failed",
m_iIntInput() == VALUE4);
1320 CPPUNIT_ASSERT_MESSAGE(
"integer conversion to string failed",
m_StringInput() == Stream.str());
1321 CPPUNIT_ASSERT_MESSAGE(
"integer conversion to boolean failed",
m_bBoolInput() ==
bool(VALUE4));
1332 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to double failed",
m_dDoubleInput() == 1.0);
1333 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to double array failed",
m_DoubleArrayInput().size() == 1);
1334 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to double array failed",
m_DoubleArrayInput()[0] == 1.0);
1335 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to integer failed",
m_iIntInput() == 1);
1336 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to string failed",
m_StringInput() ==
"true");
1337 CPPUNIT_ASSERT_MESSAGE(
"copying of boolean failed",
m_bBoolInput() ==
true);
1348 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to double failed",
m_dDoubleInput() == 0.0);
1349 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to double array failed",
m_DoubleArrayInput().size() == 1);
1350 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to double array failed",
m_DoubleArrayInput()[0] == 0.0);
1351 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to integer failed",
m_iIntInput() == 0);
1352 CPPUNIT_ASSERT_MESSAGE(
"boolean conversion to string failed",
m_StringInput() ==
"false");
1353 CPPUNIT_ASSERT_MESSAGE(
"copying of boolean failed",
m_bBoolInput() ==
false);
1364 CPPUNIT_ASSERT_MESSAGE(
"string conversion to double failed",
m_dDoubleInput() == 3.14);
1365 CPPUNIT_ASSERT_MESSAGE(
"string conversion to double array failed",
m_DoubleArrayInput().size() == 1);
1366 CPPUNIT_ASSERT_MESSAGE(
"string conversion to double array failed",
m_DoubleArrayInput()[0] == 3.14);
1367 CPPUNIT_ASSERT_MESSAGE(
"string conversion to integer failed",
m_iIntInput() == 3);
1368 CPPUNIT_ASSERT_MESSAGE(
"string conversion to boolean failed",
m_bBoolInput() ==
true);
1369 CPPUNIT_ASSERT_MESSAGE(
"copying of string failed",
m_StringInput() == VALUE5);
1442 ::std::vector< ::oETCS::DF::CVariable* > Variables1(3);
1443 ::std::vector< ::oETCS::DF::CVariable* > Variables2(3);
1444 Variables1[0] = pVariable0;
1445 Variables1[1] = pVariable3;
1446 Variables1[2] = pVariable2;
1447 Variables2[0] = pVariable4;
1448 Variables2[1] = pVariable6;
1449 Variables2[2] = pVariable5;
1454 ::std::vector< ::oETCS::DF::CPacket* > Packets(2);
1455 Packets[0] = pPacket1;
1456 Packets[1] = pPacket2;
1460 m_pTelegram = new ::oETCS::DF::CTelegram(&
m_StateMachine, ::std::vector< ::oETCS::DF::CVariable* >(1, pVariable1), Packets);
1485 const unsigned char* pByte(0);
1486 const unsigned char c8ID1(1);
1487 const unsigned char c8ID2(2);
1488 const int i8Scalor(3);
1489 const int i16Value(11);
1490 const int i8Iterator(2);
1491 const int i32Iterated1(234);
1492 const int i32Iterated2(567);
1493 unsigned long lOffset(0);
1494 const ::std::string
STRING(
"Hello World!");
1495 const unsigned long BIT_LENGTH((STRING.size() * 8) + 8 + 8 + 8 + 16 + 8 + (32 * 2));
1496 ::std::vector< bool > Bits(BIT_LENGTH, 0);
1497 const int SCALED_VALUE(i8Scalor * i16Value);
1498 const double ITERATED1(i32Iterated1 / 3.6);
1499 const double ITERATED2(i32Iterated2 / 3.6);
1504 for (x = 0; x < STRING.size(); x++)
1507 pByte =
reinterpret_cast< const unsigned char*
>(&STRING[x]);
1511 for (y = 0; y < 8; y++)
1514 Bits[(x * 8) + y] = ((1 << (7 - y)) & (*pByte));
1521 lOffset += STRING.size() * 8;
1524 pByte =
reinterpret_cast< const unsigned char*
>(&c8ID1);
1527 for (y = 0; y < 8; y++)
1530 Bits[lOffset + y] = ((1 << (7 - y)) & (*pByte));
1538 pByte =
reinterpret_cast< const unsigned char*
>(&i8Scalor);
1541 for (y = 0; y < 8; y++)
1544 Bits[lOffset + y] = ((1 << (7 - y)) & (*pByte));
1552 pByte =
reinterpret_cast< const unsigned char*
>(&i16Value) + 1;
1555 for (x = 0; x < 2; x++)
1558 for (y = 0; y < 8; y++)
1561 Bits[(x * 8) + y + lOffset] = ((1 << (7 - y)) & (*pByte));
1574 pByte =
reinterpret_cast< const unsigned char*
>(&c8ID2);
1577 for (y = 0; y < 8; y++)
1580 Bits[lOffset + y] = ((1 << (7 - y)) & (*pByte));
1588 pByte =
reinterpret_cast< const unsigned char*
>(&i8Iterator);
1591 for (y = 0; y < 8; y++)
1594 Bits[lOffset + y] = ((1 << (7 - y)) & (*pByte));
1602 pByte =
reinterpret_cast< const unsigned char*
>(&i32Iterated1) + 3;
1605 for (x = 0; x < 4; x++)
1608 for (y = 0; y < 8; y++)
1611 Bits[(x * 8) + y + lOffset] = ((1 << (7 - y)) & (*pByte));
1624 pByte =
reinterpret_cast< const unsigned char*
>(&i32Iterated2) + 3;
1627 for (x = 0; x < 4; x++)
1630 for (y = 0; y < 8; y++)
1633 Bits[(x * 8) + y + lOffset] = ((1 << (7 - y)) & (*pByte));
1647 CPPUNIT_ASSERT_MESSAGE(
"test precondition bit vector length not correct", lOffset == BIT_LENGTH);
1650 (*m_pTelegram) << Bits;
1653 CPPUNIT_ASSERT_MESSAGE(
"string message not corrected dispatched", (*
m_StringInput[
"Storage1"])() == STRING);
1656 CPPUNIT_ASSERT_MESSAGE(
"scaling not correct applied", (*
m_IntInput[
"Storage2"])() == SCALED_VALUE);
1659 CPPUNIT_ASSERT_MESSAGE(
"size of double array not correct", (*
m_DoubleArrayInput[
"Storage3"])().size() == (
unsigned)i8Iterator);
1660 CPPUNIT_ASSERT_MESSAGE(
"first iterated value of array false", (*
m_DoubleArrayInput[
"Storage3"])()[0] == ITERATED1);
1661 CPPUNIT_ASSERT_MESSAGE(
"first iterated value of array false", (*
m_DoubleArrayInput[
"Storage3"])()[1] == ITERATED2);
1687 ::std::vector< ::oETCS::DF::CAbstractFlow* > PermanentTrueOutputs;
1690 ::std::vector< ::oETCS::DF::CFunctionBlock* > Flow1STMFBs(0);
1691 ::std::vector< ::oETCS::DF::CFunctionBlock* > Flow2STMFBs(0);
1692 ::std::vector< ::oETCS::DF::CFunctionBlock* > Flow3FFNFBs(0);
1693 ::std::vector< ::oETCS::DF::CAbstractFlow* > Connections1STM(0);
1694 ::std::vector< ::oETCS::DF::CAbstractFlow* > Connections2STM(0);
1695 ::std::vector< ::oETCS::DF::CAbstractFlow* > Connections3FFN(0);
1709 pFromSTMToFFN = new ::oETCS::DF::CLevelCondition(
m_pStateMachine,
"FFN");
1725 Flow1STMFBs.push_back(pPermanentTrue);
1726 Flow1STMFBs.push_back(pFrom1To2);
1727 Connections1STM.push_back(pPermanentTrue->
m_BoolValue[0]);
1729 Flow2STMFBs.push_back(pPermanentTrue);
1730 Flow2STMFBs.push_back(pFrom2To3);
1731 Flow2STMFBs.push_back(pFromSTMToFFN);
1732 Connections2STM.push_back(pPermanentTrue->
m_BoolValue[1]);
1733 Connections2STM.push_back(pPermanentTrue->
m_BoolValue[2]);
1739 new ::oETCS::DF::CEVCTransition(pFrom1To2, pState1, pState2, 0);
1740 new ::oETCS::DF::CEVCTransition(pFrom2To3, pState2, pState3, 1);
1771 ::std::this_thread::sleep_for(SLEEP_TIME);
1787 :m_bBoolInput(false),
1807 ::std::vector< ::oETCS::DF::CFunctionBlock* > State1FunctionBlocks(0);
1808 ::std::vector< ::oETCS::DF::CFunctionBlock* > State2FunctionBlocks(0);
1809 ::std::vector< ::oETCS::DF::CFunctionBlock* > State3FunctionBlocks(0);
1810 ::std::vector< ::oETCS::DF::CFunctionBlock* > DataFlowFunctionBlocks(0);
1811 ::std::vector< ::oETCS::DF::CAbstractFlow* > FlowsState1(0);
1812 ::std::vector< ::oETCS::DF::CAbstractFlow* > FlowsState2(0);
1813 ::std::vector< ::oETCS::DF::CAbstractFlow* > FlowsState3(0);
1814 ::std::vector< ::oETCS::DF::CAbstractFlow* > Flows(0);
1855 State1FunctionBlocks.push_back(pPermanentTrue);
1856 State1FunctionBlocks.push_back(pFrom1To2);
1857 FlowsState1.push_back(pPermanentTrue->
m_BoolValue[0]);
1858 pState1 = new ::oETCS::DF::CControlFlow::CState(pControlFlow,
"STATE 1", State1FunctionBlocks, FlowsState1,
false,
true);
1859 State2FunctionBlocks.push_back(pPermanentTrue);
1860 State2FunctionBlocks.push_back(pFrom2To3);
1861 FlowsState2.push_back(pPermanentTrue->
m_BoolValue[1]);
1862 pState2 = new ::oETCS::DF::CControlFlow::CState(pControlFlow,
"STATE 2", State2FunctionBlocks, FlowsState2);
1863 State3FunctionBlocks.push_back(pPermanentFalse);
1864 State3FunctionBlocks.push_back(pPermanentTrue);
1865 FlowsState3.push_back(pPermanentFalse->
m_BoolValue[0]);
1866 pState3 = new ::oETCS::DF::CControlFlow::CState(pControlFlow,
"FINAL STATE", State3FunctionBlocks, FlowsState3,
true);
1870 new ::oETCS::DF::CTransition(pEVCState1, pFrom1To2, pState1, pState2, 0);
1871 new ::oETCS::DF::CTransition(pEVCState1, pFrom2To3, pState2, pState3, 0);
1875 DataFlowFunctionBlocks.push_back(pPermanentTrue);
1876 DataFlowFunctionBlocks.push_back(pControlFlow);
1908 CPPUNIT_ASSERT_MESSAGE(
"no states available in EVC state machine", States.size() > 0);
1914 ::std::this_thread::sleep_for(SLEEP_TIME);
1917 CPPUNIT_ASSERT_MESSAGE(
"string input of last state name not correct",
m_StringInput() ==
"FINAL STATE");
1920 CPPUNIT_ASSERT_MESSAGE(
"boolean input for running control flow not correct",
m_bBoolInput() ==
false);
1936 this->
m_pChecker = new ::GOPPRR::CConstraintChecker;
1972 CPPUNIT_ASSERT(pSyntaxTree != 0);
1978 CPPUNIT_ASSERT_MESSAGE(
"no project object created", pProject != 0);
1981 CPPUNIT_ASSERT_MESSAGE(
"no root graph created", pRootGraph != 0);
1984 CPPUNIT_ASSERT_MESSAGE(
"root graph not identical", &(pProject->
m_GraphSet[ pRootGraph->
m_OID ]) == pRootGraph);
1987 ::MetaEdit::ExecuteAll(pProject);
2010 CPPUNIT_ASSERT(pSyntaxTree != 0);
2016 CPPUNIT_ASSERT_MESSAGE(
"no project object created", pProject != 0);
2019 CPPUNIT_ASSERT_MESSAGE(
"no root graph created", pRootGraph != 0);
2022 CPPUNIT_ASSERT_MESSAGE(
"static semantics violated",
m_pChecker->
Check(pProject,
"",
nullptr));
2061 ::std::stringstream GeneratedCpp;
2062 ::std::regex InstanceRegex;
2063 ::std::smatch Results;
2064 ::std::string Expression;
2066 const ::std::regex FB_TYPE_REGEX(
"(AND)|(OR)|(XOR)|(NOT)|(Sum)|(Subtraction)|(Division)"
2067 "|(Multiplication)|(DoubleEqual)|(IntEqual)|(StringEqual)"
2068 "|(DoubleEqualOrGreater)|(DoubleGreater)|(IntGreater)"
2069 "|(DoubleArrayAccessor)|(VariableStorage)|(Odometer)"
2070 "|(ServiceBrake)|(EmergencyBrake)|(BrakingToTargetSpeed)"
2071 "|(CeelingSpeedControl)|(CommunicationReader)|(CommunicationSender)"
2072 "|(BoolGate)|(DoubleGate)|(StringGate)|(BoolSwitch)|(DoubleSwitch)"
2073 "|(StringSwitch)|(ModeGuard)|(ApplicationLevelType)|(DMIOutput)"
2074 "|(DMIInput)|(EnteredTrigger)|(EmbeddedStateMachine)|(StateGuard)");
2075 const ::std::regex DATAFLOW_TYPE_REGEX(
"DataFlow");
2076 const ::std::regex EVC_STATE_TYPE_REGEX(
"Mode");
2077 const ::std::regex VARIABLE_TYPE_REGEX(
"VariableInstance");
2078 const ::std::regex PACKET_TYPE_REGEX(
"Packet");
2079 const ::std::regex TELEGRAM_TYPE_REGEX(
"Telegram");
2080 const ::std::regex BALISEREADER_TYPE_REGEX(
"BaliseReader");
2081 const ::std::regex BALISESENDER_TYPE_REGEX(
"BaliseSender");
2094 pTree = Transformer.
GetTree();
2103 Cpp = GeneratedCpp.str();
2110 if (::std::regex_match(o->second.m_Type, FB_TYPE_REGEX))
2113 Expression =
".*\n::oETCS::DF::C.+ +FBO_" + o->second.m_OID +
"\\(&EVC\\);.*";
2116 InstanceRegex = ::std::regex(Expression);
2119 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2122 CPPUNIT_ASSERT_MESSAGE(
"function block object declaration not found, OID: " + o->second.m_OID, bFound ==
true);
2125 CPPUNIT_ASSERT_MESSAGE(
"function block object declaration found multiple times, OID: " + o->second.m_OID, Results.size() == 1);
2128 else if (::std::regex_match(o->second.m_Type, EVC_STATE_TYPE_REGEX))
2131 Expression =
".*\n::oETCS::DF::CEVCState +EVCState_" + o->second.m_OID +
"\\(&EVC\\);.*";
2134 InstanceRegex = ::std::regex(Expression);
2137 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2140 CPPUNIT_ASSERT_MESSAGE(
"EVC mode object declaration not found, OID: " + o->second.m_OID, bFound ==
true);
2143 CPPUNIT_ASSERT_MESSAGE(
"EVC mode object declaration found multiple times, OID: " + o->second.m_OID, Results.size() == 1);
2146 else if (::std::regex_match(o->second.m_Type, VARIABLE_TYPE_REGEX))
2149 Expression =
".*\n::oETCS::DF::CVariable +VAR_" + o->second.m_OID +
"\\(&EVC,.+\\);.*";
2152 InstanceRegex = ::std::regex(Expression);
2155 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2158 CPPUNIT_ASSERT_MESSAGE(
"language variable object declaration not found, OID: " + o->second.m_OID, bFound ==
true);
2161 CPPUNIT_ASSERT_MESSAGE(
"language variable object declaration found multiple times, OID: " + o->second.m_OID, Results.size() == 1);
2164 else if (::std::regex_match(o->second.m_Type, PACKET_TYPE_REGEX))
2167 Expression =
".*\n::oETCS::DF::CPacket +PACK_" + o->second.m_OID +
"\\(&EVC,.+\\);.*";
2170 InstanceRegex = ::std::regex(Expression);
2173 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2176 CPPUNIT_ASSERT_MESSAGE(
"language packet object declaration not found, OID: " + o->second.m_OID, bFound ==
true);
2179 CPPUNIT_ASSERT_MESSAGE(
"language packet object declaration found multiple times, OID: " + o->second.m_OID, Results.size() == 1);
2182 else if (::std::regex_match(o->second.m_Type, TELEGRAM_TYPE_REGEX))
2185 Expression =
".*\n::oETCS::DF::CTelegram +TEL_" + o->second.m_OID +
"_._.+\\(&EVC,.+\\);.*";
2188 InstanceRegex = ::std::regex(Expression);
2191 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2194 CPPUNIT_ASSERT_MESSAGE(
"language telegram object declaration not found, OID: " + o->second.m_OID, bFound ==
true);
2197 CPPUNIT_ASSERT_MESSAGE(
"language telegram object declaration found multiple times, OID: " + o->second.m_OID, Results.size() == 1);
2200 else if (::std::regex_match(o->second.m_Type, BALISEREADER_TYPE_REGEX))
2203 Expression =
".*\n::oETCS::DF::CBaliseDeviceIn +BALIN_" + o->second.m_OID +
"_._.+\\(.+\\);.*";
2206 InstanceRegex = ::std::regex(Expression, ::std::regex_constants::extended);
2209 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2212 CPPUNIT_ASSERT_MESSAGE(
"balise reader object declaration not found, OID: " + o->second.m_OID, bFound ==
true);
2215 else if (::std::regex_match(o->second.m_Type, BALISESENDER_TYPE_REGEX))
2218 Expression =
".*\n::oETCS::DF::CBaliseDeviceIn +BALOUT_" + o->second.m_OID +
"_._.+\\(.+\\);.*";
2221 InstanceRegex = ::std::regex(Expression, ::std::regex_constants::extended);
2224 bFound = ::std::regex_match(Cpp, Results, InstanceRegex);
2227 CPPUNIT_ASSERT_MESSAGE(
"balise sender object declaration not found, OID: " + o->second.m_OID, bFound ==
true);