diff --git a/compiler/lib/src/main/resources/META-INF/native-image/reflect-config.json b/compiler/lib/src/main/resources/META-INF/native-image/reflect-config.json index a6ac30284..c227102d6 100644 --- a/compiler/lib/src/main/resources/META-INF/native-image/reflect-config.json +++ b/compiler/lib/src/main/resources/META-INF/native-image/reflect-config.json @@ -24,7 +24,10 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1", - "fields":[{"name":"0bitmap$318"}] + "fields":[ + {"name":"0bitmap$318"}, + {"name":"0bitmap$346"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1000", @@ -50,6 +53,18 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1008", "fields":[{"name":"0bitmap$941"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1014", + "fields":[{"name":"0bitmap$1048"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1015", + "fields":[{"name":"0bitmap$971"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1016", + "fields":[{"name":"0bitmap$957"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1041", "fields":[{"name":"0bitmap$960"}] @@ -84,35 +99,76 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1053", - "fields":[{"name":"0bitmap$951"}] + "fields":[ + {"name":"0bitmap$951"}, + {"name":"0bitmap$967"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1054", - "fields":[{"name":"0bitmap$952"}] + "fields":[ + {"name":"0bitmap$952"}, + {"name":"0bitmap$962"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1055", - "fields":[{"name":"0bitmap$953"}] + "fields":[ + {"name":"0bitmap$953"}, + {"name":"0bitmap$958"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1056", - "fields":[{"name":"0bitmap$954"}] + "fields":[ + {"name":"0bitmap$954"}, + {"name":"0bitmap$959"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1057", + "fields":[{"name":"0bitmap$960"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1058", - "fields":[{"name":"0bitmap$959"}] + "fields":[ + {"name":"0bitmap$959"}, + {"name":"0bitmap$961"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1060", + "fields":[{"name":"0bitmap$966"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1062", "fields":[{"name":"0bitmap$964"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1064", + "fields":[{"name":"0bitmap$970"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1065", + "fields":[{"name":"0bitmap$968"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1066", - "fields":[{"name":"0bitmap$979"}] + "fields":[ + {"name":"0bitmap$969"}, + {"name":"0bitmap$979"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1067", - "fields":[{"name":"0bitmap$974"}] + "fields":[ + {"name":"0bitmap$1033"}, + {"name":"0bitmap$974"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1068", + "fields":[{"name":"0bitmap$1005"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1077", @@ -150,9 +206,48 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1085", "fields":[{"name":"0bitmap$1012"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1105", + "fields":[{"name":"0bitmap$1028"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1106", + "fields":[{"name":"0bitmap$1009"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1111", + "fields":[{"name":"0bitmap$1023"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1112", + "fields":[{"name":"0bitmap$1010"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1113", + "fields":[{"name":"0bitmap$1011"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1114", + "fields":[{"name":"0bitmap$1012"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1115", + "fields":[{"name":"0bitmap$1013"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1116", + "fields":[{"name":"0bitmap$1014"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1117", + "fields":[{"name":"0bitmap$1015"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1118", - "fields":[{"name":"0bitmap$1022"}] + "fields":[ + {"name":"0bitmap$1016"}, + {"name":"0bitmap$1022"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1119", @@ -160,31 +255,54 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1120", - "fields":[{"name":"0bitmap$1013"}] + "fields":[ + {"name":"0bitmap$1013"}, + {"name":"0bitmap$1018"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1121", - "fields":[{"name":"0bitmap$1014"}] + "fields":[ + {"name":"0bitmap$1014"}, + {"name":"0bitmap$1019"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1122", - "fields":[{"name":"0bitmap$1015"}] + "fields":[ + {"name":"0bitmap$1015"}, + {"name":"0bitmap$1020"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1123", - "fields":[{"name":"0bitmap$1016"}] + "fields":[ + {"name":"0bitmap$1016"}, + {"name":"0bitmap$1021"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1124", + "fields":[{"name":"0bitmap$1022"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1125", "fields":[{"name":"0bitmap$1021"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1126", + "fields":[{"name":"0bitmap$1027"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1129", "fields":[{"name":"0bitmap$1025"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1130", - "fields":[{"name":"0bitmap$1023"}] + "fields":[ + {"name":"0bitmap$1023"}, + {"name":"0bitmap$1032"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1131", @@ -198,6 +316,50 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1133", "fields":[{"name":"0bitmap$1056"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1134", + "fields":[{"name":"0bitmap$1047"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1135", + "fields":[{"name":"0bitmap$1042"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1145", + "fields":[{"name":"0bitmap$1046"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1146", + "fields":[{"name":"0bitmap$1043"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1147", + "fields":[{"name":"0bitmap$1044"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1148", + "fields":[{"name":"0bitmap$1045"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1149", + "fields":[{"name":"0bitmap$1049"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1150", + "fields":[{"name":"0bitmap$1147"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1151", + "fields":[{"name":"0bitmap$1050"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1152", + "fields":[{"name":"0bitmap$1098"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1153", + "fields":[{"name":"0bitmap$1084"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1166", "fields":[{"name":"0bitmap$1066"}] @@ -246,13 +408,40 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1181", "fields":[{"name":"0bitmap$1085"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1190", + "fields":[{"name":"0bitmap$1094"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1191", + "fields":[{"name":"0bitmap$1089"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1192", + "fields":[{"name":"0bitmap$1085"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1193", + "fields":[{"name":"0bitmap$1086"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1194", + "fields":[{"name":"0bitmap$1087"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1195", + "fields":[{"name":"0bitmap$1088"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1196", "fields":[{"name":"0bitmap$1099"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1197", - "fields":[{"name":"0bitmap$1098"}] + "fields":[ + {"name":"0bitmap$1093"}, + {"name":"0bitmap$1098"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1198", @@ -262,6 +451,26 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1199", "fields":[{"name":"0bitmap$1092"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1201", + "fields":[{"name":"0bitmap$1097"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1202", + "fields":[{"name":"0bitmap$1095"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1203", + "fields":[{"name":"0bitmap$1096"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1204", + "fields":[{"name":"0bitmap$1146"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1205", + "fields":[{"name":"0bitmap$1132"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1206", "fields":[{"name":"0bitmap$1097"}] @@ -324,27 +533,45 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1242", - "fields":[{"name":"0bitmap$1125"}] + "fields":[ + {"name":"0bitmap$1125"}, + {"name":"0bitmap$1142"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1243", - "fields":[{"name":"0bitmap$1126"}] + "fields":[ + {"name":"0bitmap$1126"}, + {"name":"0bitmap$1137"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1244", - "fields":[{"name":"0bitmap$1127"}] + "fields":[ + {"name":"0bitmap$1127"}, + {"name":"0bitmap$1133"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1245", - "fields":[{"name":"0bitmap$1128"}] + "fields":[ + {"name":"0bitmap$1128"}, + {"name":"0bitmap$1134"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1246", - "fields":[{"name":"0bitmap$1129"}] + "fields":[ + {"name":"0bitmap$1129"}, + {"name":"0bitmap$1135"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1247", - "fields":[{"name":"0bitmap$1130"}] + "fields":[ + {"name":"0bitmap$1130"}, + {"name":"0bitmap$1136"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1248", @@ -352,7 +579,10 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1249", - "fields":[{"name":"0bitmap$1132"}] + "fields":[ + {"name":"0bitmap$1132"}, + {"name":"0bitmap$1141"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$125", @@ -368,15 +598,24 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1253", - "fields":[{"name":"0bitmap$1138"}] + "fields":[ + {"name":"0bitmap$1138"}, + {"name":"0bitmap$1145"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1254", - "fields":[{"name":"0bitmap$1136"}] + "fields":[ + {"name":"0bitmap$1136"}, + {"name":"0bitmap$1143"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1255", - "fields":[{"name":"0bitmap$1137"}] + "fields":[ + {"name":"0bitmap$1137"}, + {"name":"0bitmap$1144"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1257", @@ -384,11 +623,17 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1258", - "fields":[{"name":"0bitmap$1141"}] + "fields":[ + {"name":"0bitmap$1141"}, + {"name":"0bitmap$1178"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1259", - "fields":[{"name":"0bitmap$1144"}] + "fields":[ + {"name":"0bitmap$1144"}, + {"name":"0bitmap$1163"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$126", @@ -398,6 +643,26 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$127", "fields":[{"name":"0bitmap$140"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1274", + "fields":[{"name":"0bitmap$1177"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1275", + "fields":[{"name":"0bitmap$1176"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1276", + "fields":[{"name":"0bitmap$1164"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1277", + "fields":[{"name":"0bitmap$1170"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1284", + "fields":[{"name":"0bitmap$1175"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1288", "fields":[{"name":"0bitmap$1172"}] @@ -408,35 +673,139 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1290", - "fields":[{"name":"0bitmap$1226"}] + "fields":[ + {"name":"0bitmap$1199"}, + {"name":"0bitmap$1226"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1291", + "fields":[ + {"name":"0bitmap$1188"}, + {"name":"0bitmap$1202"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1302", + "fields":[{"name":"0bitmap$1189"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1303", + "fields":[{"name":"0bitmap$1193"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1308", + "fields":[{"name":"0bitmap$1194"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1309", + "fields":[{"name":"0bitmap$1195"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1310", + "fields":[{"name":"0bitmap$1198"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1313", + "fields":[{"name":"0bitmap$1201"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1314", + "fields":[{"name":"0bitmap$1200"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1315", + "fields":[{"name":"0bitmap$1224"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1316", "fields":[{"name":"0bitmap$1202"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1317", + "fields":[{"name":"0bitmap$1223"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1318", + "fields":[{"name":"0bitmap$1212"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1319", + "fields":[{"name":"0bitmap$1211"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1320", + "fields":[{"name":"0bitmap$1203"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1321", + "fields":[{"name":"0bitmap$1204"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1322", + "fields":[{"name":"0bitmap$1205"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1323", + "fields":[{"name":"0bitmap$1206"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1324", - "fields":[{"name":"0bitmap$1221"}] + "fields":[ + {"name":"0bitmap$1207"}, + {"name":"0bitmap$1221"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1325", - "fields":[{"name":"0bitmap$1206"}] + "fields":[ + {"name":"0bitmap$1206"}, + {"name":"0bitmap$1208"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1326", + "fields":[{"name":"0bitmap$1209"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1327", + "fields":[{"name":"0bitmap$1210"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1329", + "fields":[{"name":"0bitmap$1213"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$133", + "fields":[{"name":"0bitmap$243"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1330", - "fields":[{"name":"0bitmap$1216"}] + "fields":[ + {"name":"0bitmap$1216"}, + {"name":"0bitmap$1217"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1331", - "fields":[{"name":"0bitmap$1207"}] + "fields":[ + {"name":"0bitmap$1207"}, + {"name":"0bitmap$1216"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1332", - "fields":[{"name":"0bitmap$1208"}] + "fields":[ + {"name":"0bitmap$1208"}, + {"name":"0bitmap$1214"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1333", - "fields":[{"name":"0bitmap$1209"}] + "fields":[ + {"name":"0bitmap$1209"}, + {"name":"0bitmap$1215"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1334", @@ -444,15 +813,24 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1335", - "fields":[{"name":"0bitmap$1211"}] + "fields":[ + {"name":"0bitmap$1211"}, + {"name":"0bitmap$1218"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1336", - "fields":[{"name":"0bitmap$1212"}] + "fields":[ + {"name":"0bitmap$1212"}, + {"name":"0bitmap$1219"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1337", - "fields":[{"name":"0bitmap$1213"}] + "fields":[ + {"name":"0bitmap$1213"}, + {"name":"0bitmap$1222"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1338", @@ -462,6 +840,10 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1339", "fields":[{"name":"0bitmap$1215"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$134", + "fields":[{"name":"0bitmap$166"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1341", "fields":[{"name":"0bitmap$1220"}] @@ -474,6 +856,10 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1349", "fields":[{"name":"0bitmap$1256"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$135", + "fields":[{"name":"0bitmap$152"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1350", "fields":[{"name":"0bitmap$1238"}] @@ -490,17 +876,30 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1367", "fields":[{"name":"0bitmap$1240"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1368", + "fields":[{"name":"0bitmap$1252"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1369", - "fields":[{"name":"0bitmap$1255"}] + "fields":[ + {"name":"0bitmap$1251"}, + {"name":"0bitmap$1255"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1370", - "fields":[{"name":"0bitmap$1254"}] + "fields":[ + {"name":"0bitmap$1254"}, + {"name":"0bitmap$1314"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1371", - "fields":[{"name":"0bitmap$1242"}] + "fields":[ + {"name":"0bitmap$1242"}, + {"name":"0bitmap$1286"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1372", @@ -534,13 +933,91 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1386", "fields":[{"name":"0bitmap$1283"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1408", + "fields":[{"name":"0bitmap$1309"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1409", + "fields":[{"name":"0bitmap$1290"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1414", + "fields":[{"name":"0bitmap$1304"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1415", - "fields":[{"name":"0bitmap$1311"}] + "fields":[ + {"name":"0bitmap$1291"}, + {"name":"0bitmap$1311"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1416", - "fields":[{"name":"0bitmap$1310"}] + "fields":[ + {"name":"0bitmap$1292"}, + {"name":"0bitmap$1310"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1417", + "fields":[{"name":"0bitmap$1293"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1418", + "fields":[{"name":"0bitmap$1294"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1419", + "fields":[{"name":"0bitmap$1295"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1420", + "fields":[{"name":"0bitmap$1296"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1421", + "fields":[{"name":"0bitmap$1297"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1422", + "fields":[{"name":"0bitmap$1298"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1423", + "fields":[{"name":"0bitmap$1299"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1424", + "fields":[{"name":"0bitmap$1300"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1425", + "fields":[{"name":"0bitmap$1301"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1426", + "fields":[{"name":"0bitmap$1302"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1427", + "fields":[{"name":"0bitmap$1303"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1429", + "fields":[{"name":"0bitmap$1308"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1433", + "fields":[{"name":"0bitmap$1313"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1437", + "fields":[{"name":"0bitmap$1344"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1438", + "fields":[{"name":"0bitmap$1326"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1445", @@ -574,6 +1051,34 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1452", "fields":[{"name":"0bitmap$1328"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1453", + "fields":[{"name":"0bitmap$1329"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1454", + "fields":[{"name":"0bitmap$1327"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1455", + "fields":[{"name":"0bitmap$1328"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1457", + "fields":[{"name":"0bitmap$1343"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1458", + "fields":[{"name":"0bitmap$1342"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1459", + "fields":[{"name":"0bitmap$1330"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1460", + "fields":[{"name":"0bitmap$1336"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1463", "fields":[{"name":"0bitmap$1329"}] @@ -592,23 +1097,46 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1467", - "fields":[{"name":"0bitmap$1331"}] + "fields":[ + {"name":"0bitmap$1331"}, + {"name":"0bitmap$1341"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1468", + "fields":[{"name":"0bitmap$1340"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1469", - "fields":[{"name":"0bitmap$1334"}] + "fields":[ + {"name":"0bitmap$1334"}, + {"name":"0bitmap$1337"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1470", - "fields":[{"name":"0bitmap$1335"}] + "fields":[ + {"name":"0bitmap$1335"}, + {"name":"0bitmap$1338"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1471", - "fields":[{"name":"0bitmap$1338"}] + "fields":[ + {"name":"0bitmap$1338"}, + {"name":"0bitmap$1339"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1473", + "fields":[{"name":"0bitmap$1406"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1474", - "fields":[{"name":"0bitmap$1342"}] + "fields":[ + {"name":"0bitmap$1342"}, + {"name":"0bitmap$1371"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1475", @@ -654,6 +1182,126 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1500", "fields":[{"name":"0bitmap$1363"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1503", + "fields":[{"name":"0bitmap$1399"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1504", + "fields":[{"name":"0bitmap$1398"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1533", + "fields":[{"name":"0bitmap$1402"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1534", + "fields":[{"name":"0bitmap$1400"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1535", + "fields":[{"name":"0bitmap$1401"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1536", + "fields":[{"name":"0bitmap$1405"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1537", + "fields":[{"name":"0bitmap$1403"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1538", + "fields":[{"name":"0bitmap$1404"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1539", + "fields":[{"name":"0bitmap$1427"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1540", + "fields":[{"name":"0bitmap$1416"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1551", + "fields":[{"name":"0bitmap$1417"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1552", + "fields":[{"name":"0bitmap$1421"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1553", + "fields":[{"name":"0bitmap$1420"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1554", + "fields":[{"name":"0bitmap$1418"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1555", + "fields":[{"name":"0bitmap$1419"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1557", + "fields":[{"name":"0bitmap$1422"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1558", + "fields":[{"name":"0bitmap$1423"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1559", + "fields":[{"name":"0bitmap$1426"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1562", + "fields":[{"name":"0bitmap$1430"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1563", + "fields":[{"name":"0bitmap$1428"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1564", + "fields":[{"name":"0bitmap$1429"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1565", + "fields":[{"name":"0bitmap$1433"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1566", + "fields":[{"name":"0bitmap$1431"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1567", + "fields":[{"name":"0bitmap$1432"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1568", + "fields":[{"name":"0bitmap$1440"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1576", + "fields":[{"name":"0bitmap$1441"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1577", + "fields":[{"name":"0bitmap$1449"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1586", + "fields":[{"name":"0bitmap$1452"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1587", + "fields":[{"name":"0bitmap$1450"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$1588", + "fields":[{"name":"0bitmap$1451"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$160", "fields":[{"name":"0bitmap$150"}] @@ -688,19 +1336,63 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$172", - "fields":[{"name":"0bitmap$151"}] + "fields":[ + {"name":"0bitmap$151"}, + {"name":"0bitmap$162"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$173", - "fields":[{"name":"0bitmap$152"}] + "fields":[ + {"name":"0bitmap$152"}, + {"name":"0bitmap$157"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$174", - "fields":[{"name":"0bitmap$208"}] + "fields":[ + {"name":"0bitmap$153"}, + {"name":"0bitmap$208"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$175", - "fields":[{"name":"0bitmap$184"}] + "fields":[ + {"name":"0bitmap$154"}, + {"name":"0bitmap$184"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$176", + "fields":[{"name":"0bitmap$155"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$177", + "fields":[{"name":"0bitmap$156"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$179", + "fields":[{"name":"0bitmap$161"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$183", + "fields":[{"name":"0bitmap$165"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$184", + "fields":[{"name":"0bitmap$163"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$185", + "fields":[{"name":"0bitmap$164"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$186", + "fields":[{"name":"0bitmap$228"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$187", + "fields":[{"name":"0bitmap$200"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$2", @@ -754,16 +1446,82 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$223", "fields":[{"name":"0bitmap$197"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$224", + "fields":[{"name":"0bitmap$223"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$225", - "fields":[{"name":"0bitmap$202"}] + "fields":[ + {"name":"0bitmap$202"}, + {"name":"0bitmap$204"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$229", "fields":[{"name":"0bitmap$207"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$230", + "fields":[{"name":"0bitmap$218"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$231", + "fields":[{"name":"0bitmap$205"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$232", + "fields":[{"name":"0bitmap$206"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$233", + "fields":[ + {"name":"0bitmap$207"}, + {"name":"0bitmap$222"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$234", + "fields":[{"name":"0bitmap$208"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$235", + "fields":[{"name":"0bitmap$209"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$236", + "fields":[{"name":"0bitmap$210"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$237", + "fields":[{"name":"0bitmap$211"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$238", + "fields":[{"name":"0bitmap$212"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$239", + "fields":[{"name":"0bitmap$213"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$240", + "fields":[{"name":"0bitmap$214"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$241", + "fields":[{"name":"0bitmap$215"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$242", + "fields":[{"name":"0bitmap$216"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$243", + "fields":[{"name":"0bitmap$217"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$245", "fields":[{"name":"0bitmap$222"}] }, { @@ -772,7 +1530,22 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$249", - "fields":[{"name":"0bitmap$314"}] + "fields":[ + {"name":"0bitmap$227"}, + {"name":"0bitmap$314"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$253", + "fields":[{"name":"0bitmap$242"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$268", + "fields":[{"name":"0bitmap$244"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$269", + "fields":[{"name":"0bitmap$342"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$347", @@ -782,6 +1555,14 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$349", "fields":[{"name":"0bitmap$425"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$375", + "fields":[{"name":"0bitmap$345"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$377", + "fields":[{"name":"0bitmap$461"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$4", "fields":[{"name":"0bitmap$3"}] @@ -856,23 +1637,90 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$5", - "fields":[{"name":"0bitmap$315"}] + "fields":[ + {"name":"0bitmap$315"}, + {"name":"0bitmap$343"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$504", + "fields":[{"name":"0bitmap$475"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$505", + "fields":[{"name":"0bitmap$474"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$506", + "fields":[{"name":"0bitmap$463"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$508", + "fields":[{"name":"0bitmap$473"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$509", + "fields":[{"name":"0bitmap$472"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$510", + "fields":[{"name":"0bitmap$464"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$511", + "fields":[{"name":"0bitmap$465"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$512", + "fields":[{"name":"0bitmap$466"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$513", + "fields":[{"name":"0bitmap$467"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$514", + "fields":[{"name":"0bitmap$468"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$515", + "fields":[{"name":"0bitmap$469"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$516", + "fields":[{"name":"0bitmap$470"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$517", + "fields":[{"name":"0bitmap$471"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$519", - "fields":[{"name":"0bitmap$479"}] + "fields":[ + {"name":"0bitmap$479"}, + {"name":"0bitmap$601"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$520", - "fields":[{"name":"0bitmap$474"}] + "fields":[ + {"name":"0bitmap$474"}, + {"name":"0bitmap$600"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$521", - "fields":[{"name":"0bitmap$470"}] + "fields":[ + {"name":"0bitmap$470"}, + {"name":"0bitmap$523"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$522", - "fields":[{"name":"0bitmap$471"}] + "fields":[ + {"name":"0bitmap$471"}, + {"name":"0bitmap$509"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$523", @@ -902,13 +1750,60 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$533", "fields":[{"name":"0bitmap$537"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$559", + "fields":[{"name":"0bitmap$519"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$560", + "fields":[{"name":"0bitmap$514"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$561", + "fields":[{"name":"0bitmap$510"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$562", + "fields":[{"name":"0bitmap$511"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$563", + "fields":[{"name":"0bitmap$512"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$564", + "fields":[{"name":"0bitmap$513"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$566", + "fields":[{"name":"0bitmap$518"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$570", + "fields":[{"name":"0bitmap$522"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$571", + "fields":[{"name":"0bitmap$520"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$572", + "fields":[{"name":"0bitmap$521"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$573", + "fields":[{"name":"0bitmap$585"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$592", "fields":[{"name":"0bitmap$551"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$6", - "fields":[{"name":"0bitmap$110"}] + "fields":[ + {"name":"0bitmap$110"}, + {"name":"0bitmap$118"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$607", @@ -990,6 +1885,10 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$639", "fields":[{"name":"0bitmap$580"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$640", + "fields":[{"name":"0bitmap$599"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$641", "fields":[{"name":"0bitmap$591"}] @@ -998,45 +1897,83 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$652", "fields":[{"name":"0bitmap$595"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$655", + "fields":[{"name":"0bitmap$699"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$656", + "fields":[{"name":"0bitmap$613"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$657", - "fields":[{"name":"0bitmap$596"}] + "fields":[ + {"name":"0bitmap$596"}, + {"name":"0bitmap$611"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$658", - "fields":[{"name":"0bitmap$597"}] + "fields":[ + {"name":"0bitmap$597"}, + {"name":"0bitmap$610"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$659", - "fields":[{"name":"0bitmap$598"}] + "fields":[ + {"name":"0bitmap$598"}, + {"name":"0bitmap$602"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$660", - "fields":[{"name":"0bitmap$600"}] + "fields":[ + {"name":"0bitmap$600"}, + {"name":"0bitmap$603"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$661", - "fields":[{"name":"0bitmap$599"}] + "fields":[ + {"name":"0bitmap$599"}, + {"name":"0bitmap$604"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$662", - "fields":[{"name":"0bitmap$617"}] + "fields":[ + {"name":"0bitmap$605"}, + {"name":"0bitmap$617"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$663", - "fields":[{"name":"0bitmap$601"}] + "fields":[ + {"name":"0bitmap$601"}, + {"name":"0bitmap$606"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$664", - "fields":[{"name":"0bitmap$602"}] + "fields":[ + {"name":"0bitmap$602"}, + {"name":"0bitmap$607"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$665", - "fields":[{"name":"0bitmap$616"}] + "fields":[ + {"name":"0bitmap$608"}, + {"name":"0bitmap$616"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$666", - "fields":[{"name":"0bitmap$615"}] + "fields":[ + {"name":"0bitmap$609"}, + {"name":"0bitmap$615"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$667", @@ -1044,7 +1981,18 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$668", - "fields":[{"name":"0bitmap$609"}] + "fields":[ + {"name":"0bitmap$609"}, + {"name":"0bitmap$612"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$670", + "fields":[{"name":"0bitmap$629"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$671", + "fields":[{"name":"0bitmap$623"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$675", @@ -1056,15 +2004,28 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$682", - "fields":[{"name":"0bitmap$619"}] + "fields":[ + {"name":"0bitmap$619"}, + {"name":"0bitmap$627"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$683", + "fields":[{"name":"0bitmap$626"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$684", - "fields":[{"name":"0bitmap$629"}] + "fields":[ + {"name":"0bitmap$624"}, + {"name":"0bitmap$629"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$685", - "fields":[{"name":"0bitmap$628"}] + "fields":[ + {"name":"0bitmap$625"}, + {"name":"0bitmap$628"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$686", @@ -1072,7 +2033,10 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$687", - "fields":[{"name":"0bitmap$621"}] + "fields":[ + {"name":"0bitmap$621"}, + {"name":"0bitmap$628"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$688", @@ -1080,7 +2044,10 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$689", - "fields":[{"name":"0bitmap$623"}] + "fields":[ + {"name":"0bitmap$623"}, + {"name":"0bitmap$639"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$690", @@ -1115,13 +2082,63 @@ "fields":[{"name":"0bitmap$647"}] }, { - "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$715", + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$700", + "fields":[{"name":"0bitmap$643"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$705", + "fields":[{"name":"0bitmap$644"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$706", + "fields":[{"name":"0bitmap$645"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$707", + "fields":[{"name":"0bitmap$646"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$708", + "fields":[{"name":"0bitmap$648"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$709", + "fields":[{"name":"0bitmap$647"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$710", + "fields":[{"name":"0bitmap$665"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$711", "fields":[{"name":"0bitmap$649"}] }, { - "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$716", + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$712", "fields":[{"name":"0bitmap$650"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$713", + "fields":[{"name":"0bitmap$664"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$714", + "fields":[{"name":"0bitmap$663"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$715", + "fields":[ + {"name":"0bitmap$649"}, + {"name":"0bitmap$651"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$716", + "fields":[ + {"name":"0bitmap$650"}, + {"name":"0bitmap$657"} + ] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$717", "fields":[{"name":"0bitmap$673"}] @@ -1135,48 +2152,90 @@ "fields":[{"name":"0bitmap$661"}] }, { - "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$730", + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$723", "fields":[{"name":"0bitmap$662"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$729", + "fields":[{"name":"0bitmap$678"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$730", + "fields":[ + {"name":"0bitmap$662"}, + {"name":"0bitmap$667"} + ] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$731", "fields":[{"name":"0bitmap$666"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$732", - "fields":[{"name":"0bitmap$665"}] + "fields":[ + {"name":"0bitmap$665"}, + {"name":"0bitmap$677"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$733", - "fields":[{"name":"0bitmap$663"}] + "fields":[ + {"name":"0bitmap$663"}, + {"name":"0bitmap$676"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$734", - "fields":[{"name":"0bitmap$664"}] + "fields":[ + {"name":"0bitmap$664"}, + {"name":"0bitmap$668"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$735", + "fields":[{"name":"0bitmap$669"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$736", - "fields":[{"name":"0bitmap$667"}] + "fields":[ + {"name":"0bitmap$667"}, + {"name":"0bitmap$670"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$737", - "fields":[{"name":"0bitmap$668"}] + "fields":[ + {"name":"0bitmap$668"}, + {"name":"0bitmap$671"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$738", - "fields":[{"name":"0bitmap$671"}] + "fields":[ + {"name":"0bitmap$671"}, + {"name":"0bitmap$672"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$739", - "fields":[{"name":"0bitmap$670"}] + "fields":[ + {"name":"0bitmap$670"}, + {"name":"0bitmap$673"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$740", - "fields":[{"name":"0bitmap$669"}] + "fields":[ + {"name":"0bitmap$669"}, + {"name":"0bitmap$674"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$741", - "fields":[{"name":"0bitmap$695"}] + "fields":[ + {"name":"0bitmap$675"}, + {"name":"0bitmap$695"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$742", @@ -1184,11 +2243,17 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$743", - "fields":[{"name":"0bitmap$683"}] + "fields":[ + {"name":"0bitmap$683"}, + {"name":"0bitmap$696"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$744", - "fields":[{"name":"0bitmap$682"}] + "fields":[ + {"name":"0bitmap$680"}, + {"name":"0bitmap$682"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$745", @@ -1196,11 +2261,17 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$746", - "fields":[{"name":"0bitmap$675"}] + "fields":[ + {"name":"0bitmap$675"}, + {"name":"0bitmap$681"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$747", - "fields":[{"name":"0bitmap$676"}] + "fields":[ + {"name":"0bitmap$676"}, + {"name":"0bitmap$695"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$748", @@ -1242,17 +2313,34 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$762", "fields":[{"name":"0bitmap$693"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$763", + "fields":[{"name":"0bitmap$697"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$764", + "fields":[{"name":"0bitmap$698"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$765", - "fields":[{"name":"0bitmap$713"}] + "fields":[ + {"name":"0bitmap$713"}, + {"name":"0bitmap$721"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$766", - "fields":[{"name":"0bitmap$712"}] + "fields":[ + {"name":"0bitmap$712"}, + {"name":"0bitmap$720"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$767", - "fields":[{"name":"0bitmap$696"}] + "fields":[ + {"name":"0bitmap$696"}, + {"name":"0bitmap$709"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$768", @@ -1262,26 +2350,117 @@ "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$769", "fields":[{"name":"0bitmap$711"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$778", + "fields":[{"name":"0bitmap$710"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$779", + "fields":[{"name":"0bitmap$714"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$780", + "fields":[{"name":"0bitmap$713"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$781", + "fields":[{"name":"0bitmap$711"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$782", + "fields":[{"name":"0bitmap$712"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$784", + "fields":[{"name":"0bitmap$715"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$785", - "fields":[{"name":"0bitmap$732"}] + "fields":[ + {"name":"0bitmap$716"}, + {"name":"0bitmap$732"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$786", - "fields":[{"name":"0bitmap$731"}] + "fields":[ + {"name":"0bitmap$719"}, + {"name":"0bitmap$731"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$787", - "fields":[{"name":"0bitmap$715"}] + "fields":[ + {"name":"0bitmap$715"}, + {"name":"0bitmap$718"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$788", + "fields":[{"name":"0bitmap$717"}] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$789", - "fields":[{"name":"0bitmap$716"}] + "fields":[ + {"name":"0bitmap$716"}, + {"name":"0bitmap$743"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$790", + "fields":[ + {"name":"0bitmap$730"}, + {"name":"0bitmap$742"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$791", + "fields":[{"name":"0bitmap$731"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$792", "fields":[{"name":"0bitmap$730"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$793", + "fields":[{"name":"0bitmap$722"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$794", + "fields":[{"name":"0bitmap$723"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$795", + "fields":[{"name":"0bitmap$724"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$796", + "fields":[{"name":"0bitmap$725"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$797", + "fields":[{"name":"0bitmap$726"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$798", + "fields":[{"name":"0bitmap$727"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$799", + "fields":[{"name":"0bitmap$728"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$800", + "fields":[{"name":"0bitmap$729"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$802", + "fields":[{"name":"0bitmap$732"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$803", + "fields":[{"name":"0bitmap$736"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$806", "fields":[{"name":"0bitmap$760"}] @@ -1292,8 +2471,39 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$808", + "fields":[ + {"name":"0bitmap$737"}, + {"name":"0bitmap$745"} + ] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$809", + "fields":[{"name":"0bitmap$738"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$810", + "fields":[{"name":"0bitmap$741"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$813", + "fields":[{"name":"0bitmap$761"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$814", + "fields":[{"name":"0bitmap$760"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$815", + "fields":[{"name":"0bitmap$744"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$816", "fields":[{"name":"0bitmap$745"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$817", + "fields":[{"name":"0bitmap$759"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$823", "fields":[{"name":"0bitmap$753"}] @@ -1332,28 +2542,116 @@ }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$833", - "fields":[{"name":"0bitmap$755"}] + "fields":[ + {"name":"0bitmap$755"}, + {"name":"0bitmap$780"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$834", - "fields":[{"name":"0bitmap$758"}] + "fields":[ + {"name":"0bitmap$758"}, + {"name":"0bitmap$779"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$835", - "fields":[{"name":"0bitmap$756"}] + "fields":[ + {"name":"0bitmap$756"}, + {"name":"0bitmap$763"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$836", "fields":[{"name":"0bitmap$757"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$837", + "fields":[{"name":"0bitmap$764"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$838", - "fields":[{"name":"0bitmap$1072"}] + "fields":[ + {"name":"0bitmap$1072"}, + {"name":"0bitmap$778"} + ] }, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$839", "fields":[{"name":"0bitmap$867"}] }, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$854", + "fields":[{"name":"0bitmap$808"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$855", + "fields":[{"name":"0bitmap$802"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$856", + "fields":[{"name":"0bitmap$793"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$871", + "fields":[{"name":"0bitmap$801"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$872", + "fields":[{"name":"0bitmap$798"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$873", + "fields":[{"name":"0bitmap$797"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$874", + "fields":[{"name":"0bitmap$794"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$875", + "fields":[{"name":"0bitmap$795"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$876", + "fields":[{"name":"0bitmap$796"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$877", + "fields":[{"name":"0bitmap$799"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$878", + "fields":[{"name":"0bitmap$800"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$880", + "fields":[{"name":"0bitmap$807"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$881", + "fields":[{"name":"0bitmap$803"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$882", + "fields":[{"name":"0bitmap$806"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$883", + "fields":[{"name":"0bitmap$804"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$884", + "fields":[{"name":"0bitmap$805"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$886", + "fields":[{"name":"0bitmap$1148"}] +}, +{ + "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$887", + "fields":[{"name":"0bitmap$923"}] +}, { "name":"fpp.compiler.codegen.AnalysisJsonEncoder$$anon$958", "fields":[{"name":"0bitmap$980"}] @@ -1480,7 +2778,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$124", - "fields":[{"name":"0bitmap$127"}] + "fields":[ + {"name":"0bitmap$115"}, + {"name":"0bitmap$127"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$125", @@ -1488,23 +2789,42 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$126", - "fields":[{"name":"0bitmap$117"}] + "fields":[ + {"name":"0bitmap$117"}, + {"name":"0bitmap$129"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$127", - "fields":[{"name":"0bitmap$116"}] + "fields":[ + {"name":"0bitmap$116"}, + {"name":"0bitmap$128"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$128", - "fields":[{"name":"0bitmap$114"}] + "fields":[ + {"name":"0bitmap$114"}, + {"name":"0bitmap$119"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$129", - "fields":[{"name":"0bitmap$115"}] + "fields":[ + {"name":"0bitmap$115"}, + {"name":"0bitmap$118"} + ] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$130", + "fields":[{"name":"0bitmap$116"}] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$131", - "fields":[{"name":"0bitmap$125"}] + "fields":[ + {"name":"0bitmap$117"}, + {"name":"0bitmap$125"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$132", @@ -1512,7 +2832,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$133", - "fields":[{"name":"0bitmap$119"}] + "fields":[ + {"name":"0bitmap$119"}, + {"name":"0bitmap$127"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$134", @@ -1534,13 +2857,23 @@ "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$138", "fields":[{"name":"0bitmap$124"}] }, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$139", + "fields":[{"name":"0bitmap$125"}] +}, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$140", - "fields":[{"name":"0bitmap$129"}] + "fields":[ + {"name":"0bitmap$126"}, + {"name":"0bitmap$129"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$142", - "fields":[{"name":"0bitmap$139"}] + "fields":[ + {"name":"0bitmap$131"}, + {"name":"0bitmap$139"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$143", @@ -1548,23 +2881,42 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$144", - "fields":[{"name":"0bitmap$133"}] + "fields":[ + {"name":"0bitmap$133"}, + {"name":"0bitmap$141"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$145", - "fields":[{"name":"0bitmap$132"}] + "fields":[ + {"name":"0bitmap$132"}, + {"name":"0bitmap$140"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$146", - "fields":[{"name":"0bitmap$130"}] + "fields":[ + {"name":"0bitmap$130"}, + {"name":"0bitmap$135"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$147", - "fields":[{"name":"0bitmap$131"}] + "fields":[ + {"name":"0bitmap$131"}, + {"name":"0bitmap$134"} + ] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$148", + "fields":[{"name":"0bitmap$132"}] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$149", - "fields":[{"name":"0bitmap$137"}] + "fields":[ + {"name":"0bitmap$133"}, + {"name":"0bitmap$137"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$15", @@ -1576,7 +2928,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$151", - "fields":[{"name":"0bitmap$135"}] + "fields":[ + {"name":"0bitmap$135"}, + {"name":"0bitmap$139"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$152", @@ -1584,31 +2939,52 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$153", - "fields":[{"name":"0bitmap$141"}] + "fields":[ + {"name":"0bitmap$137"}, + {"name":"0bitmap$141"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$154", - "fields":[{"name":"0bitmap$140"}] + "fields":[ + {"name":"0bitmap$138"}, + {"name":"0bitmap$140"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$155", - "fields":[{"name":"0bitmap$172"}] + "fields":[ + {"name":"0bitmap$143"}, + {"name":"0bitmap$172"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$156", - "fields":[{"name":"0bitmap$171"}] + "fields":[ + {"name":"0bitmap$142"}, + {"name":"0bitmap$171"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$157", - "fields":[{"name":"0bitmap$151"}] + "fields":[ + {"name":"0bitmap$151"}, + {"name":"0bitmap$178"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$158", - "fields":[{"name":"0bitmap$146"}] + "fields":[ + {"name":"0bitmap$146"}, + {"name":"0bitmap$177"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$159", - "fields":[{"name":"0bitmap$142"}] + "fields":[ + {"name":"0bitmap$142"}, + {"name":"0bitmap$153"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$16", @@ -1616,7 +2992,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$160", - "fields":[{"name":"0bitmap$143"}] + "fields":[ + {"name":"0bitmap$143"}, + {"name":"0bitmap$148"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$161", @@ -1626,9 +3005,16 @@ "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$162", "fields":[{"name":"0bitmap$145"}] }, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$163", + "fields":[{"name":"0bitmap$146"}] +}, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$164", - "fields":[{"name":"0bitmap$150"}] + "fields":[ + {"name":"0bitmap$147"}, + {"name":"0bitmap$150"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$165", @@ -1636,7 +3022,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$166", - "fields":[{"name":"0bitmap$148"}] + "fields":[ + {"name":"0bitmap$148"}, + {"name":"0bitmap$152"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$167", @@ -1644,16 +3033,30 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$168", - "fields":[{"name":"0bitmap$170"}] + "fields":[ + {"name":"0bitmap$150"}, + {"name":"0bitmap$170"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$169", - "fields":[{"name":"0bitmap$155"}] + "fields":[ + {"name":"0bitmap$151"}, + {"name":"0bitmap$155"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$17", "fields":[{"name":"0bitmap$16"}] }, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$170", + "fields":[{"name":"0bitmap$176"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$171", + "fields":[{"name":"0bitmap$157"}] +}, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$174", "fields":[{"name":"0bitmap$165"}] @@ -1664,7 +3067,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$176", - "fields":[{"name":"0bitmap$157"}] + "fields":[ + {"name":"0bitmap$157"}, + {"name":"0bitmap$171"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$177", @@ -1698,13 +3104,35 @@ "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$183", "fields":[{"name":"0bitmap$164"}] }, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$184", + "fields":[{"name":"0bitmap$165"}] +}, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$185", + "fields":[ + {"name":"0bitmap$166"}, + {"name":"0bitmap$169"} + ] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$186", + "fields":[{"name":"0bitmap$167"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$187", + "fields":[{"name":"0bitmap$168"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$188", "fields":[{"name":"0bitmap$169"}] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$189", - "fields":[{"name":"0bitmap$174"}] + "fields":[ + {"name":"0bitmap$170"}, + {"name":"0bitmap$174"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$19", @@ -1716,7 +3144,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$191", - "fields":[{"name":"0bitmap$187"}] + "fields":[ + {"name":"0bitmap$175"}, + {"name":"0bitmap$187"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$192", @@ -1732,11 +3163,21 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$195", - "fields":[{"name":"0bitmap$176"}] + "fields":[ + {"name":"0bitmap$176"}, + {"name":"0bitmap$180"} + ] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$196", + "fields":[{"name":"0bitmap$179"}] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$197", - "fields":[{"name":"0bitmap$181"}] + "fields":[ + {"name":"0bitmap$181"}, + {"name":"0bitmap$182"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$198", @@ -1744,7 +3185,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$199", - "fields":[{"name":"0bitmap$179"}] + "fields":[ + {"name":"0bitmap$179"}, + {"name":"0bitmap$195"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$2", @@ -1756,15 +3200,28 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$200", - "fields":[{"name":"0bitmap$180"}] + "fields":[ + {"name":"0bitmap$180"}, + {"name":"0bitmap$194"} + ] }, { - "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$202", + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$201", "fields":[{"name":"0bitmap$185"}] }, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$202", + "fields":[ + {"name":"0bitmap$183"}, + {"name":"0bitmap$185"} + ] +}, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$203", - "fields":[{"name":"0bitmap$182"}] + "fields":[ + {"name":"0bitmap$182"}, + {"name":"0bitmap$184"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$204", @@ -1772,11 +3229,25 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$205", - "fields":[{"name":"0bitmap$184"}] + "fields":[ + {"name":"0bitmap$184"}, + {"name":"0bitmap$189"} + ] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$206", + "fields":[{"name":"0bitmap$186"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$207", + "fields":[{"name":"0bitmap$187"}] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$208", - "fields":[{"name":"0bitmap$213"}] + "fields":[ + {"name":"0bitmap$188"}, + {"name":"0bitmap$213"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$209", @@ -1788,19 +3259,31 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$210", - "fields":[{"name":"0bitmap$192"}] + "fields":[ + {"name":"0bitmap$192"}, + {"name":"0bitmap$193"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$211", - "fields":[{"name":"0bitmap$191"}] + "fields":[ + {"name":"0bitmap$190"}, + {"name":"0bitmap$191"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$212", - "fields":[{"name":"0bitmap$189"}] + "fields":[ + {"name":"0bitmap$189"}, + {"name":"0bitmap$191"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$213", - "fields":[{"name":"0bitmap$190"}] + "fields":[ + {"name":"0bitmap$190"}, + {"name":"0bitmap$192"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$214", @@ -1812,19 +3295,31 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$216", - "fields":[{"name":"0bitmap$197"}] + "fields":[ + {"name":"0bitmap$197"}, + {"name":"0bitmap$221"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$217", - "fields":[{"name":"0bitmap$196"}] + "fields":[ + {"name":"0bitmap$196"}, + {"name":"0bitmap$201"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$218", - "fields":[{"name":"0bitmap$194"}] + "fields":[ + {"name":"0bitmap$194"}, + {"name":"0bitmap$200"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$219", - "fields":[{"name":"0bitmap$195"}] + "fields":[ + {"name":"0bitmap$195"}, + {"name":"0bitmap$199"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$22", @@ -1832,7 +3327,42 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$220", - "fields":[{"name":"0bitmap$206"}] + "fields":[ + {"name":"0bitmap$197"}, + {"name":"0bitmap$206"} + ] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$221", + "fields":[{"name":"0bitmap$198"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$222", + "fields":[{"name":"0bitmap$216"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$223", + "fields":[{"name":"0bitmap$215"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$224", + "fields":[{"name":"0bitmap$205"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$225", + "fields":[{"name":"0bitmap$204"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$226", + "fields":[{"name":"0bitmap$202"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$227", + "fields":[{"name":"0bitmap$203"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$228", + "fields":[{"name":"0bitmap$214"}] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$23", @@ -1854,6 +3384,22 @@ "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$236", "fields":[{"name":"0bitmap$214"}] }, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$238", + "fields":[{"name":"0bitmap$218"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$240", + "fields":[{"name":"0bitmap$220"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$241", + "fields":[{"name":"0bitmap$219"}] +}, +{ + "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$244", + "fields":[{"name":"0bitmap$222"}] +}, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$25", "fields":[{"name":"0bitmap$66"}] @@ -2104,7 +3650,10 @@ }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$95", - "fields":[{"name":"0bitmap$188"}] + "fields":[ + {"name":"0bitmap$188"}, + {"name":"0bitmap$196"} + ] }, { "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$96", @@ -2114,6 +3663,10 @@ "name":"fpp.compiler.codegen.AstJsonEncoder$$anon$98", "fields":[{"name":"0bitmap$91"}] }, +{ + "name":"fpp.compiler.codegen.ComponentDataProducts", + "fields":[{"name":"0bitmap$1"}] +}, { "name":"fpp.compiler.codegen.CppDocCppWriter$", "fields":[{"name":"0bitmap$1"}] diff --git a/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala b/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala index b32a59aa3..f608004c2 100644 --- a/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala +++ b/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala @@ -148,6 +148,18 @@ trait TypeExpressionAnalyzer } } + override def specContainerAnnotatedNode( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecContainer]] + ) = { + val (_, node, _) = aNode + val data = node.data + for { + a <- opt(exprNode)(a, data.id) + a <- opt(exprNode)(a, data.defaultPriority) + } yield a + } + override def specEventAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecEvent]]) = { val (_, node1, _) = node val data = node1.data @@ -193,10 +205,23 @@ trait TypeExpressionAnalyzer a <- opt(exprNode)(a, general.size) a <- opt(exprNode)(a, general.priority) } yield a - case _ => Right(a) + case special : Ast.SpecPortInstance.Special => + opt(exprNode)(a, special.priority) } } + override def specRecordAnnotatedNode( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecRecord]] + ) = { + val (_, node, _) = aNode + val data = node.data + for { + a <- typeNameNode(a, data.recordType) + a <- opt(exprNode)(a, data.id) + } yield a + } + override def specTlmChannelAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]) = { def limit(a: Analysis, value: Ast.SpecTlmChannel.Limit) = { val (_, e) = value diff --git a/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala b/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala index 2cd56fe0e..ae10413e2 100644 --- a/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala +++ b/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala @@ -93,7 +93,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { a <- opt(qualIdentNode(portUse))(a, general.port) a <- opt(exprNode)(a, general.priority) } yield a - case special : Ast.SpecPortInstance.Special => { + case special : Ast.SpecPortInstance.Special => // Construct the use implied by the special port val name = special.kind match { case Ast.SpecPortInstance.CommandRecv => "Cmd" @@ -102,6 +102,10 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { case Ast.SpecPortInstance.Event => "Log" case Ast.SpecPortInstance.ParamGet => "PrmGet" case Ast.SpecPortInstance.ParamSet => "PrmSet" + case Ast.SpecPortInstance.ProductGet => "DpGet" + case Ast.SpecPortInstance.ProductRecv => "DpResponse" + case Ast.SpecPortInstance.ProductRequest => "DpRequest" + case Ast.SpecPortInstance.ProductSend => "DpSend" case Ast.SpecPortInstance.Telemetry => "Tlm" case Ast.SpecPortInstance.TextEvent => "LogText" case Ast.SpecPortInstance.TimeGet => "Time" @@ -110,8 +114,10 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { val nodeList = identList.map(AstNode.create(_, node.id)) val qualIdent = Ast.QualIdent.fromNodeList(nodeList) val impliedUse = AstNode.create(qualIdent, node.id) - qualIdentNode(portUse)(a, impliedUse) - } + for { + a <- opt(exprNode)(a, special.priority) + a <- qualIdentNode(portUse)(a, impliedUse) + } yield a } } diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckComponentDefs.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckComponentDefs.scala index 16a8df8b5..0f178248a 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckComponentDefs.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckComponentDefs.scala @@ -38,6 +38,19 @@ object CheckComponentDefs yield a.copy(component = Some(component)) } + override def specContainerAnnotatedNode( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecContainer]] + ) = { + val data = aNode._2.data + for { + idOpt <- a.getNonnegativeBigIntValueOpt(data.id) + container <- Container.fromSpecContainer(a, aNode) + component <- a.component.get.addContainer(idOpt, container) + } + yield a.copy(component = Some(component)) + } + override def specEventAnnotatedNode( a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]] @@ -101,6 +114,19 @@ object CheckComponentDefs Right(a.copy(component = Some(component1))) } + override def specRecordAnnotatedNode( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecRecord]] + ) = { + val data = aNode._2.data + val record = Record.fromSpecRecord(a, aNode) + for { + idOpt <- a.getNonnegativeBigIntValueOpt(data.id) + component <- a.component.get.addRecord(idOpt, record) + } + yield a.copy(component = Some(component)) + } + override def specTlmChannelAnnotatedNode( a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]] diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala index 08c6de075..656cf8a77 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala @@ -116,7 +116,7 @@ object CheckExprTypes extends UseAnalyzer { override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt) = Right(a.assignType(node -> Type.Integer)) - + override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString) = Right(a.assignType(node -> Type.String(None))) @@ -130,7 +130,7 @@ object CheckExprTypes extends UseAnalyzer { for { _ <- Analysis.checkForDuplicateStructMember(getName)(e.members) a <- super.exprStructNode(a, node, e) - } + } yield { def visitor(members: Type.Struct.Members, node: AstNode[Ast.StructMember]): Type.Struct.Members = { val data = node.data @@ -165,6 +165,20 @@ object CheckExprTypes extends UseAnalyzer { yield a } + override def specContainerAnnotatedNode( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecContainer]] + ) = { + val (_, node, _) = aNode + val data = node.data + for { + a <- super.specContainerAnnotatedNode(a, aNode) + _ <- convertNodeToNumericOpt(a, data.id) + _ <- convertNodeToNumericOpt(a, data.defaultPriority) + } + yield a + } + override def specEventAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]]) = { val (_, node, _) = aNode val data = node.data @@ -226,8 +240,25 @@ object CheckExprTypes extends UseAnalyzer { _ <- convertNodeToNumericOpt(a, general.priority) } yield a - case _ => Right(a) + case special : Ast.SpecPortInstance.Special => + for { + a <- super.specPortInstanceAnnotatedNode(a, aNode) + _ <- convertNodeToNumericOpt(a, special.priority) + } yield a + } + } + + override def specRecordAnnotatedNode( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecRecord]] + ) = { + val (_, node, _) = aNode + val data = node.data + for { + a <- super.specRecordAnnotatedNode(a, aNode) + _ <- convertNodeToNumericOpt(a, data.id) } + yield a } override def specTlmChannelAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]) = { @@ -281,7 +312,7 @@ object CheckExprTypes extends UseAnalyzer { // Unqualified constant symbol: visit the constant definition // to ensure it has a type case Symbol.Constant(node) => defConstantAnnotatedNode(a, node) - // Unqualified enum symbol: if this is in scope, then we are in + // Unqualified enum symbol: if this is in scope, then we are in // the enum definition, so it already has a type case Symbol.EnumConstant(node) => Right(a) // Invalid use of a symbol in an expression @@ -312,7 +343,7 @@ object CheckExprTypes extends UseAnalyzer { } private def convertToNumeric(loc: Location, t: Type): Result.Result[Type] = { - if (t.isNumeric) Right(t) + if (t.isNumeric) Right(t) else if (t.isConvertibleTo(Type.Integer)) Right(Type.Integer) else { val error = SemanticError.InvalidType(loc, s"cannot convert $t to a numeric type") diff --git a/compiler/lib/src/main/scala/analysis/Semantics/Component.scala b/compiler/lib/src/main/scala/analysis/Semantics/Component.scala index bf170efcf..550dff0f2 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/Component.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/Component.scala @@ -30,15 +30,39 @@ case class Component( /** The list of port matching constraints */ portMatchingList: List[Component.PortMatching] = Nil, /** The next default parameter ID */ - defaultParamId: BigInt = 0 + defaultParamId: BigInt = 0, + /** The map from container ids to containers */ + containerMap: Map[Container.Id, Container] = Map(), + /** The next default container ID */ + defaultContainerId: BigInt = 0, + /** The map from record ids to records */ + recordMap: Map[Record.Id, Record] = Map(), + /** The next default record ID */ + defaultRecordId: BigInt = 0 ) { + /** Query whether the component has parameters */ + def hasParameters = this.paramMap.size > 0 + + /** Query whether the component has commands */ + def hasCommands = this.commandMap.size > 0 + + /** Query whether the component has events */ + def hasEvents = this.eventMap.size > 0 + + /** Query whether the component has telemetry */ + def hasTelemetry = this.tlmChannelMap.size > 0 + + /** Query whether the component has data products */ + def hasDataProducts = (this.recordMap.size + this.containerMap.size) > 0 + /** Gets the max identifier */ def getMaxId: BigInt = { def maxInMap[T](map: Map[BigInt, T]): BigInt = if (map.size == 0) -1 else map.keys.max val maxMap = Vector( commandMap, + containerMap, eventMap, paramMap, tlmChannelMap @@ -121,26 +145,43 @@ case class Component( } } - /** Add a telemetry channel */ - def addTlmChannel( - idOpt: Option[TlmChannel.Id], - tlmChannel: TlmChannel): - Result.Result[Component] = { - val id = idOpt.getOrElse(defaultTlmChannelId) - tlmChannelMap.get(id) match { - case Some(prevTlmChannel) => - val value = Analysis.displayIdValue(id) - val loc = tlmChannel.getLoc - val prevLoc = prevTlmChannel.getLoc - Left(SemanticError.DuplicateIdValue(value, loc, prevLoc)) + /** Add a dictionary element mapped by ID */ + private def addElementToIdMap[T]( + map: Map[BigInt, T], + id: BigInt, + element: T, + getLoc: T => Location + ): Result.Result[(Map[BigInt,T], BigInt)] = { + map.get(id) match { + case Some(prevElement) => + // Element already there: report the error + val idValue = Analysis.displayIdValue(id) + val loc = getLoc(element) + val prevLoc = getLoc(prevElement) + Left(SemanticError.DuplicateIdValue(idValue, loc, prevLoc)) case None => - val tlmChannelMap = this.tlmChannelMap + (id -> tlmChannel) - val component = this.copy( - tlmChannelMap = tlmChannelMap, - defaultTlmChannelId = id + 1 - ) - Right(component) + // New element: compute the new map and the new default ID + Right(map + (id -> element), id + 1) + } + } + + /** Add a data product container */ + def addContainer( + idOpt: Option[TlmChannel.Id], + container: Container + ): Result.Result[Component] = { + for { + result <- addElementToIdMap( + containerMap, + idOpt.getOrElse(defaultContainerId), + container, + _.getLoc + ) } + yield this.copy( + containerMap = result._1, + defaultContainerId = result._2 + ) } /** Add an event */ @@ -148,90 +189,178 @@ case class Component( idOpt: Option[Event.Id], event: Event ): Result.Result[Component] = { - val id = idOpt.getOrElse(defaultEventId) - eventMap.get(id) match { - case Some(prevEvent) => - val value = Analysis.displayIdValue(id) - val loc = event.getLoc - val prevLoc = prevEvent.getLoc - Left(SemanticError.DuplicateIdValue(value, loc, prevLoc)) - case None => - val eventMap = this.eventMap + (id -> event) - val component = this.copy(eventMap = eventMap, defaultEventId = id + 1) - Right(component) + for { + result <- addElementToIdMap( + eventMap, + idOpt.getOrElse(defaultEventId), + event, + _.getLoc + ) } + yield this.copy( + eventMap = result._1, + defaultEventId = result._2 + ) } /** Add a parameter */ - def addParam(idOpt: Option[Param.Id], param: Param): - Result.Result[Component] = { - val id = idOpt.getOrElse(defaultParamId) - paramMap.get(id) match { - case Some(prevParam) => - val value = Analysis.displayIdValue(id) - val loc = param.getLoc - val prevLoc = prevParam.getLoc - Left(SemanticError.DuplicateIdValue(value, loc, prevLoc)) - case None => - val paramMap = this.paramMap + (id -> param) - val component = this.copy( - paramMap = paramMap, - defaultParamId = id + 1 + def addParam( + idOpt: Option[Param.Id], + param: Param + ): Result.Result[Component] = { + for { + // Update the parameter map and the default parameter ID + result <- addElementToIdMap( + paramMap, + idOpt.getOrElse(defaultParamId), + param, + _.getLoc + ) + component <- Right( + this.copy( + paramMap = result._1, + defaultParamId = result._2 ) - val name = param.aNode._2.data.name - val saveCommand = Command.Param(param.aNode, Command.Param.Save) - val setCommand = Command.Param(param.aNode, Command.Param.Set) - for { - component <- component.addCommand(Some(param.setOpcode), setCommand) - component <- component.addCommand(Some(param.saveOpcode), saveCommand) - } - yield component + ) + // Add the implicit set and save commands + setCommand <- Right(Command.Param(param.aNode, Command.Param.Set)) + saveCommand <- Right(Command.Param(param.aNode, Command.Param.Save)) + component <- component.addCommand(Some(param.setOpcode), setCommand) + component <- component.addCommand(Some(param.saveOpcode), saveCommand) } + yield component } - /** Check that component provides ports required by dictionaries */ + /** Add a data product record */ + def addRecord( + idOpt: Option[Record.Id], + record: Record + ): Result.Result[Component] = { + for { + result <- addElementToIdMap( + recordMap, + idOpt.getOrElse(defaultRecordId), + record, + _.getLoc + ) + } + yield this.copy( + recordMap = result._1, + defaultRecordId = result._2 + ) + } + + /** Add a telemetry channel */ + def addTlmChannel( + idOpt: Option[TlmChannel.Id], + tlmChannel: TlmChannel + ): Result.Result[Component] = { + for { + result <- addElementToIdMap( + tlmChannelMap, + idOpt.getOrElse(defaultTlmChannelId), + tlmChannel, + _.getLoc + ) + } + yield this.copy( + tlmChannelMap = result._1, + defaultTlmChannelId = result._2 + ) + } + + /** Check that component provides ports required by dictionary + * and data product specifiers */ private def checkRequiredPorts: Result.Result[Unit] = { + import Ast.SpecPortInstance._ def requirePorts( - mapSize: Int, - specKind: String, + condition: Boolean, + specMsg: String, portKinds: List[Ast.SpecPortInstance.SpecialKind] - ) = if (mapSize > 0) Result.map( + ) = if (condition) Result.map( portKinds, (portKind: Ast.SpecPortInstance.SpecialKind) => this.specialPortMap.get(portKind) match { case Some(_) => Right(()) case None => val loc = Locations.get(this.aNode._2.id) - Left(SemanticError.MissingPort(loc, specKind, portKind.toString)) + val portMsg = s"${portKind.toString} port" + Left(SemanticError.MissingPort(loc, specMsg, portMsg)) } ) else Right(()) - import Ast.SpecPortInstance._ + def requireProductGetOrRequest = + if (this.hasDataProducts && + !this.specialPortMap.contains(ProductGet) && + !this.specialPortMap.contains(ProductRequest)) { + val loc = Locations.get(this.aNode._2.id) + val specMsg = "data product specifiers" + val portMsg = "product get port or product request port" + Left(SemanticError.MissingPort(loc, specMsg, portMsg)) + } + else Right(()) for { _ <- requirePorts( - this.paramMap.size, - "parameter", + this.hasParameters, + "parameter specifiers", List(ParamGet, ParamSet, CommandRecv, CommandReg, CommandResp) ) _ <- requirePorts( - this.commandMap.size, - "command", + this.hasCommands, + "command specifiers", List(CommandRecv, CommandReg, CommandResp) ) _ <- requirePorts( - this.eventMap.size, - "event", + this.hasEvents, + "event specifiers", List(Event, TextEvent, TimeGet) ) _ <- requirePorts( - this.tlmChannelMap.size, - "telemetry", + this.hasTelemetry, + "telemetry specifiers", List(Telemetry, TimeGet) ) + _ <- if (this.hasDataProducts) requireProductGetOrRequest else Right(()) + _ <- requirePorts( + this.hasDataProducts, + "data product specifiers", + List(ProductSend, TimeGet) + ) + _ <- requirePorts ( + this.specialPortMap.contains(ProductRequest), + "product request specifier", + List(ProductRecv) + ) } yield () } + /** Check that if there are any data products, then there are both containers + * and records */ + private def checkDataProducts: Result.Result[Unit] = + (recordMap.size, containerMap.size) match { + case (0, 0) => Right(()) + case (_, 0) => + val (_, record) = recordMap.head + val loc = Locations.get(record.aNode._2.id) + Left( + SemanticError.InvalidDataProducts( + loc, + "component that specifies records must specify at least one container" + ) + ) + case (0, _) => + val (_, container) = containerMap.head + val loc = Locations.get(container.aNode._2.id) + Left( + SemanticError.InvalidDataProducts( + loc, + "component that specifies containers must specify at least one record" + ) + ) + case _ => Right(()) + } + /** Checks that component has at least one async input port or async command */ private def checkAsyncInput: Result.Result[Unit] = checkNoAsyncInput match { @@ -252,10 +381,18 @@ case class Component( val loc = instance.getLoc val error = SemanticError.PassiveAsync(loc) instance match { - case PortInstance.General(_, _, PortInstance.General.Kind.AsyncInput(_, _), _, _) => - Left(error) + case general : PortInstance.General => + general.kind match { + case PortInstance.General.Kind.AsyncInput(_, _) => + Left(error) + case _ => Right(()) + } + case special : PortInstance.Special => + special.specifier.inputKind match { + case Some(Ast.SpecPortInstance.Async) => Left(error) + case _ => Right(()) + } case internal: PortInstance.Internal => Left(error) - case _ => Right(()) } } ) @@ -301,26 +438,38 @@ case class Component( _ <- checkDictionary( this.paramMap, "parameter", - (param: Param) => param.getName, - (param: Param) => param.getLoc + _.getName, + _.getLoc ) _ <- checkDictionary( this.commandMap, "command", - (command: Command) => command.getName, - (command: Command) => command.getLoc + _.getName, + _.getLoc ) _ <- checkDictionary( this.eventMap, "event", - (event: Event) => event.getName, - (event: Event) => event.getLoc + _.getName, + _.getLoc ) _ <- checkDictionary( this.tlmChannelMap, "telemetry channel", - (tlmChannel: TlmChannel) => tlmChannel.getName, - (tlmChannel: TlmChannel) => tlmChannel.getLoc + _.getName, + _.getLoc + ) + _ <- checkDictionary( + this.containerMap, + "container", + _.getName, + _.getLoc + ) + _ <- checkDictionary( + this.recordMap, + "record", + _.getName, + _.getLoc ) } yield () @@ -336,6 +485,7 @@ case class Component( case _ => checkAsyncInput } _ <- checkRequiredPorts + _ <- checkDataProducts } yield () } diff --git a/compiler/lib/src/main/scala/analysis/Semantics/Container.scala b/compiler/lib/src/main/scala/analysis/Semantics/Container.scala new file mode 100644 index 000000000..6826a94e8 --- /dev/null +++ b/compiler/lib/src/main/scala/analysis/Semantics/Container.scala @@ -0,0 +1,35 @@ +package fpp.compiler.analysis + +import fpp.compiler.ast._ +import fpp.compiler.util._ + +/** An FPP data product containter */ +final case class Container( + aNode: Ast.Annotated[AstNode[Ast.SpecContainer]], + defaultPriority: Option[BigInt] +) { + + /** Gets the name of the container */ + def getName = aNode._2.data.name + + /** Gets the location of the container */ + def getLoc: Location = Locations.get(aNode._2.id) + +} + +object Container { + + type Id = BigInt + + /** Creates a container from a container specifier */ + def fromSpecContainer(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecContainer]]): + Result.Result[Container] = { + val node = aNode._2 + val data = node.data + for { + defaultPriority <- a.getNonnegativeBigIntValueOpt(data.defaultPriority) + } + yield Container(aNode, defaultPriority) + } + +} diff --git a/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala b/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala index a6254be24..f41c5442a 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala @@ -50,7 +50,7 @@ object PortInstance { case None => "none" } /** Check whether types are compatible */ - def areCompatible(to1: Option[Type], to2: Option[Type]): Boolean = + def areCompatible(to1: Option[Type], to2: Option[Type]): Boolean = (to1, to2) match { case (Some(Type.Serial), _) => true case (_, Some(Type.Serial)) => true @@ -136,6 +136,7 @@ object PortInstance { import Ast.SpecPortInstance._ val direction = specifier.kind match { case CommandRecv => Direction.Input + case ProductRecv => Direction.Input case _ => Direction.Output } Some(direction) @@ -149,7 +150,7 @@ object PortInstance { } - final case class Internal( + final case class Internal( aNode: Ast.Annotated[AstNode[Ast.SpecInternalPort]], priority: Option[BigInt], queueFull: Ast.QueueFull @@ -199,81 +200,149 @@ object PortInstance { } } + /** Creates a general port instance */ + private def createGeneralPortInstance( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]], + specifier: Ast.SpecPortInstance.General + ) = { + for { + // Check the priority specifier + _ <- (specifier.kind, specifier.priority) match { + case (Ast.SpecPortInstance.AsyncInput, _) => Right(()) + case (_, Some(priority)) => + val loc = Locations.get(priority.id) + Left(SemanticError.InvalidPriority(loc)) + case (_, None) => Right(()) + } + // Check the queue full specifier + _ <- (specifier.kind, specifier.queueFull) match { + case (Ast.SpecPortInstance.AsyncInput, _) => Right(()) + case (_, Some(queueFull)) => + val loc = Locations.get(queueFull.id) + Left(SemanticError.InvalidQueueFull(loc)) + case (_, None) => Right(()) + } + // Get the size + size <- getArraySize(a, specifier.size) + // Get the priority + priority <- Right(a.getBigIntValueOpt(specifier.priority)) + // Get the type + ty <- specifier.port match { + case Some(qid) => a.useDefMap(qid.id) match { + case symbol @ Symbol.Port(_) => + Right(PortInstance.Type.DefPort(symbol)) + case symbol => Left(SemanticError.InvalidSymbol( + symbol.getUnqualifiedName, + Locations.get(qid.id), + "not a port symbol", + symbol.getLoc + )) + } + case None => Right(PortInstance.Type.Serial) + } + } + yield { + val kind = specifier.kind match { + case Ast.SpecPortInstance.AsyncInput => + val queueFull = Analysis.getQueueFull(specifier.queueFull.map(_.data)) + PortInstance.General.Kind.AsyncInput(priority, queueFull) + case Ast.SpecPortInstance.GuardedInput => + PortInstance.General.Kind.GuardedInput + case Ast.SpecPortInstance.Output => + PortInstance.General.Kind.Output + case Ast.SpecPortInstance.SyncInput => + PortInstance.General.Kind.SyncInput + } + PortInstance.General(aNode, specifier, kind, size, ty) + } + } + + /** Creates a special port instance */ + def createSpecialPortInstance( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]], + specifier: Ast.SpecPortInstance.Special + ) = { + val node = aNode._2 + val symbol @ Symbol.Port(_) = a.useDefMap(node.id) + val loc = Locations.get(node.id) + val kindString = specifier.kind.toString + for { + // Check the input kind + _ <- (specifier.inputKind, specifier.kind) match { + case (Some(_), Ast.SpecPortInstance.ProductRecv) => Right(()) + case (Some(_), _) => Left( + SemanticError.InvalidSpecialPort( + loc, + s"$kindString port may not specify input kind" + ) + ) + case (None, Ast.SpecPortInstance.ProductRecv) => Left( + SemanticError.InvalidSpecialPort( + loc, + s"$kindString port must specify input kind" + ) + ) + case _ => Right(()) + } + // Check the priority specifier + _ <- (specifier.inputKind, specifier.priority) match { + case (Some(Ast.SpecPortInstance.Async), _) => Right(()) + case (_, Some(priority)) => + val loc = Locations.get(priority.id) + Left(SemanticError.InvalidPriority(loc)) + case (_, None) => Right(()) + } + // Check the queue full specifier + _ <- (specifier.inputKind, specifier.queueFull) match { + case (Some(Ast.SpecPortInstance.Async), _) => Right(()) + case (_, Some(queueFull)) => + val loc = Locations.get(queueFull.id) + Left(SemanticError.InvalidQueueFull(loc)) + case (_, None) => Right(()) + } + // Get the priority + priority <- Right(a.getBigIntValueOpt(specifier.priority)) + } + yield { + val queueFull = specifier.kind match { + case Ast.SpecPortInstance.ProductRecv => + Some(Analysis.getQueueFull(specifier.queueFull.map(_.data))) + case _ => None + } + PortInstance.Special(aNode, specifier, symbol, priority, queueFull) + } + } + /** Creates a port instance from a port instance specifier */ - def fromSpecPortInstance(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): + def fromSpecPortInstance( + a: Analysis, + aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]] + ): Result.Result[PortInstance] = { val node = aNode._2 val data = node.data - /** Creates a general port instance */ - def general(a: Analysis, specifier: Ast.SpecPortInstance.General) = { - for { - _ <- (specifier.kind, specifier.priority) match { - case (Ast.SpecPortInstance.AsyncInput, _) => Right(()) - case (_, Some(priority)) => - val loc = Locations.get(priority.id) - Left(SemanticError.InvalidPriority(loc)) - case (_, None) => Right(()) - } - _ <- (specifier.kind, specifier.queueFull) match { - case (Ast.SpecPortInstance.AsyncInput, _) => Right(()) - case (_, Some(queueFull)) => - val loc = Locations.get(queueFull.id) - Left(SemanticError.InvalidQueueFull(loc)) - case (_, None) => Right(()) - } - size <- getArraySize(a, specifier.size) - priority <- Right(a.getBigIntValueOpt(specifier.priority)) - ty <- specifier.port match { - case Some(qid) => a.useDefMap(qid.id) match { - case symbol @ Symbol.Port(_) => - Right(PortInstance.Type.DefPort(symbol)) - case symbol => Left(SemanticError.InvalidSymbol( - symbol.getUnqualifiedName, - Locations.get(qid.id), - "not a port symbol", - symbol.getLoc - )) - } - case None => Right(PortInstance.Type.Serial) - } - } - yield { - val kind = specifier.kind match { - case Ast.SpecPortInstance.AsyncInput => - val queueFull = Analysis.getQueueFull(specifier.queueFull.map(_.data)) - PortInstance.General.Kind.AsyncInput(priority, queueFull) - case Ast.SpecPortInstance.GuardedInput => - PortInstance.General.Kind.GuardedInput - case Ast.SpecPortInstance.Output => - PortInstance.General.Kind.Output - case Ast.SpecPortInstance.SyncInput => - PortInstance.General.Kind.SyncInput - } - PortInstance.General(aNode, specifier, kind, size, ty) - } - } data match { case specifier : Ast.SpecPortInstance.General => for { - instance <- general(a, specifier) + instance <- createGeneralPortInstance(a, aNode, specifier) _ <- checkGeneralAsyncInput(instance) } yield instance case specifier : Ast.SpecPortInstance.Special => - val symbol @ Symbol.Port(_) = a.useDefMap(node.id) - Right(PortInstance.Special(aNode, specifier, symbol, None, None)) + createSpecialPortInstance(a, aNode, specifier) } - } /** Gets an array size from an AST node */ private def getArraySize(a: Analysis, sizeOpt: Option[AstNode[Ast.Expr]]): - Result.Result[Int] = + Result.Result[Int] = sizeOpt match { case Some(size) => a.getUnboundedArraySize(size.id) case None => Right(1) } - /** Checks general async input uses port definitions */ + /** Checks general async input port specifiers */ private def checkGeneralAsyncInput(instance: PortInstance.General) = { val loc = Locations.get(instance.aNode._2.id) def checkReturnType(defPort: Ast.DefPort, defLoc: Location) = { diff --git a/compiler/lib/src/main/scala/analysis/Semantics/Record.scala b/compiler/lib/src/main/scala/analysis/Semantics/Record.scala new file mode 100644 index 000000000..01cb773ee --- /dev/null +++ b/compiler/lib/src/main/scala/analysis/Semantics/Record.scala @@ -0,0 +1,34 @@ +package fpp.compiler.analysis + +import fpp.compiler.ast._ +import fpp.compiler.util._ + +/** An FPP data product containter */ +final case class Record( + aNode: Ast.Annotated[AstNode[Ast.SpecRecord]], + recordType: Type, + isArray: Boolean +) { + + /** Gets the name of the container */ + def getName = aNode._2.data.name + + /** Gets the location of the container */ + def getLoc: Location = Locations.get(aNode._2.id) + +} + +object Record { + + type Id = BigInt + + /** Creates a record from a record specifier */ + def fromSpecRecord(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecRecord]]): + Record = { + val node = aNode._2 + val data = node.data + val recordType = a.typeMap(data.recordType.id) + Record(aNode, recordType, data.isArray) + } + +} diff --git a/compiler/lib/src/main/scala/ast/Ast.scala b/compiler/lib/src/main/scala/ast/Ast.scala index 773361c95..9a191d760 100644 --- a/compiler/lib/src/main/scala/ast/Ast.scala +++ b/compiler/lib/src/main/scala/ast/Ast.scala @@ -57,12 +57,14 @@ object Ast { final case class DefEnum(node: AstNode[Ast.DefEnum]) extends Node final case class DefStruct(node: AstNode[Ast.DefStruct]) extends Node final case class SpecCommand(node: AstNode[Ast.SpecCommand]) extends Node + final case class SpecContainer(node: AstNode[Ast.SpecContainer]) extends Node final case class SpecEvent(node: AstNode[Ast.SpecEvent]) extends Node final case class SpecInclude(node: AstNode[Ast.SpecInclude]) extends Node final case class SpecInternalPort(node: AstNode[Ast.SpecInternalPort]) extends Node final case class SpecParam(node: AstNode[Ast.SpecParam]) extends Node final case class SpecPortInstance(node: AstNode[Ast.SpecPortInstance]) extends Node final case class SpecPortMatching(node: AstNode[Ast.SpecPortMatching]) extends Node + final case class SpecRecord(node: AstNode[Ast.SpecRecord]) extends Node final case class SpecTlmChannel(node: AstNode[Ast.SpecTlmChannel]) extends Node } @@ -376,6 +378,13 @@ object Ast { ) } + /** Container specifier */ + final case class SpecContainer( + name: Ident, + id: Option[AstNode[Expr]], + defaultPriority: Option[AstNode[Expr]] + ) + /** Event specifier */ final case class SpecEvent( name: Ident, @@ -537,6 +546,18 @@ object Ast { case object ParamSet extends SpecialKind { override def toString = "param set" } + case object ProductGet extends SpecialKind { + override def toString = "product get" + } + case object ProductRecv extends SpecialKind { + override def toString = "product recv" + } + case object ProductRequest extends SpecialKind { + override def toString = "product request" + } + case object ProductSend extends SpecialKind { + override def toString = "product send" + } case object Telemetry extends SpecialKind { override def toString = "telemetry" } @@ -555,6 +576,14 @@ object Ast { port2: AstNode[Ident] ) + /** Record specifier */ + final case class SpecRecord( + name: Ident, + recordType: AstNode[TypeName], + isArray: Boolean, + id: Option[AstNode[Expr]] + ) + /** Telemetry channel specifier */ final case class SpecTlmChannel( name: Ident, diff --git a/compiler/lib/src/main/scala/ast/AstTransformer.scala b/compiler/lib/src/main/scala/ast/AstTransformer.scala index 837de4adc..8b816f762 100644 --- a/compiler/lib/src/main/scala/ast/AstTransformer.scala +++ b/compiler/lib/src/main/scala/ast/AstTransformer.scala @@ -20,7 +20,7 @@ trait AstTransformer { def defAbsTypeAnnotatedNode( in: In, node: Ast.Annotated[AstNode[Ast.DefAbsType]] - ): ResultAnnotatedNode[Ast.DefAbsType] = + ): ResultAnnotatedNode[Ast.DefAbsType] = Right(default(in), node) def defArrayAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.DefArray]]): ResultAnnotatedNode[Ast.DefArray] = @@ -50,17 +50,17 @@ trait AstTransformer { ): ResultAnnotatedNode[Ast.DefModule] = Right(default(in), node) def defPortAnnotatedNode( - in: In, + in: In, node: Ast.Annotated[AstNode[Ast.DefPort]] ): ResultAnnotatedNode[Ast.DefPort] = Right(default(in), node) def defStructAnnotatedNode( - in: In, + in: In, node: Ast.Annotated[AstNode[Ast.DefStruct]] ): ResultAnnotatedNode[Ast.DefStruct] = Right(default(in), node) def defTopologyAnnotatedNode( - in: In, + in: In, node: Ast.Annotated[AstNode[Ast.DefTopology]] ): ResultAnnotatedNode[Ast.DefTopology] = Right(default(in), node) @@ -69,7 +69,7 @@ trait AstTransformer { def exprBinopNode(in: In, node: AstNode[Ast.Expr], e: Ast.ExprBinop): ResultNode[Ast.Expr] = Right(default(in), node) - + def exprDotNode(in: In, node: AstNode[Ast.Expr], e: Ast.ExprDot): ResultNode[Ast.Expr] = Right(default(in), node) @@ -102,6 +102,11 @@ trait AstTransformer { node: Ast.Annotated[AstNode[Ast.SpecCommand]] ): ResultAnnotatedNode[Ast.SpecCommand] = Right(default(in), node) + def specContainerAnnotatedNode( + in: In, + node: Ast.Annotated[AstNode[Ast.SpecContainer]] + ): ResultAnnotatedNode[Ast.SpecContainer] = Right(default(in), node) + def specCompInstanceAnnotatedNode( in: In, node: Ast.Annotated[AstNode[Ast.SpecCompInstance]] @@ -118,7 +123,7 @@ trait AstTransformer { ): ResultAnnotatedNode[Ast.SpecEvent] = Right(default(in), node) def specIncludeAnnotatedNode( - in: In, + in: In, node: Ast.Annotated[AstNode[Ast.SpecInclude]] ): ResultAnnotatedNode[Ast.SpecInclude] = Right(default(in), node) @@ -128,7 +133,7 @@ trait AstTransformer { ): ResultAnnotatedNode[Ast.SpecInit] = Right(default(in), node) def specInternalPortAnnotatedNode( - in: In, + in: In, node: Ast.Annotated[AstNode[Ast.SpecInternalPort]] ): ResultAnnotatedNode[Ast.SpecInternalPort] = Right(default(in), node) @@ -152,6 +157,11 @@ trait AstTransformer { node: Ast.Annotated[AstNode[Ast.SpecPortMatching]] ): ResultAnnotatedNode[Ast.SpecPortMatching] = Right(default(in), node) + def specRecordAnnotatedNode( + in: In, + node: Ast.Annotated[AstNode[Ast.SpecRecord]] + ): ResultAnnotatedNode[Ast.SpecRecord] = Right(default(in), node) + def specTlmChannelAnnotatedNode( in: In, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]] @@ -171,7 +181,7 @@ trait AstTransformer { def typeNameFloatNode(in: In, node: AstNode[Ast.TypeName], tn: Ast.TypeNameFloat): ResultNode[Ast.TypeName] = Right(default(in), node) - def typeNameIntNode(in: In, node: AstNode[Ast.TypeName], tn: Ast.TypeNameInt): ResultNode[Ast.TypeName] = + def typeNameIntNode(in: In, node: AstNode[Ast.TypeName], tn: Ast.TypeNameInt): ResultNode[Ast.TypeName] = Right(default(in), node) def typeNameQualIdentNode(in: In, node: AstNode[Ast.TypeName], tn: Ast.TypeNameQualIdent): ResultNode[Ast.TypeName] = @@ -182,7 +192,7 @@ trait AstTransformer { final def matchComponentMember(in: In, member: Ast.ComponentMember): Result[Ast.ComponentMember] = { def transform[T]( - result: ResultAnnotatedNode[T], + result: ResultAnnotatedNode[T], f: AstNode[T] => Ast.ComponentMember.Node ) = { for { pair <- result } yield { @@ -192,31 +202,35 @@ trait AstTransformer { } val (pre, node, post) = member.node node match { - case Ast.ComponentMember.DefAbsType(node1) => + case Ast.ComponentMember.DefAbsType(node1) => transform(defAbsTypeAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.DefAbsType(_)) - case Ast.ComponentMember.DefArray(node1) => + case Ast.ComponentMember.DefArray(node1) => transform(defArrayAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.DefArray(_)) - case Ast.ComponentMember.DefConstant(node1) => + case Ast.ComponentMember.DefConstant(node1) => transform(defConstantAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.DefConstant(_)) - case Ast.ComponentMember.DefEnum(node1) => + case Ast.ComponentMember.DefEnum(node1) => transform(defEnumAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.DefEnum(_)) - case Ast.ComponentMember.DefStruct(node1) => + case Ast.ComponentMember.DefStruct(node1) => transform(defStructAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.DefStruct(_)) - case Ast.ComponentMember.SpecCommand(node1) => + case Ast.ComponentMember.SpecCommand(node1) => transform(specCommandAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecCommand(_)) - case Ast.ComponentMember.SpecEvent(node1) => + case Ast.ComponentMember.SpecContainer(node1) => + transform(specContainerAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecContainer(_)) + case Ast.ComponentMember.SpecEvent(node1) => transform(specEventAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecEvent(_)) - case Ast.ComponentMember.SpecInclude(node1) => + case Ast.ComponentMember.SpecInclude(node1) => transform(specIncludeAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecInclude(_)) - case Ast.ComponentMember.SpecInternalPort(node1) => + case Ast.ComponentMember.SpecInternalPort(node1) => transform(specInternalPortAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecInternalPort(_)) - case Ast.ComponentMember.SpecParam(node1) => + case Ast.ComponentMember.SpecParam(node1) => transform(specParamAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecParam(_)) - case Ast.ComponentMember.SpecPortInstance(node1) => + case Ast.ComponentMember.SpecPortInstance(node1) => transform(specPortInstanceAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecPortInstance(_)) - case Ast.ComponentMember.SpecPortMatching(node1) => + case Ast.ComponentMember.SpecPortMatching(node1) => transform(specPortMatchingAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecPortMatching(_)) - case Ast.ComponentMember.SpecTlmChannel(node1) => + case Ast.ComponentMember.SpecRecord(node1) => + transform(specRecordAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecRecord(_)) + case Ast.ComponentMember.SpecTlmChannel(node1) => transform(specTlmChannelAnnotatedNode(in, (pre, node1, post)), Ast.ComponentMember.SpecTlmChannel(_)) } } @@ -238,7 +252,7 @@ trait AstTransformer { final def matchModuleMember(in: In, member: Ast.ModuleMember): Result[Ast.ModuleMember] = { def transform[T]( - result: ResultAnnotatedNode[T], + result: ResultAnnotatedNode[T], f: AstNode[T] => Ast.ModuleMember.Node ) = { for { pair <- result } yield { @@ -248,36 +262,36 @@ trait AstTransformer { } val (pre, node, post) = member.node node match { - case Ast.ModuleMember.DefAbsType(node1) => + case Ast.ModuleMember.DefAbsType(node1) => transform(defAbsTypeAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefAbsType(_)) - case Ast.ModuleMember.DefArray(node1) => + case Ast.ModuleMember.DefArray(node1) => transform(defArrayAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefArray(_)) - case Ast.ModuleMember.DefComponent(node1) => + case Ast.ModuleMember.DefComponent(node1) => transform(defComponentAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefComponent(_)) - case Ast.ModuleMember.DefComponentInstance(node1) => + case Ast.ModuleMember.DefComponentInstance(node1) => transform(defComponentInstanceAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefComponentInstance(_)) - case Ast.ModuleMember.DefConstant(node1) => + case Ast.ModuleMember.DefConstant(node1) => transform(defConstantAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefConstant(_)) - case Ast.ModuleMember.DefEnum(node1) => + case Ast.ModuleMember.DefEnum(node1) => transform(defEnumAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefEnum(_)) - case Ast.ModuleMember.DefModule(node1) => + case Ast.ModuleMember.DefModule(node1) => transform(defModuleAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefModule(_)) - case Ast.ModuleMember.DefPort(node1) => + case Ast.ModuleMember.DefPort(node1) => transform(defPortAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefPort(_)) - case Ast.ModuleMember.DefStruct(node1) => + case Ast.ModuleMember.DefStruct(node1) => transform(defStructAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefStruct(_)) - case Ast.ModuleMember.DefTopology(node1) => + case Ast.ModuleMember.DefTopology(node1) => transform(defTopologyAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.DefTopology(_)) - case Ast.ModuleMember.SpecInclude(node1) => + case Ast.ModuleMember.SpecInclude(node1) => transform(specIncludeAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.SpecInclude(_)) - case Ast.ModuleMember.SpecLoc(node1) => + case Ast.ModuleMember.SpecLoc(node1) => transform(specLocAnnotatedNode(in, (pre, node1, post)), Ast.ModuleMember.SpecLoc(_)) } } final def matchTopologyMember(in: In, member: Ast.TopologyMember): Result[Ast.TopologyMember] = { def transform[T]( - result: ResultAnnotatedNode[T], + result: ResultAnnotatedNode[T], f: AstNode[T] => Ast.TopologyMember.Node ) = { for (pair <- result) yield { @@ -287,18 +301,18 @@ trait AstTransformer { } val (pre, node, post) = member.node node match { - case Ast.TopologyMember.SpecCompInstance(node1) => + case Ast.TopologyMember.SpecCompInstance(node1) => transform(specCompInstanceAnnotatedNode(in, (pre, node1, post)), Ast.TopologyMember.SpecCompInstance(_)) - case Ast.TopologyMember.SpecConnectionGraph(node1) => + case Ast.TopologyMember.SpecConnectionGraph(node1) => transform(specConnectionGraphAnnotatedNode(in, (pre, node1, post)), Ast.TopologyMember.SpecConnectionGraph(_)) - case Ast.TopologyMember.SpecInclude(node1) => + case Ast.TopologyMember.SpecInclude(node1) => transform(specIncludeAnnotatedNode(in, (pre, node1, post)), Ast.TopologyMember.SpecInclude(_)) - case Ast.TopologyMember.SpecTopImport(node1) => + case Ast.TopologyMember.SpecTopImport(node1) => transform(specTopImportAnnotatedNode(in, (pre, node1, post)), Ast.TopologyMember.SpecTopImport(_)) } } - final def matchTuMember(in: In, member: Ast.TUMember): Result[Ast.TUMember] = + final def matchTuMember(in: In, member: Ast.TUMember): Result[Ast.TUMember] = matchModuleMember(in, member) final def matchTypeName(in: In, node: AstNode[Ast.TypeName]): ResultNode[Ast.TypeName] = diff --git a/compiler/lib/src/main/scala/ast/AstVisitor.scala b/compiler/lib/src/main/scala/ast/AstVisitor.scala index 52d124633..5cec6e7f2 100644 --- a/compiler/lib/src/main/scala/ast/AstVisitor.scala +++ b/compiler/lib/src/main/scala/ast/AstVisitor.scala @@ -32,7 +32,7 @@ trait AstVisitor { def exprArrayNode(in: In, node: AstNode[Ast.Expr], e: Ast.ExprArray): Out = default(in) def exprBinopNode(in: In, node: AstNode[Ast.Expr], e: Ast.ExprBinop): Out = default(in) - + def exprDotNode(in: In, node: AstNode[Ast.Expr], e: Ast.ExprDot): Out = default(in) def exprIdentNode(in: In, node: AstNode[Ast.Expr], e: Ast.ExprIdent): Out = default(in) @@ -57,6 +57,8 @@ trait AstVisitor { def specConnectionGraphAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecConnectionGraph]]): Out = default(in) + def specContainerAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecContainer]]): Out = default(in) + def specEventAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecEvent]]): Out = default(in) def specIncludeAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecInclude]]): Out = default(in) @@ -73,6 +75,8 @@ trait AstVisitor { def specPortMatchingAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecPortMatching]]): Out = default(in) + def specRecordAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecRecord]]): Out = default(in) + def specTlmChannelAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]): Out = default(in) def specTopImportAnnotatedNode(in: In, node: Ast.Annotated[AstNode[Ast.SpecTopImport]]): Out = default(in) @@ -98,12 +102,14 @@ trait AstVisitor { case Ast.ComponentMember.DefEnum(node1) => defEnumAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.DefStruct(node1) => defStructAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecCommand(node1) => specCommandAnnotatedNode(in, (pre, node1, post)) + case Ast.ComponentMember.SpecContainer(node1) => specContainerAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecEvent(node1) => specEventAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecInclude(node1) => specIncludeAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecInternalPort(node1) => specInternalPortAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecParam(node1) => specParamAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecPortInstance(node1) => specPortInstanceAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecPortMatching(node1) => specPortMatchingAnnotatedNode(in, (pre, node1, post)) + case Ast.ComponentMember.SpecRecord(node1) => specRecordAnnotatedNode(in, (pre, node1, post)) case Ast.ComponentMember.SpecTlmChannel(node1) => specTlmChannelAnnotatedNode(in, (pre, node1, post)) } } @@ -151,7 +157,7 @@ trait AstVisitor { } } - final def matchTuMember(in: In, member: Ast.TUMember): Out = + final def matchTuMember(in: In, member: Ast.TUMember): Out = matchModuleMember(in, member) final def matchTypeNameNode(in: In, node: AstNode[Ast.TypeName]): Out = diff --git a/compiler/lib/src/main/scala/codegen/AstWriter.scala b/compiler/lib/src/main/scala/codegen/AstWriter.scala index c69971ac7..843223eb5 100644 --- a/compiler/lib/src/main/scala/codegen/AstWriter.scala +++ b/compiler/lib/src/main/scala/codegen/AstWriter.scala @@ -297,6 +297,20 @@ object AstWriter extends AstVisitor with LineUtils { } } + override def specContainerAnnotatedNode( + in: In, + aNode: Ast.Annotated[AstNode[Ast.SpecContainer]] + ) = { + val (_, node, _) = aNode + val data = node.data + lines("spec container") ++ + List( + ident(data.name), + linesOpt(addPrefix("id", exprNode), data.id), + linesOpt(addPrefix("default priority", exprNode), data.defaultPriority) + ).flatten.map(indentIn) + } + override def specEventAnnotatedNode( in: In, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]] @@ -390,7 +404,16 @@ object AstWriter extends AstVisitor with LineUtils { def special(i: Ast.SpecPortInstance.Special) = { val kind = lines(s"kind ${i.kind.toString}") lines("spec port instance special") ++ - (kind ++ ident(i.name)).map(indentIn) + List( + linesOpt( + addPrefix("input kind", string), + i.inputKind.map(_.toString) + ), + kind, + ident(i.name), + linesOpt(addPrefix("priority", exprNode), i.priority), + linesOpt(applyToData(queueFull), i.queueFull) + ).flatten.map(indentIn) } node.data match { case i : Ast.SpecPortInstance.General => general(i) @@ -411,6 +434,23 @@ object AstWriter extends AstVisitor with LineUtils { ).flatten.map(indentIn) } + override def specRecordAnnotatedNode( + in: In, + aNode: Ast.Annotated[AstNode[Ast.SpecRecord]] + ) = { + val (_, node, _) = aNode + val data = node.data + val writeRecordType = if data.isArray + then addSuffix(typeNameNode, "array") + else typeNameNode + lines("spec record") ++ + List( + ident(data.name), + writeRecordType(data.recordType), + linesOpt(addPrefix("id", exprNode), data.id) + ).flatten.map(indentIn) + } + override def specTlmChannelAnnotatedNode( in: In, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]] @@ -496,6 +536,12 @@ object AstWriter extends AstVisitor with LineUtils { ): T => Out = (t: T) => Line.joinLists (Line.Indent) (lines(s)) (" ") (f(t)) + private def addSuffix[T]( + f: T => Out, + s: String + ): T => Out = + (t: T) => Line.joinLists (Line.Indent) (f(t)) (" ") (lines(s)) + private def annotate( pre: List[String], lines: Out, diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala index 3d68a12dd..979bba9af 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala @@ -13,6 +13,8 @@ case class ComponentCppWriter ( private val fileName = ComputeCppFiles.FileNames.getComponent(name) + private val dpWriter = ComponentDataProducts(s, aNode) + private val portWriter = ComponentPorts(s, aNode) private val cmdWriter = ComponentCommands(s, aNode) @@ -74,24 +76,22 @@ case class ComponentCppWriter ( private def getHppIncludes: CppDoc.Member = { // Conditional headers - val mutexHeader = - if hasGuardedInputPorts || hasGuardedCommands || hasParameters then List("Os/Mutex.hpp") - else Nil - val cmdStrHeader = - if hasCommands || hasParameters then List("Fw/Cmd/CmdString.hpp") - else Nil - val tlmStrHeader = - if hasChannels then List("Fw/Tlm/TlmString.hpp") - else Nil - val prmStrHeader = - if hasParameters then List("Fw/Prm/PrmString.hpp") - else Nil - val logStrHeader = - if hasEvents then List("Fw/Log/LogString.hpp") - else Nil - val internalStrHeader = - if hasInternalPorts then List("Fw/Types/InternalInterfaceString.hpp") - else Nil + val dpHeaders = + guardedList (hasDataProducts) (List("Fw/Dp/DpContainer.hpp")) + val mutexHeaders = + guardedList (hasGuardedInputPorts || hasGuardedCommands || hasParameters) ( + List("Os/Mutex.hpp") + ) + val cmdStrHeaders = + guardedList (hasCommands || hasParameters) (List("Fw/Cmd/CmdString.hpp")) + val tlmStrHeaders = + guardedList (hasChannels) (List("Fw/Tlm/TlmString.hpp")) + val prmStrHeaders = + guardedList (hasParameters) (List("Fw/Prm/PrmString.hpp")) + val logStrHeaders = + guardedList (hasEvents) (List("Fw/Log/LogString.hpp")) + val internalStrHeaders = + guardedList (hasInternalPorts) (List("Fw/Types/InternalInterfaceString.hpp")) val standardHeaders = List.concat( List( @@ -100,12 +100,13 @@ case class ComponentCppWriter ( "Fw/Port/OutputSerializePort.hpp", "Fw/Comp/ActiveComponentBase.hpp" ), - mutexHeader, - cmdStrHeader, - tlmStrHeader, - prmStrHeader, - logStrHeader, - internalStrHeader + dpHeaders, + mutexHeaders, + cmdStrHeaders, + tlmStrHeaders, + prmStrHeaders, + logStrHeaders, + internalStrHeaders ).map(CppWriter.headerString) val symbolHeaders = writeIncludeDirectives val headers = standardHeaders ++ symbolHeaders @@ -174,6 +175,9 @@ case class ComponentCppWriter ( // Anonymous namespace members getAnonymousNamespaceMembers, + // Types + dpWriter.getTypeMembers, + // Public function members getPublicComponentFunctionMembers, portWriter.getPublicFunctionMembers, @@ -188,6 +192,8 @@ case class ComponentCppWriter ( eventWriter.getFunctionMembers, tlmWriter.getFunctionMembers, paramWriter.getProtectedFunctionMembers, + dpWriter.getProtectedDpFunctionMembers, + dpWriter.getVirtualFunctionMembers, getTimeFunctionMember, getMutexOperationMembers, @@ -197,6 +203,7 @@ case class ComponentCppWriter ( // Private function members portWriter.getPrivateFunctionMembers, paramWriter.getPrivateFunctionMembers, + dpWriter.getPrivateDpFunctionMembers, // Member variables portWriter.getVariableMembers, @@ -275,6 +282,7 @@ case class ComponentCppWriter ( "enum MsgTypeEnum {", List.concat( lines(s"$exitConstantName = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT"), + dataProductAsyncInputPorts.map(portCppConstantName), typedAsyncInputPorts.map(portCppConstantName), serialAsyncInputPorts.map(portCppConstantName), asyncCmds.map((_, cmd) => commandCppConstantName(cmd)), @@ -291,8 +299,8 @@ case class ComponentCppWriter ( // Collect the serialized sizes of all the async port arguments // For each one, add a byte array of that size as a member val members = List.concat( - // Typed async input ports - typedAsyncInputPorts.flatMap(p => { + // Data product and typed async input ports + (dataProductAsyncInputPorts ++ typedAsyncInputPorts).flatMap(p => { val portName = p.getUnqualifiedName val portTypeName = getQualifiedPortTypeName(p, p.getDirection.get) lines(s"BYTE ${portName}PortSize[${portTypeName}::SERIALIZED_SIZE];") @@ -797,6 +805,7 @@ case class ComponentCppWriter ( "msgType", intersperseBlankLines( List( + intersperseBlankLines(dataProductAsyncInputPorts.map(writeAsyncPortDispatch)), intersperseBlankLines(typedAsyncInputPorts.map(writeAsyncPortDispatch)), intersperseBlankLines(serialAsyncInputPorts.map(writeAsyncPortDispatch)), intersperseBlankLines(asyncCmds.map(writeAsyncCommandDispatch)), diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriterUtils.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriterUtils.scala index 8bc649b61..fc906ccf4 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriterUtils.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriterUtils.scala @@ -75,16 +75,31 @@ abstract class ComponentCppWriterUtils( val specialInputPorts: List[PortInstance.Special] = filterByPortDirection(specialPorts, PortInstance.Direction.Input) + /** List of data product input port instances */ + val dataProductInputPorts: List[PortInstance.Special] = + specialInputPorts.filter(pi => pi.specifier.kind == Ast.SpecPortInstance.ProductRecv) + /** List of special output port instances */ val specialOutputPorts: List[PortInstance.Special] = filterByPortDirection(specialPorts, PortInstance.Direction.Output) + /** List of data product output port instances */ + val dataProductOutputPorts: List[PortInstance.Special] = + specialOutputPorts.filter(pi => { + pi.specifier.kind == Ast.SpecPortInstance.ProductGet || + pi.specifier.kind == Ast.SpecPortInstance.ProductRequest || + pi.specifier.kind == Ast.SpecPortInstance.ProductSend + }) + /** List of typed input ports */ val typedInputPorts: List[PortInstance.General] = filterTypedPorts(generalInputPorts) /** List of serial input ports */ val serialInputPorts: List[PortInstance.General] = filterSerialPorts(generalInputPorts) + /** List of data product async input ports */ + val dataProductAsyncInputPorts: List[PortInstance.Special] = filterAsyncSpecialPorts(dataProductInputPorts) + /** List of typed async input ports */ val typedAsyncInputPorts: List[PortInstance.General] = filterAsyncInputPorts(typedInputPorts) @@ -176,6 +191,22 @@ abstract class ComponentCppWriterUtils( val timeGetPort: Option[PortInstance.Special] = component.specialPortMap.get(Ast.SpecPortInstance.TimeGet) + /** Data product get port */ + val productGetPort: Option[PortInstance.Special] = + component.specialPortMap.get(Ast.SpecPortInstance.ProductGet) + + /** Data product request port */ + val productRequestPort: Option[PortInstance.Special] = + component.specialPortMap.get(Ast.SpecPortInstance.ProductRequest) + + /** Data product send port */ + val productSendPort: Option[PortInstance.Special] = + component.specialPortMap.get(Ast.SpecPortInstance.ProductSend) + + /** Data product receive port */ + val productRecvPort: Option[PortInstance.Special] = + component.specialPortMap.get(Ast.SpecPortInstance.ProductRecv) + /** Event port */ val eventPort: Option[PortInstance.Special] = component.specialPortMap.get(Ast.SpecPortInstance.Event) @@ -196,6 +227,14 @@ abstract class ComponentCppWriterUtils( val prmSetPort: Option[PortInstance.Special] = component.specialPortMap.get(Ast.SpecPortInstance.ParamSet) + val containersById = component.containerMap.toList.sortBy(_._1) + + val containersByName = component.containerMap.toList.sortBy(_._2.getName) + + val recordsById = component.recordMap.toList.sortBy(_._1) + + val recordsByName = component.recordMap.toList.sortBy(_._2.getName) + // Component properties val hasGuardedInputPorts: Boolean = generalInputPorts.exists(p => @@ -223,6 +262,16 @@ abstract class ComponentCppWriterUtils( val hasParameters: Boolean = component.paramMap.nonEmpty + val hasDataProducts: Boolean = component.hasDataProducts + + val hasContainers: Boolean = containersByName != Nil + + val hasProductGetPort: Boolean = productGetPort.isDefined + + val hasProductRecvPort: Boolean = productRecvPort.isDefined + + val hasProductRequestPort: Boolean = productRequestPort.isDefined + /** Parameters for the init function */ val initParams: List[CppDoc.Function.Param] = List.concat( if data.kind != Ast.ComponentKind.Passive then List( @@ -611,6 +660,10 @@ abstract class ComponentCppWriterUtils( def outputPortInvokerName(name: String) = s"${name}_out" + /** Get the name for an output port invocation function */ + def outputPortInvokerName(pi: PortInstance): String = + outputPortInvokerName(pi.getUnqualifiedName) + /** Get the name for an internal interface handler */ def internalInterfaceHandlerName(name: String) = s"${name}_internalInterfaceHandler" @@ -682,6 +735,30 @@ abstract class ComponentCppWriterUtils( /** Guards an option type with a Boolean condition */ def guardedOption[T] = guardedValue (None: Option[T]) _ + /** Gets a data product receive handler */ + def getDpRecvHandler(name: String, body: List[Line] = Nil) = + functionClassMember( + Some(s"Receive a container of type $name"), + s"dpRecv_${name}_handler", + List( + CppDoc.Function.Param( + CppDoc.Type("DpContainer&"), + "container", + Some("The container") + ), + CppDoc.Function.Param( + CppDoc.Type("Fw::Success::T"), + "status", + Some("The container status") + ) + ), + CppDoc.Type("void"), + body, + body match { + case Nil => CppDoc.Function.PureVirtual + case _ => CppDoc.Function.Override + } + ) private def getPortTypeBaseName( p: PortInstance, ): String = { @@ -741,6 +818,15 @@ abstract class ComponentCppWriterUtils( } ) + private def filterAsyncSpecialPorts(ports: List[PortInstance.Special]) = + ports.filter(p => + p.specifier.inputKind match { + case Some(Ast.SpecPortInstance.Async) => true + case _ => false + } + ) + + } object ComponentCppWriterUtils { diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala new file mode 100644 index 000000000..666d4d9d8 --- /dev/null +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -0,0 +1,492 @@ +package fpp.compiler.codegen + +import fpp.compiler.analysis._ +import fpp.compiler.ast._ +import fpp.compiler.codegen._ + +/** Writes out C++ for component data products */ +case class ComponentDataProducts ( + s: CppWriterState, + aNode: Ast.Annotated[AstNode[Ast.DefComponent]] +) extends ComponentCppWriterUtils(s, aNode) { + + def getTypeMembers: List[CppDoc.Class.Member] = + addAccessTagAndComment( + "PROTECTED", + "Types for data products", + List.concat( + getContainerIds, + getContainerPriorities, + getRecordIds, + Container.getContainer + ) + ) + + def getVirtualFunctionMembers: List[CppDoc.Class.Member] = + addAccessTagAndComment( + "PROTECTED", + "Handlers to implement for data products", + containersByName.map((id, container) => getDpRecvHandler(container.getName)), + CppDoc.Lines.Hpp + ) + + def getProtectedDpFunctionMembers: List[CppDoc.Class.Member] = { + lazy val dpGetByName = containersByName.map((_, c) => { + val name = c.getName + linesClassMember( + lines( + s"""| + |//! Get a buffer and use it to initialize container $name + |//! \\return The status of the buffer request + |Fw::Success::T dpGet_$name( + | FwSizeType size, //!< The buffer size (input) + | DpContainer& container //!< The container (output) + |) { + | return this->dpGet(ContainerId::$name, size, container); + |}""" + ) + ) + }) + lazy val dpRequestByName = containersByName.map((_, c) => { + val name = c.getName + linesClassMember( + lines( + s"""| + |//! Request a $name container + |void dpRequest_$name( + | FwSizeType size //!< The buffer size (input) + |) { + | return this->dpRequest(ContainerId::$name, size); + |}""" + ) + ) + }) + lazy val dpSendFunction = functionClassMember( + Some("Send a data product"), + "dpSend", + List( + CppDoc.Function.Param( + CppDoc.Type("DpContainer&"), + "container", + Some("The data product container") + ), + CppDoc.Function.Param( + CppDoc.Type("Fw::Time"), + "timeTag", + Some("The time tag"), + Some("Fw::ZERO_TIME") + ) + ), + CppDoc.Type("void"), + { + val invokeProductSend = outputPortInvokerName(productSendPort.get) + lines( + s"""|// Update the time tag + |if (timeTag == Fw::ZERO_TIME) { + | // Get the time from the time port + | timeTag = this->getTime(); + |} + |container.setTimeTag(timeTag); + |// Serialize the header into the packet + |Fw::SerializeStatus status = container.serializeHeader(); + |FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + |// Update the size of the buffer according to the data size + |const FwSizeType packetSize = container.getPacketSize(); + |Fw::Buffer buffer = container.getBuffer(); + |FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + |buffer.setSize(packetSize); + |// Send the buffer + |this->$invokeProductSend(0, container.getId(), buffer);""" + ) + } + ) + addAccessTagAndComment( + "PROTECTED", + "Functions for managing data products", + guardedList (hasDataProducts) ( + List.concat( + guardedList (hasProductGetPort) (dpGetByName), + guardedList (hasProductRequestPort) (dpRequestByName), + List(dpSendFunction) + ) + ) + ) + } + + def getPrivateDpFunctionMembers: List[CppDoc.Class.Member] = { + lazy val dpGet = functionClassMember( + Some(raw"""|Get a buffer and use it to initialize a data product container + |\return The status of the buffer request"""), + "dpGet", + List( + CppDoc.Function.Param( + CppDoc.Type("ContainerId::T"), + "containerId", + Some("The component-local container id (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("FwSizeType"), + "size", + Some("The buffer size (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("DpContainer&"), + "container", + Some("The container (output)") + ) + ), + CppDoc.Type("Fw::Success::T"), + { + val invokeProductGet = outputPortInvokerName(productGetPort.get) + lines(s"""|const FwDpIdType baseId = this->getIdBase(); + |const FwDpIdType globalId = baseId + containerId; + |Fw::Buffer buffer; + |const Fw::Success::T status = this->$invokeProductGet(0, globalId, size, buffer); + |if (status == Fw::Success::SUCCESS) { + | container.setId(globalId); + | container.setBuffer(buffer); + | container.setBaseId(baseId); + |} + |return status;""") + } + ) + lazy val dpRequest = functionClassMember( + Some("Request a data product container"), + "dpRequest", + List( + CppDoc.Function.Param( + CppDoc.Type("ContainerId::T"), + "containerId", + Some("The component-local container id") + ), + CppDoc.Function.Param( + CppDoc.Type("FwSizeType"), + "size", + Some("The buffer size") + ) + ), + CppDoc.Type("void"), + { + val invokeProductRequest = outputPortInvokerName(productRequestPort.get) + lines( + s"""|const FwDpIdType globalId = this->getIdBase() + containerId; + |this->$invokeProductRequest(0, globalId, size);""" + ) + } + ) + def getDpRecvHandler(portInstance: PortInstance) = { + val portName = portInstance.getUnqualifiedName + functionClassMember( + Some(s"Handler implementation for ${portName}"), + s"${portName}_handler", + List( + CppDoc.Function.Param( + CppDoc.Type("const NATIVE_INT_TYPE"), + "portNum", + Some("The port number") + ), + CppDoc.Function.Param( + CppDoc.Type("FwDpIdType"), + "id", + Some("The container id") + ), + CppDoc.Function.Param( + CppDoc.Type("const Fw::Buffer&"), + "buffer", + Some("The buffer") + ), + CppDoc.Function.Param( + CppDoc.Type("const Fw::Success&"), + "status", + Some("The buffer status") + ) + ), + CppDoc.Type("void"), + if hasDataProducts then + List.concat( + lines( + """|DpContainer container(id, buffer, this->getIdBase()); + |// Convert global id to local id + |const FwDpIdType idBase = this->getIdBase(); + |FW_ASSERT(id >= idBase, id, idBase); + |const FwDpIdType localId = id - idBase; + |// Switch on the local id""" + ), + wrapInSwitch( + "localId", + List.concat( + containersById.flatMap((id, container) => { + val name = container.getName + lines( + s"""|case ContainerId::$name: + | // Set the priority + | container.setPriority(ContainerPriority::$name); + | // Call the handler + | this->dpRecv_${name}_handler(container, status.e); + | break;""" + ) + }), + lines ( + """|default: + | FW_ASSERT(0); + | break;""" + ) + ) + ) + ) + else lines("""|(void) portNum; + |(void) id; + |(void) buffer; + |(void) status; + |// No data products defined""") + ) + } + addAccessTagAndComment( + "PRIVATE", + "Private data product handling functions", + List.concat( + guardedList (hasContainers && hasProductGetPort) (List(dpGet)), + guardedList (hasContainers && hasProductRequestPort) (List(dpRequest)), + productRecvPort.map(getDpRecvHandler).map(List(_)).getOrElse(Nil) + ) + ) + } + + private def getContainerIds = containersById match { + case Nil => Nil + case _ => List( + linesClassMember( + CppDocWriter.writeDoxygenComment("The container ids") ++ + wrapInNamedStruct( + "ContainerId", + wrapInNamedEnum( + "T : FwDpIdType", + containersById.flatMap((id, container) => + writeEnumConstant(container.getName, id) + ) + ) + ) + ) + ) + } + + private def getContainerPriorities = containersById match { + case Nil => Nil + case _ => List( + linesClassMember( + CppDocWriter.writeDoxygenComment("The container default priorities") ++ + wrapInNamedStruct( + "ContainerPriority", + wrapInNamedEnum( + "T : FwDpPriorityType", + containersById.flatMap((id, container) => { + val priority = container.defaultPriority.getOrElse(BigInt(0)) + writeEnumConstant(container.getName, priority) + }) + ) + ) + ) + ) + } + + private def getRecordIds = recordsById match { + case Nil => Nil + case _ => List( + linesClassMember( + CppDocWriter.writeDoxygenComment("The record ids") ++ + wrapInNamedStruct( + "RecordId", + wrapInNamedEnum( + "T : FwDpIdType", + recordsById.flatMap((id, container) => + writeEnumConstant(container.getName, id) + ) + ) + ) + ) + ) + } + + /** Generates the Container inner class */ + private object Container extends ComponentCppWriterUtils(s, aNode) { + + def getContainer = guardedList (hasDataProducts) ( + List( + classClassMember( + Some("A data product container"), + "DpContainer", + Some("public Fw::DpContainer"), + List.concat( + getConstructionMembers, + getFunctionMembers, + getVariableMembers + ) + ) + ) + ) + + private def getConstructionMembers = List( + linesClassMember(CppDocHppWriter.writeAccessTag("public")), + constructorClassMember( + Some("Constructor with custom initialization"), + List( + CppDoc.Function.Param( + CppDoc.Type("FwDpIdType"), + "id", + Some("The container id") + ), + CppDoc.Function.Param( + CppDoc.Type("const Fw::Buffer&"), + "buffer", + Some("The packet buffer") + ), + CppDoc.Function.Param( + CppDoc.Type("FwDpIdType"), + "baseId", + Some("The component base id") + ) + ), + List("Fw::DpContainer(id, buffer)", "baseId(baseId)"), + Nil + ), + constructorClassMember( + Some("Constructor with default initialization"), + Nil, + List("Fw::DpContainer()", "baseId(0)"), + Nil + ), + ) + + private def singleRecordSerializeFn(name: String, t: Type) = { + val typeName = TypeCppWriter.getName(s, t) + val paramType = if (s.isPrimitive(t, typeName)) + typeName else s"const ${typeName}&" + val typeSize = s.getSerializedSizeExpr(t, typeName) + functionClassMember( + Some(s"""|Serialize a $name record into the packet buffer + |\\return The serialize status"""), + s"serializeRecord_${name}", + List( + CppDoc.Function.Param( + CppDoc.Type(paramType), + "elt", + Some("The element") + ) + ), + CppDoc.Type("Fw::SerializeStatus"), + lines( + s"""|Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + |const FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | $typeSize; + |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + |if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + | const FwDpIdType id = this->baseId + RecordId::$name; + | status = serializeRepr.serialize(id); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | status = serializeRepr.serialize(elt); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | this->dataSize += sizeDelta; + |} + |else { + | status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + |} + |return status;""" + ) + ) + } + + private def arrayRecordSerializeFn(name: String, t: Type) = { + val typeName = TypeCppWriter.getName(s, t) + val paramType = s"const ${typeName}*" + val eltSize = if (s.isPrimitive(t, typeName)) + s"sizeof($typeName)" else s"${typeName}::SERIALIZED_SIZE" + functionClassMember( + Some(s"""|Serialize a $name record into the packet buffer + |\\return The serialize status"""), + s"serializeRecord_${name}", + List( + CppDoc.Function.Param( + CppDoc.Type(paramType), + "array", + Some(s"An array of ${typeName} elements") + ), + CppDoc.Function.Param( + CppDoc.Type("FwSizeType"), + "size", + Some("The array size") + ) + ), + CppDoc.Type("Fw::SerializeStatus"), + { + val serializeElts = (t match { + // Optimize the U8 case + case Type.U8 => + """| const bool omitSerializedLength = true; + | status = serializeRepr.serialize(array, size, omitSerializedLength); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);""" + case _ => + """| for (FwSizeType i = 0; i < size; i++) { + | status = serializeRepr.serialize(array[i]); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | }""" + }).stripMargin + lines( + s"""|FW_ASSERT(array != nullptr); + |Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + |const FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | sizeof(FwSizeType) + + | size * $eltSize; + |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + |if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + | const FwDpIdType id = this->baseId + RecordId::$name; + | status = serializeRepr.serialize(id); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | status = serializeRepr.serialize(size); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + |$serializeElts + | this->dataSize += sizeDelta; + |} + |else { + | status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + |} + |return status;""" + ) + } + ) + } + + private def getSerializeFunctionMembers = + recordsByName.map((id, record) => { + val name = record.getName + val t = record.recordType + if record.isArray then arrayRecordSerializeFn(name, t) + else singleRecordSerializeFn(name, t) + }) + + private val getAccessFunctionsMember = linesClassMember( + lines( + raw"""| + |FwDpIdType getBaseId() const { return this->baseId; } + | + |void setBaseId(FwDpIdType baseId) { this->baseId = baseId; }""" + ) + ) + + private def getFunctionMembers = + linesClassMember(CppDocHppWriter.writeAccessTag("public")) :: + (getSerializeFunctionMembers :+ getAccessFunctionsMember) + + private def getVariableMembers = List( + linesClassMember( + CppDocHppWriter.writeAccessTag("PRIVATE") ++ + CppDocWriter.writeDoxygenComment("The component base id") ++ + lines("FwDpIdType baseId;") + ) + ) + + } + +} + diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentImplWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentImplWriter.scala index ad8084e2e..1c32c8884 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentImplWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentImplWriter.scala @@ -118,7 +118,8 @@ case class ComponentImplWriter( s"""|// TODO |this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); |""" - ) + ), + CppDoc.Function.Override ) ) ), @@ -136,9 +137,17 @@ case class ComponentImplWriter( internalInterfaceHandlerName(p.getUnqualifiedName), getPortFunctionParams(p), CppDoc.Type("void"), - lines("// TODO") + lines("// TODO"), + CppDoc.Function.Override ) ) + ), + addAccessTagAndComment( + "PRIVATE", + s"Handler implementations for data products", + containersByName.map( + (id, container) => getDpRecvHandler(container.getName, lines("// TODO")) + ) ) ) } @@ -163,7 +172,8 @@ case class ComponentImplWriter( inputPortHandlerName(p.getUnqualifiedName), portNumParam :: getPortFunctionParams(p), getPortReturnTypeAsCppDocType(p), - lines(todoMsg) + lines(todoMsg), + CppDoc.Function.Override ) }) ) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentInputPorts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentInputPorts.scala index 19a7b6961..67fd885d7 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentInputPorts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentInputPorts.scala @@ -93,7 +93,7 @@ case class ComponentInputPorts( def getHandlerBases(ports: List[PortInstance]): List[CppDoc.Class.Member] = { def writeAsyncInputPort( - p: PortInstance.General, + p: PortInstance, params: List[(String, String)], queueFull: Ast.QueueFull, priority: Option[BigInt] @@ -174,13 +174,30 @@ case class ComponentInputPorts( case Some(_) => s"retVal = " case None => "" } - val handlerCall = - line("// Down call to pure virtual handler method implemented in Impl class") :: + val portName = p.getUnqualifiedName + val handlerName = inputPortHandlerName(portName) + def handlerCall = + line("// Call handler function") :: writeFunctionCall( - s"${retValAssignment}this->${inputPortHandlerName(p.getUnqualifiedName)}", + s"${retValAssignment}this->$handlerName", List("portNum"), params.map(_._1) ) + def guardedHandlerCall = + List.concat( + lines( + """|// Lock guard mutex before calling + |this->lock(); + |""" + ), + Line.blank :: handlerCall, + lines( + """| + |// Unlock guard mutex + |this->unLock(); + |""" + ) + ) functionClassMember( Some(s"Handler base-class function for input port ${p.getUnqualifiedName}"), @@ -205,23 +222,20 @@ case class ComponentInputPorts( case i: PortInstance.General => i.kind match { case PortInstance.General.Kind.AsyncInput(priority, queueFull) => writeAsyncInputPort(i, params, queueFull, priority) - case PortInstance.General.Kind.GuardedInput => List( - lines( - """|// Lock guard mutex before calling - |this->lock(); - |""" - ), - Line.blank :: handlerCall, - lines( - """| - |// Unlock guard mutex - |this->unLock(); - |""" - ) - ).flatten + case PortInstance.General.Kind.GuardedInput => guardedHandlerCall case PortInstance.General.Kind.SyncInput => handlerCall case _ => Nil } + case special: PortInstance.Special => special.specifier.inputKind match { + case Some(Ast.SpecPortInstance.Async) => + writeAsyncInputPort( + special, params, special.queueFull.get, + special.priority + ) + case Some(Ast.SpecPortInstance.Guarded) => guardedHandlerCall + case Some(Ast.SpecPortInstance.Sync) => handlerCall + case _ => Nil + } case _ => Nil }, returnType match { @@ -236,7 +250,7 @@ case class ComponentInputPorts( } def getCallbacks(ports: List[PortInstance]): List[CppDoc.Class.Member] = { - def writeGeneralInputPort(p: PortInstance) = { + def writeInputPort(p: PortInstance) = { val params = getPortParams(p) val returnKeyword = getPortReturnType(p) match { case Some(_) => "return " @@ -334,8 +348,13 @@ case class ComponentInputPorts( ) ++ getPortFunctionParams(p), getPortReturnTypeAsCppDocType(p), p match { - case i: PortInstance.General => writeGeneralInputPort(i) - case _: PortInstance.Special => writeCommandInputPort() + case i: PortInstance.General => writeInputPort(i) + case special: PortInstance.Special => + special.specifier.kind match { + case Ast.SpecPortInstance.CommandRecv => writeCommandInputPort() + case Ast.SpecPortInstance.ProductRecv => writeInputPort(special) + case _ => Nil + } case _ => Nil }, CppDoc.Function.Static diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentOutputPorts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentOutputPorts.scala index 4bce47a8b..12a53b889 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentOutputPorts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentOutputPorts.scala @@ -137,7 +137,7 @@ case class ComponentOutputPorts( functionClassMember( Some(s"Invoke output port ${p.getUnqualifiedName}"), - outputPortInvokerName(p.getUnqualifiedName), + outputPortInvokerName(p), portNumParam :: getPortFunctionParams(p), getReturnType(p), List.concat( diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentPorts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentPorts.scala index bf6d0c322..6425334f1 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentPorts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentPorts.scala @@ -49,12 +49,15 @@ case class ComponentPorts( outputPortWriter.getConnectionStatusQueries(specialOutputPorts), outputPortWriter.getConnectionStatusQueries(typedOutputPorts), outputPortWriter.getConnectionStatusQueries(serialOutputPorts), + inputPortWriter.getHandlerBases(dataProductInputPorts), inputPortWriter.getHandlers(typedInputPorts), inputPortWriter.getHandlerBases(typedInputPorts), inputPortWriter.getHandlers(serialInputPorts), inputPortWriter.getHandlerBases(serialInputPorts), + inputPortWriter.getPreMsgHooks(dataProductInputPorts), inputPortWriter.getPreMsgHooks(typedAsyncInputPorts), inputPortWriter.getPreMsgHooks(serialAsyncInputPorts), + outputPortWriter.getInvokers(dataProductOutputPorts), outputPortWriter.getInvokers(typedOutputPorts), outputPortWriter.getInvokers(serialOutputPorts), ).flatten diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentGTestBaseWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentGTestBaseWriter.scala index 639407887..57bf2b76e 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentGTestBaseWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentGTestBaseWriter.scala @@ -65,10 +65,17 @@ case class ComponentGTestBaseWriter( private def getMacros = { List.concat( - guardedList (hasTypedOutputPorts) (List(getPortMacros)), - guardedList (hasCommands) (List(getCmdMacros)), - guardedList (hasEvents) (List(getEventMacros)), - guardedList (hasTelemetry) (List(getTlmMacros)) + guardedList (hasTypedOutputPorts) (getPortMacros), + guardedList (hasCommands) (getCmdMacros), + guardedList (hasEvents) (getEventMacros), + guardedList (hasTelemetry) (getTlmMacros), + guardedList (hasDataProducts) ( + List.concat( + guardedList (hasProductGetPort) (getProductGetMacros), + guardedList (hasProductRequestPort) (getProductRequestMacros), + getProductSendMacros + ) + ) ) } @@ -78,7 +85,14 @@ case class ComponentGTestBaseWriter( guardedList (hasTypedOutputPorts) (getPortAssertFunctions), guardedList (hasCommands) (getCmdAssertFunctions), guardedList (hasEvents) (getEventAssertFunctions), - guardedList (hasTelemetry) (getTlmAssertFunctions) + guardedList (hasTelemetry) (getTlmAssertFunctions), + guardedList (hasDataProducts) ( + List.concat( + guardedList (hasProductGetPort) (getProductGetAssertFunctions), + guardedList (hasProductRequestPort) (getProductRequestAssertFunctions), + getProductSendAssertFunctions + ) + ) ) } @@ -103,7 +117,7 @@ case class ComponentGTestBaseWriter( ) } - private def getPortMacros = { + private def getPortMacros = List( linesMember( List.concat( CppDocWriter.writeBannerComment("Macros for typed user from port history assertions"), @@ -159,9 +173,9 @@ case class ComponentGTestBaseWriter( }) ), ) - } + ) - private def getCmdMacros: CppDoc.Member = { + private def getCmdMacros: List[CppDoc.Member] = List( linesMember( List.concat( CppDocWriter.writeBannerComment("Macros for command history assertions"), @@ -175,9 +189,9 @@ case class ComponentGTestBaseWriter( ) ) ) - } + ) - private def getEventMacros = + private def getEventMacros = List( linesMember( List.concat( CppDocWriter.writeBannerComment("Macros for event history assertions"), @@ -207,8 +221,9 @@ case class ComponentGTestBaseWriter( }) ) ) + ) - private def getTlmMacros = + private def getTlmMacros = List( linesMember( List.concat( CppDocWriter.writeBannerComment("Macros for telemetry history assertions"), @@ -232,6 +247,55 @@ case class ComponentGTestBaseWriter( }) ) ) + ) + + private def getProductGetMacros: List[CppDoc.Member] = List( + linesMember( + List.concat( + CppDocWriter.writeBannerComment("Macros for product get assertions"), + Line.blank :: lines( + """#define ASSERT_PRODUCT_GET_SIZE(size) \ + | this->assertProductGet_size(__FILE__, __LINE__, size) + | + |#define ASSERT_PRODUCT_GET(index, id, size) \ + | this->assertProductGet(__FILE__, __LINE__, index, id, size) + |""" + ) + ) + ) + ) + + private def getProductRequestMacros: List[CppDoc.Member] = List( + linesMember( + List.concat( + CppDocWriter.writeBannerComment("Macros for product request assertions"), + Line.blank :: lines( + """#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + | this->assertProductRequest_size(__FILE__, __LINE__, size) + | + |#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + | this->assertProductRequest(__FILE__, __LINE__, index, id, size) + |""" + ) + ) + ) + ) + + private def getProductSendMacros: List[CppDoc.Member] = List( + linesMember( + List.concat( + CppDocWriter.writeBannerComment("Macros for product send assertions"), + Line.blank :: lines( + """#define ASSERT_PRODUCT_SEND_SIZE(size) \ + | this->assertProductSend_size(__FILE__, __LINE__, size) + | + |#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + | assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + |""" + ) + ) + ) + ) private def getPortAssertFunctions = { addAccessTagAndComment( @@ -572,4 +636,262 @@ case class ComponentGTestBaseWriter( } ) + private def getProductGetAssertFunctions = { + lazy val historySize = + functionClassMember( + Some("Assert size of product get history"), + "assertProductGet_size", + sizeAssertionFunctionParams, + CppDoc.Type("void"), + lines( + raw"""ASSERT_EQ(size, this->productGetHistory->size()) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Size of product get history\n" + | << " Expected: " << size << "\n" + | << " Actual: " << this->productGetHistory->size() << "\n"; + |""" + ), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + lazy val historyIndex = + functionClassMember( + Some("Assert the product get history at index"), + "assertProductGet", + assertionFunctionParams ++ List( + CppDoc.Function.Param( + CppDoc.Type("FwDpIdType"), + "id", + Some("The container ID") + ), + CppDoc.Function.Param( + CppDoc.Type("FwSizeType"), + "size", + Some("The size of the requested buffer") + ) + ), + CppDoc.Type("void"), + lines( + raw"""ASSERT_LT(__index, this->productGetHistory->size()) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Index into product get history\n" + | << " Expected: Less than size of product get history (" + | << this->productGetHistory->size() << ")\n" + | << " Actual: " << __index << "\n"; + |const DpGet& e = this->productGetHistory->at(__index); + |ASSERT_EQ(id, e.id) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Id at index " + | << __index + | << " in product get history\n" + | << " Expected: " << id << "\n" + | << " Actual: " << e.id << "\n"; + |ASSERT_EQ(size, e.size) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Size at index " + | << __index + | << " in product get history\n" + | << " Expected: " << size << "\n" + | << " Actual: " << e.size << "\n"; + |""" + ), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + addAccessTagAndComment( + "protected", + "Data Product Get", + List(historySize, historyIndex) + ) + } + + private def getProductRequestAssertFunctions = { + lazy val historySize = + functionClassMember( + Some("Assert size of product request history"), + "assertProductRequest_size", + sizeAssertionFunctionParams, + CppDoc.Type("void"), + lines( + raw"""ASSERT_EQ(size, this->productRequestHistory->size()) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Size of product request history\n" + | << " Expected: " << size << "\n" + | << " Actual: " << this->productRequestHistory->size() << "\n"; + |""" + ), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + lazy val historyIndex = + functionClassMember( + Some("Assert the product request history at index"), + "assertProductRequest", + assertionFunctionParams ++ List( + CppDoc.Function.Param( + CppDoc.Type("FwDpIdType"), + "id", + Some("The container ID") + ), + CppDoc.Function.Param( + CppDoc.Type("FwSizeType"), + "size", + Some("The size of the requested buffer") + ) + ), + CppDoc.Type("void"), + lines( + raw"""ASSERT_LT(__index, this->productRequestHistory->size()) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Index into product request history\n" + | << " Expected: Less than size of product request history (" + | << this->productRequestHistory->size() << ")\n" + | << " Actual: " << __index << "\n"; + |const DpRequest& e = this->productRequestHistory->at(__index); + |ASSERT_EQ(id, e.id) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Id at index " + | << __index + | << " in product request history\n" + | << " Expected: " << id << "\n" + | << " Actual: " << e.id << "\n"; + |ASSERT_EQ(size, e.size) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Size at index " + | << __index + | << " in product request history\n" + | << " Expected: " << size << "\n" + | << " Actual: " << e.size << "\n"; + |""" + ), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + addAccessTagAndComment( + "protected", + "Data Product Request", + List(historySize, historyIndex) + ) + } + + private def getProductSendAssertFunctions = { + lazy val historySize = + functionClassMember( + Some("Assert size of product send history"), + "assertProductSend_size", + sizeAssertionFunctionParams, + CppDoc.Type("void"), + lines( + raw"""ASSERT_EQ(size, this->productSendHistory->size()) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Size of product send history\n" + | << " Expected: " << size << "\n" + | << " Actual: " << this->productSendHistory->size() << "\n"; + |""" + ), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + lazy val historyIndex = + functionClassMember( + Some( + """|Assert the product send history at index + | + |This function sets the output buffer, deserializes and checks the + |data product header, and sets the deserialization pointer to the start + |of the data payload. User-written code can then check the data payload. + |""".stripMargin + ), + "assertProductSend", + assertionFunctionParams ++ List( + CppDoc.Function.Param( + CppDoc.Type("FwDpIdType"), + "id", + Some("The expected container ID (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("FwDpPriorityType"), + "priority", + Some("The expected priority (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("const Fw::Time&"), + "timeTag", + Some("The expected time tag (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("Fw::DpCfg::ProcType"), + "procType", + Some("The expected processing type (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("const Fw::DpContainer::Header::UserData&"), + "userData", + Some("The expected user data (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("FwSizeType"), + "dataSize", + Some("The expected data size (input)") + ), + CppDoc.Function.Param( + CppDoc.Type("Fw::Buffer&"), + "historyBuffer", + Some("The buffer from the history (output)") + ) + ), + CppDoc.Type("void"), + lines( + raw"""ASSERT_LT(__index, this->productSendHistory->size()) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Index into product send history\n" + | << " Expected: Less than size of product send history (" + | << this->productSendHistory->size() << ")\n" + | << " Actual: " << __index << "\n"; + |const DpSend& e = this->productSendHistory->at(__index); + |// Set the history buffer output + |historyBuffer = e.buffer; + |// Check the container id + |ASSERT_EQ(e.id, id) + | << "\n" + | << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + | << " Value: Container ID at index " << __index << " in product send history\n" + | << " Expected: " << id << "\n" + | << " Actual: " << e.id << "\n"; + |// Check the header + |Fw::TestUtil::DpContainerHeader header; + |header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + |header.check( + | __callSiteFileName, + | __callSiteLineNumber, + | historyBuffer, + | id, + | priority, + | timeTag, + | procType, + | userData, + | dataSize + |); + |""" + ), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + addAccessTagAndComment( + "protected", + "Data Product Send", + List(historySize, historyIndex) + ) + } + } diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentHistory.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentHistory.scala index 559af11dc..a48adce4b 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentHistory.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentHistory.scala @@ -107,6 +107,7 @@ case class ComponentHistory( guardedList (hasCommands) (getCmdHistoryTypes), guardedList (hasEvents) (getEventHistoryTypes), guardedList (hasTelemetry) (getTlmHistoryTypes), + guardedList (hasDataProducts) (getDpHistoryTypes), ), CppDoc.Lines.Hpp ) @@ -126,6 +127,7 @@ case class ComponentHistory( guardedList (hasCommands) (getCmdHistoryVariables), guardedList (hasEvents) (getEventHistoryVariables), guardedList (hasTelemetry) (getTlmHistoryVariables), + guardedList (hasDataProducts) (getDpHistoryVariables), ), CppDoc.Lines.Hpp ) @@ -148,7 +150,14 @@ case class ComponentHistory( |""" ) ), - guardedList (hasChannels) (lines("this->clearTlm();")) + guardedList (hasChannels) (lines("this->clearTlm();")), + guardedList (hasDataProducts) ( + List.concat( + guardedList (hasProductGetPort) (lines("this->productGetHistory->clear();")), + guardedList (hasProductRequestPort) (lines("this->productRequestHistory->clear();")), + lines("this->productSendHistory->clear();") + ) + ) ) ) addAccessTagAndComment( @@ -200,12 +209,24 @@ case class ComponentHistory( ) ) - def pushEntry(p: PortInstance) = { + def pushHistoryEntry(p: PortInstance) = { val portName = p.getUnqualifiedName - val inputName = inputPortName(portName) - val historySizeName = fromPortHistorySizeName(portName) val entryName = fromPortEntryName(portName) val historyName = fromPortHistoryName(portName) + List.concat( + wrapInScope( + s"$entryName _e = {", + lines(getPortParams(p).map(_._1).mkString(",\n")), + "};" + ), + lines(s"|this->$historyName->push_back(_e);") + ) + } + + def pushEntryAndUpdateSize(p: PortInstance) = { + val portName = p.getUnqualifiedName + val inputName = inputPortName(portName) + val historySizeName = fromPortHistorySizeName(portName) functionClassMember( Some(s"Push an entry on the history for $inputName"), fromPortPushEntryName(p.getUnqualifiedName), @@ -214,20 +235,14 @@ case class ComponentHistory( List.concat( portParamTypeMap(portName) match { case Nil => lines(s"this->$historySizeName++;") - case _ => wrapInScope( - s"$entryName _e = {", - lines(getPortParams(p).map(_._1).mkString(",\n")), - "};" - ) ++ lines( - s"|this->$historyName->push_back(_e);" - ) + case _ => pushHistoryEntry(p) }, lines("this->fromPortHistorySize++;") ) ) } - clearHistory :: typedOutputPorts.map(pushEntry) + clearHistory :: typedOutputPorts.map(pushEntryAndUpdateSize) } private def getPortHistoryVariables: List[CppDoc.Class.Member] = { @@ -296,6 +311,82 @@ case class ComponentHistory( ) ) + private def getDpHistoryTypes: List[CppDoc.Class.Member] = { + val productGet = guardedList(hasProductGetPort) ( + Line.blank :: + line("//! A type representing a data product get") :: + wrapInScope( + "struct DpGet {", + lines( + """|FwDpIdType id; + |FwSizeType size; + |""" + ), + "};" + ) + ) + val productRequest = guardedList(hasProductRequestPort) ( + Line.blank :: + line("//! A type representing a data product request") :: + wrapInScope( + "struct DpRequest {", + lines( + """|FwDpIdType id; + |FwSizeType size; + |""" + ), + "};" + ) + ) + val productSend = + Line.blank :: + line("// A type representing a data product send") :: + wrapInScope( + "struct DpSend {", + lines( + """|FwDpIdType id; + |Fw::Buffer buffer; + |""" + ), + "};" + ) + List( + linesClassMember( + List.concat(productGet, productRequest, productSend), + CppDoc.Lines.Hpp + ) + ) + } + + private def getDpHistoryVariables: List[CppDoc.Class.Member] = + List( + linesClassMember( + List.concat( + guardedList (hasProductGetPort) ( + Line.blank :: + lines( + """|//! The data product get history + |History* productGetHistory;""" + ) + ), + guardedList (hasProductRequestPort) ( + Line.blank :: + lines( + """|//! The data product request history + |History* productRequestHistory;""" + ) + ), + Line.blank :: + lines( + """|//! The data product send history + |History* productSendHistory; + |""" + ) + ), + CppDoc.Lines.Hpp + ) + ) + private def getEventHistoryTypes: List[CppDoc.Class.Member] = { val textLogHistory = wrapClassMemberInTextLogGuard( linesClassMember( diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTestUtils.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTestUtils.scala index e79940df2..73dc34734 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTestUtils.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTestUtils.scala @@ -29,7 +29,8 @@ abstract class ComponentTestUtils( hasCommands || hasParameters || hasEvents || - hasCommands + hasCommands || + hasDataProducts val inputPorts: List[PortInstance] = List.concat( specialInputPorts, @@ -304,6 +305,10 @@ abstract class ComponentTestUtils( case Event => hasEvents case ParamGet => hasParameters case ParamSet => hasParameters + case ProductGet => component.hasDataProducts + case ProductRecv => component.hasDataProducts + case ProductRequest => component.hasDataProducts + case ProductSend => component.hasDataProducts case Telemetry => hasTelemetry case TextEvent => hasEvents case TimeGet => true diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTesterBaseWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTesterBaseWriter.scala index 229f050ed..2e34a5cde 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTesterBaseWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/TestWriter/ComponentTesterBaseWriter.scala @@ -50,16 +50,23 @@ case class ComponentTesterBaseWriter( } private def getHppIncludes: CppDoc.Member = { - val userHeaders = List( + val standardHeaders = List( s"$componentRelativeFileName.hpp", "Fw/Comp/PassiveComponentBase.hpp", "Fw/Port/InputSerializePort.hpp", "Fw/Types/Assert.hpp" + ) + val dpHeaders = guardedList (hasDataProducts) ( + List("Fw/Dp/test/util/DpContainerHeader.hpp") + ) + val userHeaders = List.concat( + standardHeaders, + dpHeaders ).sorted.map(CppWriter.headerString).map(line) - val systemHeader = lines(CppWriter.systemHeaderString("cstdio")) + val systemHeaders = lines(CppWriter.systemHeaderString("cstdio")) linesMember( List.concat( - Line.blank :: systemHeader, + Line.blank :: systemHeaders, Line.blank :: userHeaders ) ) @@ -103,6 +110,7 @@ case class ComponentTesterBaseWriter( guardedList (hasTelemetry) (getTlmFunctions), guardedList (hasParameters) (getPrmFunctions), guardedList (hasTimeGetPort) (getTimeFunctions), + guardedList (hasDataProducts) (getDpFunctions), historyWriter.getFunctionMembers, // Private function members @@ -219,6 +227,23 @@ case class ComponentTesterBaseWriter( line(s"this->$historyName = new History<$entryName>(maxHistorySize);") }) } + lazy val dpHistories = { + lazy val productGetHistory = lines( + "this->productGetHistory = new History(maxHistorySize);" + ) + lazy val productRequestHistory = lines( + "this->productRequestHistory = new History(maxHistorySize);" + ) + val productSendHistory = lines( + "this->productSendHistory = new History(maxHistorySize);" + ) + line("// Initialize data product histories") :: + List.concat( + guardedList (hasProductGetPort) (productGetHistory), + guardedList (hasProductRequestPort) (productRequestHistory), + productSendHistory + ) + } lazy val clearHistory = lines( """|// Clear history |this->clearHistory(); @@ -230,6 +255,7 @@ case class ComponentTesterBaseWriter( guardedList (hasCommands) (commandHistory), guardedList (hasEvents) (eventHistories), guardedList (hasTelemetry) (tlmHistories), + guardedList (hasDataProducts) (dpHistories), guardedList (hasHistories) (clearHistory) ) ) @@ -270,12 +296,29 @@ case class ComponentTesterBaseWriter( val historyName = tlmHistoryName(channel.getName) line(s"delete this->$historyName;") }) + lazy val destroyDpHistories = { + lazy val destroyProductRequestHistory = lines( + """|// Destroy product request history + |delete this->productRequestHistory; + |""" + ) + val destroyProductSendHistory = lines( + """|// Destroy product send history + |delete this->productSendHistory; + |""" + ) + List.concat( + guardedList (hasProductRequestPort) (destroyProductRequestHistory), + destroyProductSendHistory + ) + } intersperseBlankLines( List( guardedList (hasTypedOutputPorts) (destroyPortHistories), guardedList (hasCommands) (destroyCommandHistory), guardedList (hasEvents) (destroyEventHistories), - guardedList (hasChannels) (destroyTlmHistories) + guardedList (hasChannels) (destroyTlmHistories), + guardedList (hasDataProducts) (destroyDpHistories) ) ) }, @@ -366,10 +409,7 @@ case class ComponentTesterBaseWriter( addAccessTagAndComment( "protected", "Invocation functions for to ports", - List.concat( - typedInputPorts, - serialInputPorts, - ).map(p => { + List.concat(typedInputPorts, serialInputPorts).map(p => { val invokeFunction = p.getType.get match { case PortInstance.Type.DefPort(_) => "invoke" case PortInstance.Type.Serial => "invokeSerial" @@ -432,25 +472,133 @@ case class ComponentTesterBaseWriter( ) } - private def getCmdFunctions: List[CppDoc.Class.Member] = { - val cmdPortInvocation = cmdRecvPort.map( - p => { - val varName = testerPortVariableName(p) + private def getDpFunctions: List[CppDoc.Class.Member] = { + lazy val pushProductGet = functionClassMember( + Some("Push an entry on the product get history"), + "pushProductGetEntry", + getPortFunctionParams(productGetPort.get).take(2), + CppDoc.Type("void"), + lines( + """|DpGet e = { id, size }; + |this->productGetHistory->push_back(e);""" + ) + ) + lazy val handleProductGet = functionClassMember( + Some( + """|Handle a data product get from the component under test + | + |By default, (1) call pushProductGetEntry; (2) do not allocate a buffer + |and return FAILURE. You can override this behavior, e.g., to call + |pushProductGetEntry, allocate a buffer and return SUCCESS.""".stripMargin + ), + "productGet_handler", + getPortFunctionParams(productGetPort.get), + CppDoc.Type("Fw::Success::T"), + lines( + """|(void) buffer; + |this->pushProductGetEntry(id, size); + |return Fw::Success::FAILURE; + |""" + ), + CppDoc.Function.Virtual + ) + lazy val pushProductRequest = functionClassMember( + Some("Push an entry on the product request history"), + "pushProductRequestEntry", + getPortFunctionParams(productRequestPort.get), + CppDoc.Type("void"), + lines( + """|DpRequest e = { id, size }; + |this->productRequestHistory->push_back(e);""" + ) + ) + lazy val handleProductRequest = functionClassMember( + Some( + """|Handle a data product request from the component under test + | + |By default, call pushProductRequestEntry. You can override + |this behavior.""".stripMargin + ), + "productRequest_handler", + getPortFunctionParams(productRequestPort.get), + CppDoc.Type("void"), + lines("this->pushProductRequestEntry(id, size);"), + CppDoc.Function.Virtual + ) + lazy val sendProductResponse = functionClassMember( + Some(s"Send a data product response to the component under test"), + "sendProductResponse", + getPortFunctionParams(productRecvPort.get), + CppDoc.Type("void"), + { + val pi = productRecvPort.get + val portNumGetter = testerPortNumGetterName(pi) + val varName = testerPortVariableName(pi) lines( - s"""|if (this->$varName[0].isConnected()) { - | this->$varName[0].invoke( - | _opcode, - | cmdSeq, - | buf - | ); - |} - |else { - | printf("Test Command Output port not connected!\\n"); - |} - |""" + s"""|FW_ASSERT(this->$portNumGetter() > 0); + |FW_ASSERT(this->$varName[0].isConnected()); + |this->$varName[0].invoke(id, buffer, status);""" ) } - ).getOrElse(Nil) + ) + lazy val pushProductSend = functionClassMember( + Some("Push an entry on the product send history"), + "pushProductSendEntry", + getPortFunctionParams(productSendPort.get), + CppDoc.Type("void"), + lines( + """|DpSend e = { id, buffer }; + |this->productSendHistory->push_back(e);""" + ) + ) + lazy val handleProductSend = functionClassMember( + Some( + """|Handle a data product send from the component under test + | + |By default, call pushProductSendEntry. You can override + |this behavior.""".stripMargin + ), + "productSend_handler", + getPortFunctionParams(productSendPort.get), + CppDoc.Type("void"), + lines("this->pushProductSendEntry(id, buffer);"), + CppDoc.Function.Virtual + ) + addAccessTagAndComment( + "protected", + "Functions for testing data products", + { + List.concat( + guardedList (hasProductGetPort) ( + List(pushProductGet, handleProductGet) + ), + guardedList (hasProductRequestPort) ( + List(pushProductRequest, handleProductRequest) + ), + guardedList (hasProductRecvPort) (List(sendProductResponse)), + List(pushProductSend, handleProductSend) + ) + } + ) + } + + private def getCmdFunctions: List[CppDoc.Class.Member] = { + val cmdPortInvocation = { + val varName = testerPortVariableName(cmdRecvPort.get) + lines( + s"""|if (this->$varName[0].isConnected()) { + | this->$varName[0].invoke( + | _opcode, + | cmdSeq, + | buf + | ); + |} + |else { + | printf("Test Command Output port not connected!\\n"); + |} + |""" + ) + } def writeCmdSendFunc(opcode: Command.Opcode, cmd: Command) = functionClassMember( Some(s"Send a ${cmd.getName} command"), @@ -497,7 +645,7 @@ case class ComponentTesterBaseWriter( |_opcode = $className::${commandConstantName(cmd)} + idBase; |""" ), - guardedList (hasCommands) (cmdPortInvocation) + cmdPortInvocation ) ) ) @@ -632,7 +780,7 @@ case class ComponentTesterBaseWriter( lines( s"""| - |$tn $name; + |$tn $name; |#if FW_AMPCS_COMPATIBLE |{ | // Deserialize the argument size @@ -682,111 +830,114 @@ case class ComponentTesterBaseWriter( ) ) - addAccessTagAndComment( - "protected", - "Functions for testing events", - { - lazy val dispatchEvent = functionClassMember( - Some("Dispatch an event"), - "dispatchEvents", - List( - CppDoc.Function.Param( - CppDoc.Type("FwEventIdType"), - "id", - Some("The event ID") - ), - timeTagParam, - CppDoc.Function.Param( - CppDoc.Type("const Fw::LogSeverity"), - "severity", - Some("The severity") - ), - CppDoc.Function.Param( - CppDoc.Type("Fw::LogBuffer&"), - "args", - Some("The serialized arguments") - ) - ), - CppDoc.Type("void"), - List.concat( - lines( - """|args.resetDeser(); - | - |const U32 idBase = this->getIdBase(); - |FW_ASSERT(id >= idBase, id, idBase); - |""" - ), - switchStatement - ) + lazy val dispatchEvent = functionClassMember( + Some("Dispatch an event"), + "dispatchEvents", + List( + CppDoc.Function.Param( + CppDoc.Type("FwEventIdType"), + "id", + Some("The event ID") + ), + timeTagParam, + CppDoc.Function.Param( + CppDoc.Type("const Fw::LogSeverity"), + "severity", + Some("The severity") + ), + CppDoc.Function.Param( + CppDoc.Type("Fw::LogBuffer&"), + "args", + Some("The serialized arguments") ) - lazy val handleTextEvent = wrapClassMemberInTextLogGuard( - functionClassMember( - Some("Handle a text event"), - "textLogIn", - List( - CppDoc.Function.Param( - CppDoc.Type("FwEventIdType"), - "id", - Some("The event ID") - ), - timeTagParam, - CppDoc.Function.Param( - CppDoc.Type("const Fw::LogSeverity"), - "severity", - Some("The severity") - ), - CppDoc.Function.Param( - CppDoc.Type("const Fw::TextLogString&"), - "text", - Some("The event string") - ) - ), - CppDoc.Type("void"), - lines( - s"""|TextLogEntry e = { id, timeTag, severity, text }; - |textLogHistory->push_back(e); - |""" - ), - CppDoc.Function.Virtual + ), + CppDoc.Type("void"), + List.concat( + lines( + """|args.resetDeser(); + | + |const U32 idBase = this->getIdBase(); + |FW_ASSERT(id >= idBase, id, idBase); + |""" + ), + switchStatement + ) + ) + + lazy val handleTextEvent = wrapClassMemberInTextLogGuard( + functionClassMember( + Some("Handle a text event"), + "textLogIn", + List( + CppDoc.Function.Param( + CppDoc.Type("FwEventIdType"), + "id", + Some("The event ID") + ), + timeTagParam, + CppDoc.Function.Param( + CppDoc.Type("const Fw::LogSeverity"), + "severity", + Some("The severity") + ), + CppDoc.Function.Param( + CppDoc.Type("const Fw::TextLogString&"), + "text", + Some("The event string") ) - ) + ), + CppDoc.Type("void"), + lines( + s"""|TextLogEntry e = { id, timeTag, severity, text }; + |textLogHistory->push_back(e); + |""" + ), + CppDoc.Function.Virtual + ) + ) + + def handleEvent(id: Event.Id, event: Event) = { + val name= event.getName + val sizeName = eventSizeName(name) + val entryName = eventEntryName(name) + val historyName = eventHistoryName(name) + functionClassMember( + Some(s"Handle event $name"), + eventHandlerName(event), + formalParamsCppWriter.write( + event.aNode._2.data.params, + Nil, + Some("Fw::LogStringArg"), + FormalParamsCppWriter.Value + ), + CppDoc.Type("void"), List.concat( - guardedList (hasEvents) (dispatchEvent :: handleTextEvent), - sortedEvents.map((id, event) => { - val name= event.getName - val sizeName = eventSizeName(name) - val entryName = eventEntryName(name) - val historyName = eventHistoryName(name) - functionClassMember( - Some(s"Handle event $name"), - eventHandlerName(event), - formalParamsCppWriter.write( - event.aNode._2.data.params, - Nil, - Some("Fw::LogStringArg"), - FormalParamsCppWriter.Value - ), - CppDoc.Type("void"), - List.concat( - eventParamTypeMap(id) match { - case Nil => lines(s"this->$sizeName++;") - case params => List.concat( - wrapInScope( - s"$entryName _e = {", - lines(params.map(_._1).mkString(",\n")), - "};" - ), - lines(s"$historyName->push_back(_e);") - ) - }, - lines("this->eventsSize++;") + eventParamTypeMap(id) match { + case Nil => lines(s"this->$sizeName++;") + case params => List.concat( + wrapInScope( + s"$entryName _e = {", + lines(params.map(_._1).mkString(",\n")), + "};" ), - CppDoc.Function.Virtual + lines(s"$historyName->push_back(_e);") ) - }) - ) - } + }, + lines("this->eventsSize++;") + ), + CppDoc.Function.Virtual + ) + } + + addAccessTagAndComment( + "protected", + "Functions for testing events", + List.concat( + guardedList (hasEvents) (dispatchEvent :: handleTextEvent), + sortedEvents.map(handleEvent) + ) ) + } private def getTlmFunctions: List[CppDoc.Class.Member] = { @@ -1174,6 +1325,22 @@ case class ComponentTesterBaseWriter( |${getParamName(0)} = _testerBase->m_testTime; |""" ) + case ProductGet => lines( + s"""|$testerBaseDecl + |return _testerBase->productGet_handler($paramNamesString); + |""" + ) + case ProductRecv => Nil + case ProductRequest => lines( + s"""|$testerBaseDecl + |_testerBase->productRequest_handler($paramNamesString); + |""" + ) + case ProductSend => lines( + s"""|$testerBaseDecl + |_testerBase->productSend_handler($paramNamesString); + |""" + ) } case _: PortInstance.Internal => Nil } diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterState.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterState.scala index a12a1cdbf..07b98be77 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterState.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterState.scala @@ -199,6 +199,8 @@ object CppWriterState { val builtInTypes: Map[String,Value.Integer] = Map( "FwBuffSizeType" -> zero, "FwChanIdType" -> zero, + "FwDpIdType" -> zero, + "FwDpPriorityType" -> zero, "FwEnumStoreType" -> zero, "FwEventIdType" -> zero, "FwIndexType" -> zero, diff --git a/compiler/lib/src/main/scala/codegen/FppWriter.scala b/compiler/lib/src/main/scala/codegen/FppWriter.scala index 9a6608c95..05c73a4d8 100644 --- a/compiler/lib/src/main/scala/codegen/FppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/FppWriter.scala @@ -313,6 +313,17 @@ object FppWriter extends AstVisitor with LineUtils { } } + override def specContainerAnnotatedNode( + in: In, + aNode: Ast.Annotated[AstNode[Ast.SpecContainer]] + ) = { + val (_, node, _) = aNode + val data = node.data + lines(s"product container ${ident(data.name)}"). + joinOpt (data.id) (" id ") (exprNode). + joinOpt (data.defaultPriority) (" default priority ") (exprNode) + } + override def specEventAnnotatedNode( in: In, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]] @@ -395,7 +406,13 @@ object FppWriter extends AstVisitor with LineUtils { } def special(i: Ast.SpecPortInstance.Special) = { val kind = i.kind.toString - lines(s"$kind port ${ident(i.name)}") + val inputKind = i.inputKind match { + case Some(kind) => s"$kind " + case None => "" + } + lines(s"${inputKind}$kind port ${ident(i.name)}"). + joinOptWithBreak (i.priority) ("priority ") (exprNode). + joinOptWithBreak (i.queueFull) ("") (applyToData(queueFull)) } node.data match { case i : Ast.SpecPortInstance.General => general(i) @@ -414,6 +431,24 @@ object FppWriter extends AstVisitor with LineUtils { lines(s"match $port1 with $port2") } + override def specRecordAnnotatedNode( + in: In, + aNode: Ast.Annotated[AstNode[Ast.SpecRecord]] + ) = { + val (_, node, _) = aNode + val data = node.data + def recordType( + typeName: AstNode[Ast.TypeName], + isArray: Boolean + ) = { + val tn = typeNameNode(typeName) + if isArray then Line.addSuffix(tn, " array") else tn + } + lines(s"product record ${ident(data.name)}"). + join (": ") (recordType(data.recordType, data.isArray)). + joinOpt (data.id) (" id ") (exprNode) + } + override def specTlmChannelAnnotatedNode( in: In, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]] @@ -617,6 +652,7 @@ object FppWriter extends AstVisitor with LineUtils { "component", "connections", "constant", + "container", "default", "diagnostic", "drop", @@ -649,14 +685,19 @@ object FppWriter extends AstVisitor with LineUtils { "port", "priority", "private", + "product", "queue", "queued", + "raw", + "record", "recv", "red", "ref", "reg", + "request", "resp", "save", + "send", "serial", "set", "severity", diff --git a/compiler/lib/src/main/scala/codegen/JsonEncoder/AnalysisJsonEncoder.scala b/compiler/lib/src/main/scala/codegen/JsonEncoder/AnalysisJsonEncoder.scala index dad92cc32..7db069d40 100644 --- a/compiler/lib/src/main/scala/codegen/JsonEncoder/AnalysisJsonEncoder.scala +++ b/compiler/lib/src/main/scala/codegen/JsonEncoder/AnalysisJsonEncoder.scala @@ -123,6 +123,14 @@ object AnalysisJsonEncoder extends JsonEncoder{ Encoder.instance (mapAsJsonMap (symbolToIdString) (f2) _) } + private implicit val containerMapEncoder: + Encoder[Map[Container.Id, Container]] = + { + def f1(id: Container.Id) = id.toString + def f2(c: Container) = c.asJson + Encoder.instance (mapAsJsonMap (f1) (f2) _) + } + private implicit val directImportMapEncoder: Encoder[Map[Symbol.Topology, Location]] = { @@ -173,6 +181,14 @@ object AnalysisJsonEncoder extends JsonEncoder{ Encoder.instance (mapAsJsonMap (f1) (f2) _) } + private implicit val recordMapEncoder: + Encoder[Map[Record.Id, Record]] = + { + def f1(id: Record.Id) = id.toString + def f2(c: Record) = c.asJson + Encoder.instance (mapAsJsonMap (f1) (f2) _) + } + private implicit val scopeMapEncoder: Encoder[Map[Symbol, Scope]] = { def f2(s: Scope) = s.asJson Encoder.instance (mapAsJsonMap (symbolToIdString) (f2) _) diff --git a/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala b/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala index 727c3cd2a..c2ed165f7 100644 --- a/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala @@ -179,7 +179,8 @@ object ComponentXmlFppWriter extends LineUtils { } } - def special(file: XmlFppWriter.File, xmlNode: scala.xml.Node, role: String): Result.Result[Ast.SpecPortInstance.Special] = { + def special(file: XmlFppWriter.File, xmlNode: scala.xml.Node, role: String): + Result.Result[Ast.SpecPortInstance.Special] = { import Ast.SpecPortInstance._ for { kind <- role match { diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/ComponentXmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/ComponentXmlWriter.scala index 4cc156402..86b1fc3e3 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/ComponentXmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/ComponentXmlWriter.scala @@ -203,7 +203,6 @@ object ComponentXmlWriter extends AstVisitor with LineUtils { case Kind.SyncInput => "sync_input" case Kind.Output => "output" } - val data = general.aNode._2.data val pairs = { val pairs1 = List( ("name", name), @@ -246,6 +245,8 @@ object ComponentXmlWriter extends AstVisitor with LineUtils { case Telemetry => "Telemetry" case TextEvent => "LogTextEvent" case TimeGet => "TimeGet" + // This should never happen, because of XML lowering + case _ => throw new InternalError(s"invalid specifier kind ${special.specifier.kind}") } } val pairs = List( @@ -260,7 +261,12 @@ object ComponentXmlWriter extends AstVisitor with LineUtils { } def writePort(name: String, instance: PortInstance) = instance match { case general: PortInstance.General => writeGeneralPort(name, general) - case special: PortInstance.Special => writeSpecialPort(name, special) + case special: PortInstance.Special => + // Lower data product ports to generic XML + DpPortXmlLowering(s, name, special).lower match { + case Some(general) => writeGeneralPort(name, general) + case None => writeSpecialPort(name, special) + } case _ => Nil } val ports = c.portMap.keys.toList.sortWith(_ < _). diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/DpPortXmlLowering.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/DpPortXmlLowering.scala new file mode 100644 index 000000000..4f621ea98 --- /dev/null +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/DpPortXmlLowering.scala @@ -0,0 +1,92 @@ +package fpp.compiler.codegen + +import fpp.compiler.analysis._ +import fpp.compiler.ast._ +import fpp.compiler.util._ + +/** Lower a special data product port to a form that the XML autocoder + * can understand. */ +case class DpPortXmlLowering( + s: XmlWriterState, + name: String, + special: PortInstance.Special +) { + + val aNode = special.aNode + + val specifier = special.specifier + + def lower: Option[PortInstance.General] = + for (generalSpec <- lowerAstSpec) yield { + val generalNode = AstNode.create(generalSpec, aNode._2.id) + val generalANode = (aNode._1, generalNode, aNode._3) + val generalKind = lowerKind.get + val size = 1 + val ty = lowerType.get + PortInstance.General( + generalANode, + generalSpec, + generalKind, + size, + ty + ) + } + + /** Lower the AST kind */ + private def lowerAstKind: Option[Ast.SpecPortInstance.GeneralKind] = + (specifier.inputKind, specifier.kind) match { + case (_, Ast.SpecPortInstance.ProductGet) => + Some(Ast.SpecPortInstance.Output) + case (_, Ast.SpecPortInstance.ProductRequest) => + Some(Ast.SpecPortInstance.Output) + case (Some(Ast.SpecPortInstance.Async), Ast.SpecPortInstance.ProductRecv) => + Some(Ast.SpecPortInstance.AsyncInput) + case (Some(Ast.SpecPortInstance.Guarded), Ast.SpecPortInstance.ProductRecv) => + Some(Ast.SpecPortInstance.GuardedInput) + case (Some(Ast.SpecPortInstance.Sync), Ast.SpecPortInstance.ProductRecv) => + Some(Ast.SpecPortInstance.SyncInput) + case (_, Ast.SpecPortInstance.ProductSend) => + Some(Ast.SpecPortInstance.Output) + case _ => None + } + + /** Lower the AST specifier */ + private def lowerAstSpec: Option[Ast.SpecPortInstance.General] = + for (kind <- lowerAstKind) yield Ast.SpecPortInstance.General( + kind, + name, + None, + None, + specifier.priority, + specifier.queueFull + ) + + /** Lower the semantic kind */ + private def lowerKind: Option[PortInstance.General.Kind] = + (specifier.inputKind, specifier.kind) match { + case (_, Ast.SpecPortInstance.ProductGet) => + Some(PortInstance.General.Kind.Output) + case (_, Ast.SpecPortInstance.ProductRequest) => + Some(PortInstance.General.Kind.Output) + case (Some(Ast.SpecPortInstance.Async), Ast.SpecPortInstance.ProductRecv) => + Some(PortInstance.General.Kind.AsyncInput( + special.priority, + special.queueFull.get + )) + case (Some(Ast.SpecPortInstance.Guarded), Ast.SpecPortInstance.ProductRecv) => + Some(PortInstance.General.Kind.GuardedInput) + case (Some(Ast.SpecPortInstance.Sync), Ast.SpecPortInstance.ProductRecv) => + Some(PortInstance.General.Kind.SyncInput) + case (_, Ast.SpecPortInstance.ProductSend) => + Some(PortInstance.General.Kind.Output) + case _ => None + } + + /** Lower the port type */ + private def lowerType: Option[PortInstance.Type] = + s.a.useDefMap.get(aNode._2.id) match { + case Some(s: Symbol.Port) => Some(PortInstance.Type.DefPort(s)) + case _ => None + } + +} diff --git a/compiler/lib/src/main/scala/syntax/Lexer.scala b/compiler/lib/src/main/scala/syntax/Lexer.scala index c6cf6b628..404382a42 100644 --- a/compiler/lib/src/main/scala/syntax/Lexer.scala +++ b/compiler/lib/src/main/scala/syntax/Lexer.scala @@ -262,6 +262,7 @@ object Lexer extends RegexParsers { ("component", (u: Unit) => Token.COMPONENT()), ("connections", (u: Unit) => Token.CONNECTIONS()), ("constant", (u: Unit) => Token.CONSTANT()), + ("container", (u: Unit) => Token.CONTAINER()), ("cpu", (u: Unit) => Token.CPU()), ("default", (u: Unit) => Token.DEFAULT()), ("diagnostic", (u: Unit) => Token.DIAGNOSTIC()), @@ -295,14 +296,18 @@ object Lexer extends RegexParsers { ("port", (u: Unit) => Token.PORT()), ("priority", (u: Unit) => Token.PRIORITY()), ("private", (u: Unit) => Token.PRIVATE()), + ("product", (u: Unit) => Token.PRODUCT()), ("queue", (u: Unit) => Token.QUEUE()), ("queued", (u: Unit) => Token.QUEUED()), + ("record", (u: Unit) => Token.RECORD()), ("recv", (u: Unit) => Token.RECV()), ("red", (u: Unit) => Token.RED()), ("ref", (u: Unit) => Token.REF()), ("reg", (u: Unit) => Token.REG()), + ("request", (u: Unit) => Token.REQUEST()), ("resp", (u: Unit) => Token.RESP()), ("save", (u: Unit) => Token.SAVE()), + ("send", (u: Unit) => Token.SEND()), ("serial", (u: Unit) => Token.SERIAL()), ("severity", (u: Unit) => Token.SEVERITY()), ("set", (u: Unit) => Token.SET()), diff --git a/compiler/lib/src/main/scala/syntax/Parser.scala b/compiler/lib/src/main/scala/syntax/Parser.scala index 34377a4e8..80fa24d5c 100644 --- a/compiler/lib/src/main/scala/syntax/Parser.scala +++ b/compiler/lib/src/main/scala/syntax/Parser.scala @@ -29,12 +29,14 @@ object Parser extends Parsers { node(defEnum) ^^ { case n => Ast.ComponentMember.DefEnum(n) } | node(defStruct) ^^ { case n => Ast.ComponentMember.DefStruct(n) } | node(specCommand) ^^ { case n => Ast.ComponentMember.SpecCommand(n) } | + node(specContainer) ^^ { case n => Ast.ComponentMember.SpecContainer(n) } | node(specEvent) ^^ { case n => Ast.ComponentMember.SpecEvent(n) } | node(specInclude) ^^ { case n => Ast.ComponentMember.SpecInclude(n) } | node(specInternalPort) ^^ { case n => Ast.ComponentMember.SpecInternalPort(n) } | node(specPortInstance) ^^ { case n => Ast.ComponentMember.SpecPortInstance(n) } | node(specPortMatching) ^^ { case n => Ast.ComponentMember.SpecPortMatching(n) } | node(specParam) ^^ { case n => Ast.ComponentMember.SpecParam(n) } | + node(specRecord) ^^ { case n => Ast.ComponentMember.SpecRecord(n) } | node(specTlmChannel) ^^ { case n => Ast.ComponentMember.SpecTlmChannel(n) } | failure("component member expected") } @@ -357,13 +359,25 @@ object Parser extends Parsers { sync ^^ { case _ => Ast.SpecCommand.Sync } | failure("command kind expected") } - kind ~ (command ~>! ident) ~! formalParamList ~! + kind ~ (command ~> ident) ~! formalParamList ~! opt(opcode ~>! exprNode) ~! opt(priority ~>! exprNode) ~! opt(node(queueFull)) ^^ { case kind ~ name ~ params ~ opcode ~ priority ~ queueFull => Ast.SpecCommand(kind, name, params, opcode, priority, queueFull) } } + def specContainer: Parser[Ast.SpecContainer] = { + ((product ~ container) ~>! ident) ~! + opt(id ~>! exprNode) ~! + opt((default ~ priority) ~>! exprNode) ^^ { + case name ~ id ~ defaultPriority => Ast.SpecContainer( + name, + id, + defaultPriority + ) + } + } + def specCompInstance: Parser[Ast.SpecCompInstance] = { visibility ~ (instance ~>! node(qualIdent)) ^^ { case visibility ~ instance => Ast.SpecCompInstance(visibility, instance) @@ -480,6 +494,11 @@ object Parser extends Parsers { serial ^^ { case _ => None} | failure("port type expected") } + def specialInputKind = { + async ^^ { case _ => Ast.SpecPortInstance.Async } | + guarded ^^ { case _ => Ast.SpecPortInstance.Guarded } | + sync ^^ { case _ => Ast.SpecPortInstance.Sync } + } def specialKind = { command ~ recv ^^ { case _ => Ast.SpecPortInstance.CommandRecv } | command ~ reg ^^ { case _ => Ast.SpecPortInstance.CommandReg } | @@ -487,6 +506,10 @@ object Parser extends Parsers { event ^^ { case _ => Ast.SpecPortInstance.Event } | param ~ get ^^ { case _ => Ast.SpecPortInstance.ParamGet } | param ~ set ^^ { case _ => Ast.SpecPortInstance.ParamSet } | + product ~ get ^^ { case _ => Ast.SpecPortInstance.ProductGet } | + product ~ recv ^^ { case _ => Ast.SpecPortInstance.ProductRecv } | + product ~ request ^^ { case _ => Ast.SpecPortInstance.ProductRequest } | + product ~ send ^^ { case _ => Ast.SpecPortInstance.ProductSend } | telemetry ^^ { case _ => Ast.SpecPortInstance.Telemetry } | text ~ event ^^ { case _ => Ast.SpecPortInstance.TextEvent } | time ~ get ^^ { case _ => Ast.SpecPortInstance.TimeGet } @@ -502,9 +525,19 @@ object Parser extends Parsers { } } def special: Parser[Ast.SpecPortInstance] = { - specialKind ~ (port ~>! ident) ^^ { - case kind ~ name => - Ast.SpecPortInstance.Special(None, kind, name, None, None) + opt(specialInputKind) ~ + specialKind ~ + (port ~>! ident) ~! + opt(priority ~>! exprNode) ~! + opt(node(queueFull)) ^^ { + case inputKind ~ kind ~ name ~ priority ~ queueFull => + Ast.SpecPortInstance.Special( + inputKind, + kind, + name, + priority, + queueFull + ) } } general | special @@ -516,6 +549,24 @@ object Parser extends Parsers { } } + def specRecord: Parser[Ast.SpecRecord] = { + def arrayOpt = opt(array) ^^ { + case Some(_) => true + case None => false + } + ((product ~ record) ~>! ident) ~! + (colon ~>! node(typeName)) ~! + arrayOpt ~! + opt(id ~>! exprNode) ^^ { + case name ~ recordType ~ arrayOpt ~ id => Ast.SpecRecord( + name, + recordType, + arrayOpt, + id + ) + } + } + def specTlmChannel: Parser[Ast.SpecTlmChannel] = { def updateSetting = { always ^^ { case _ => Ast.SpecTlmChannel.Always } | @@ -684,6 +735,8 @@ object Parser extends Parsers { private def constant = accept("constant", { case t : Token.CONSTANT => t }) + private def container = accept("container", { case t : Token.CONTAINER => t }) + private def cpu = accept("cpu", { case t : Token.CPU => t }) private def default = accept("default", { case t : Token.DEFAULT => t }) @@ -787,6 +840,8 @@ object Parser extends Parsers { private def priority = accept("priority", { case t : Token.PRIORITY => t }) + private def product = accept("product", { case t : Token.PRODUCT => t }) + private def queue = accept("queue", { case t : Token.QUEUE => t }) private def queued = accept("queued", { case t : Token.QUEUED => t }) @@ -797,6 +852,8 @@ object Parser extends Parsers { private def rbracket = accept("]", { case t : Token.RBRACKET => t }) + private def record = accept("record", { case t : Token.RECORD => t }) + private def recv = accept("recv", { case t : Token.RECV => t }) private def red = accept("red", { case t : Token.RED => t }) @@ -805,6 +862,8 @@ object Parser extends Parsers { private def reg = accept("reg", { case t : Token.REG => t }) + private def request = accept("request", { case t : Token.REQUEST => t }) + private def resp = accept("resp", { case t : Token.RESP => t }) private def rparen = accept(")", { case t : Token.RPAREN => t }) @@ -813,6 +872,8 @@ object Parser extends Parsers { private def semi = accept(";", { case t : Token.SEMI => t }) + private def send = accept("send", { case t : Token.SEND => t }) + private def serial = accept("serial", { case t : Token.SERIAL => t }) private def set = accept("set", { case t : Token.SET => t }) diff --git a/compiler/lib/src/main/scala/syntax/Token.scala b/compiler/lib/src/main/scala/syntax/Token.scala index 7c4ab0aaf..f126f5c36 100644 --- a/compiler/lib/src/main/scala/syntax/Token.scala +++ b/compiler/lib/src/main/scala/syntax/Token.scala @@ -22,6 +22,7 @@ object Token { final case class COMPONENT() extends Token final case class CONNECTIONS() extends Token final case class CONSTANT() extends Token + final case class CONTAINER() extends Token final case class CPU() extends Token final case class DEFAULT() extends Token final case class DIAGNOSTIC() extends Token @@ -75,19 +76,23 @@ object Token { final case class PRE_ANNOTATION(str: String) extends Token final case class PRIORITY() extends Token final case class PRIVATE() extends Token + final case class PRODUCT() extends Token final case class QUEUE() extends Token final case class QUEUED() extends Token final case class RARROW() extends Token final case class RBRACE() extends Token final case class RBRACKET() extends Token + final case class RECORD() extends Token final case class RECV() extends Token final case class RED() extends Token final case class REF() extends Token final case class REG() extends Token + final case class REQUEST() extends Token final case class RESP() extends Token final case class RPAREN() extends Token final case class SAVE() extends Token final case class SEMI() extends Token + final case class SEND() extends Token final case class SERIAL() extends Token final case class SET() extends Token final case class SEVERITY() extends Token diff --git a/compiler/lib/src/main/scala/util/Error.scala b/compiler/lib/src/main/scala/util/Error.scala index df5500ce4..4537cd323 100644 --- a/compiler/lib/src/main/scala/util/Error.scala +++ b/compiler/lib/src/main/scala/util/Error.scala @@ -125,6 +125,8 @@ sealed trait Error { System.err.println(loc) case _ => () } + case SemanticError.InvalidDataProducts(loc, msg) => + Error.print (Some(loc)) (msg) case SemanticError.InvalidDefComponentInstance(name, loc, msg) => Error.print (Some(loc)) (s"invalid component instance definition $name: $msg") case SemanticError.InvalidEnumConstants(loc) => @@ -160,6 +162,8 @@ sealed trait Error { Error.print (Some(loc)) ("only async input may have a priority") case SemanticError.InvalidQueueFull(loc) => Error.print (Some(loc)) ("only async input may have queue full behavior") + case SemanticError.InvalidSpecialPort(loc, msg) => + Error.print (Some(loc)) (msg) case SemanticError.InvalidStringSize(loc, size) => Error.print (Some(loc)) (s"invalid string size $size") case SemanticError.InvalidSymbol(name, loc, msg, defLoc) => @@ -184,8 +188,8 @@ sealed trait Error { case SemanticError.MissingConnection(loc, matchingLoc) => Error.print (Some(loc)) ("no match for this connection") printMatchingLoc(matchingLoc) - case SemanticError.MissingPort(loc, specKind, portKind) => - Error.print (Some(loc)) (s"component with $specKind specifiers must have $portKind port") + case SemanticError.MissingPort(loc, specMsg, portMsg) => + Error.print (Some(loc)) (s"component with $specMsg must have $portMsg") case SemanticError.OverlappingIdRanges( maxId1, name1, loc1, baseId2, name2, loc2 ) => @@ -366,6 +370,11 @@ object SemanticError { fromPortDefLoc: Option[Location] = None, toPortDefLoc: Option[Location] = None ) extends Error + /** Invalid data products */ + final case class InvalidDataProducts( + loc: Location, + msg: String + ) extends Error /** Invalid component instance definition */ final case class InvalidDefComponentInstance( name: String, @@ -423,6 +432,8 @@ object SemanticError { final case class InvalidPriority(loc: Location) extends Error /** Invalid queue full specifier */ final case class InvalidQueueFull(loc: Location) extends Error + /** Invalid special port */ + final case class InvalidSpecialPort(loc: Location, msg: String) extends Error /** Invalid string size */ final case class InvalidStringSize(loc: Location, size: BigInt) extends Error /** Invalid symbol */ @@ -452,8 +463,8 @@ object SemanticError { /** Missing port */ final case class MissingPort( loc: Location, - specKind: String, - port: String + specMsg: String, + portmsg: String ) extends Error /** Overlapping ID ranges */ final case class OverlappingIdRanges( diff --git a/compiler/lib/src/test/scala/syntax/Parser.scala b/compiler/lib/src/test/scala/syntax/Parser.scala index bdb3fa6a7..583cd4241 100644 --- a/compiler/lib/src/test/scala/syntax/Parser.scala +++ b/compiler/lib/src/test/scala/syntax/Parser.scala @@ -378,6 +378,17 @@ class ParserSpec extends AnyWordSpec { ) } + "spec container OK" should { + parseAllOK( + Parser.specContainer, + List( + "product container C", + "product container C id 0x100", + "product container C id 0x100 default priority 10" + ) + ) + } + "spec event OK" should { parseAllOK( Parser.specEvent, @@ -468,12 +479,19 @@ class ParserSpec extends AnyWordSpec { parseAllOK( Parser.specPortInstance, List( + "async product recv port p", "command recv port p", "command reg port p", "command resp port p", "event port p", + "guarded product recv port p", "param get port p", "param set port p", + "product get port p", + "product recv port p", + "product request port p", + "product send port p", + "sync product recv port p", "telemetry port p", "text event port p", "time get port p", @@ -490,6 +508,17 @@ class ParserSpec extends AnyWordSpec { ) } + "spec record OK" should { + parseAllOK( + Parser.specRecord, + List( + "product record R: U32", + "product record R: U32 array", + "product record R: U32 id 0x100" + ) + ) + } + "spec tlm channel OK" should { parseAllOK( Parser.specTlmChannel, diff --git a/compiler/tools/fpp-check/test/command/duplicate_name_param_get.fpp b/compiler/tools/fpp-check/test/command/duplicate_name_param_get.fpp deleted file mode 100644 index b1681fb3f..000000000 --- a/compiler/tools/fpp-check/test/command/duplicate_name_param_get.fpp +++ /dev/null @@ -1,7 +0,0 @@ -active component C { - - param P: U32 - - async command P_PARAM_GET - -} diff --git a/compiler/tools/fpp-check/test/container/clean b/compiler/tools/fpp-check/test/container/clean new file mode 100755 index 000000000..32e49663c --- /dev/null +++ b/compiler/tools/fpp-check/test/container/clean @@ -0,0 +1,6 @@ +#!/bin/sh -e + +. ../../../../scripts/utils.sh + +clean +rm -f default-tests.sh default-update-ref.sh diff --git a/compiler/tools/fpp-check/test/container/duplicate_id_explicit.fpp b/compiler/tools/fpp-check/test/container/duplicate_id_explicit.fpp new file mode 100644 index 000000000..df263ed3c --- /dev/null +++ b/compiler/tools/fpp-check/test/container/duplicate_id_explicit.fpp @@ -0,0 +1,7 @@ +active component C { + + product container C1 id 0x10 + + product container C2 id 0x10 + +} diff --git a/compiler/tools/fpp-check/test/container/duplicate_id_explicit.ref.txt b/compiler/tools/fpp-check/test/container/duplicate_id_explicit.ref.txt new file mode 100644 index 000000000..9ba3b874d --- /dev/null +++ b/compiler/tools/fpp-check/test/container/duplicate_id_explicit.ref.txt @@ -0,0 +1,9 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/duplicate_id_explicit.fpp:5.3 + product container C2 id 0x10 + ^ +error: duplicate identifier value (16 dec, 10 hex) +previous occurrence is here: +[ local path prefix ]/compiler/tools/fpp-check/test/container/duplicate_id_explicit.fpp:3.3 + product container C1 id 0x10 + ^ diff --git a/compiler/tools/fpp-check/test/container/duplicate_id_implicit.fpp b/compiler/tools/fpp-check/test/container/duplicate_id_implicit.fpp new file mode 100644 index 000000000..9612583c9 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/duplicate_id_implicit.fpp @@ -0,0 +1,9 @@ +active component C { + + product container C1 id 0x11 + + product container C2 id 0x10 + + product container C3 + +} diff --git a/compiler/tools/fpp-check/test/container/duplicate_id_implicit.ref.txt b/compiler/tools/fpp-check/test/container/duplicate_id_implicit.ref.txt new file mode 100644 index 000000000..339b4c852 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/duplicate_id_implicit.ref.txt @@ -0,0 +1,9 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/duplicate_id_implicit.fpp:7.3 + product container C3 + ^ +error: duplicate identifier value (17 dec, 11 hex) +previous occurrence is here: +[ local path prefix ]/compiler/tools/fpp-check/test/container/duplicate_id_implicit.fpp:3.3 + product container C1 id 0x11 + ^ diff --git a/compiler/tools/fpp-check/test/container/duplicate_name.fpp b/compiler/tools/fpp-check/test/container/duplicate_name.fpp new file mode 100644 index 000000000..80f483920 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/duplicate_name.fpp @@ -0,0 +1,6 @@ +active component C { + + product container C + product container C + +} diff --git a/compiler/tools/fpp-check/test/container/duplicate_name.ref.txt b/compiler/tools/fpp-check/test/container/duplicate_name.ref.txt new file mode 100644 index 000000000..680e18159 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/duplicate_name.ref.txt @@ -0,0 +1,9 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/duplicate_name.fpp:4.3 + product container C + ^ +error: duplicate container name C +previous occurrence is here: +[ local path prefix ]/compiler/tools/fpp-check/test/container/duplicate_name.fpp:3.3 + product container C + ^ diff --git a/compiler/tools/fpp-check/test/container/id_negative.fpp b/compiler/tools/fpp-check/test/container/id_negative.fpp new file mode 100644 index 000000000..eca3d2bd8 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/id_negative.fpp @@ -0,0 +1,5 @@ +active component C { + + product container C id -1 + +} diff --git a/compiler/tools/fpp-check/test/container/id_negative.ref.txt b/compiler/tools/fpp-check/test/container/id_negative.ref.txt new file mode 100644 index 000000000..62c6c756f --- /dev/null +++ b/compiler/tools/fpp-check/test/container/id_negative.ref.txt @@ -0,0 +1,6 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/id_negative.fpp:3.26 + product container C id -1 + ^ +error: invalid integer value -1 +value may not be negative diff --git a/compiler/tools/fpp-check/test/container/id_not_numeric.fpp b/compiler/tools/fpp-check/test/container/id_not_numeric.fpp new file mode 100644 index 000000000..80589aafa --- /dev/null +++ b/compiler/tools/fpp-check/test/container/id_not_numeric.fpp @@ -0,0 +1,5 @@ +active component C { + + product container C id "abc" + +} diff --git a/compiler/tools/fpp-check/test/container/id_not_numeric.ref.txt b/compiler/tools/fpp-check/test/container/id_not_numeric.ref.txt new file mode 100644 index 000000000..e562c9225 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/id_not_numeric.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/id_not_numeric.fpp:3.26 + product container C id "abc" + ^ +error: cannot convert string to a numeric type diff --git a/compiler/tools/fpp-check/test/container/missing_ports.fpp b/compiler/tools/fpp-check/test/container/missing_ports.fpp new file mode 100644 index 000000000..e31ba9b8e --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_ports.fpp @@ -0,0 +1,5 @@ +passive component C { + + product container C + +} diff --git a/compiler/tools/fpp-check/test/container/missing_ports.ref.txt b/compiler/tools/fpp-check/test/container/missing_ports.ref.txt new file mode 100644 index 000000000..bb2585386 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_ports.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/missing_ports.fpp:1.1 +passive component C { +^ +error: component with data product specifiers must have product get port or product request port diff --git a/compiler/tools/fpp-check/test/container/missing_product_recv_port.fpp b/compiler/tools/fpp-check/test/container/missing_product_recv_port.fpp new file mode 100644 index 000000000..6cce58464 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_product_recv_port.fpp @@ -0,0 +1,18 @@ +module Fw { + port DpResponse + port DpRequest + port DpSend + port Time +} + +passive component C { + + product container C + + product request port productRequestOut + + product send port productSendOut + + time get port timeGetOut + +} diff --git a/compiler/tools/fpp-check/test/container/missing_product_recv_port.ref.txt b/compiler/tools/fpp-check/test/container/missing_product_recv_port.ref.txt new file mode 100644 index 000000000..f46f5e77b --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_product_recv_port.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/missing_product_recv_port.fpp:8.1 +passive component C { +^ +error: component with product request specifier must have product recv port diff --git a/compiler/tools/fpp-check/test/container/missing_product_send_port.fpp b/compiler/tools/fpp-check/test/container/missing_product_send_port.fpp new file mode 100644 index 000000000..59895a346 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_product_send_port.fpp @@ -0,0 +1,11 @@ +module Fw { + port DpGet +} + +passive component C { + + product container C + + product get port productGet + +} diff --git a/compiler/tools/fpp-check/test/container/missing_product_send_port.ref.txt b/compiler/tools/fpp-check/test/container/missing_product_send_port.ref.txt new file mode 100644 index 000000000..6880d82d1 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_product_send_port.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/missing_product_send_port.fpp:5.1 +passive component C { +^ +error: component with data product specifiers must have product send port diff --git a/compiler/tools/fpp-check/test/container/missing_record.fpp b/compiler/tools/fpp-check/test/container/missing_record.fpp new file mode 100644 index 000000000..2a50f7e72 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_record.fpp @@ -0,0 +1,18 @@ +module Fw { + + port DpGet + port DpSend + port Time + +} + +passive component C { + + product get port productGetOut + product send port productSendOut + time get port timeGetOut + + @ A container + product container Container + +} diff --git a/compiler/tools/fpp-check/test/container/missing_record.ref.txt b/compiler/tools/fpp-check/test/container/missing_record.ref.txt new file mode 100644 index 000000000..eef9fd6eb --- /dev/null +++ b/compiler/tools/fpp-check/test/container/missing_record.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/missing_record.fpp:16.3 + product container Container + ^ +error: component that specifies containers must specify at least one record diff --git a/compiler/tools/fpp-check/test/container/ok.fpp b/compiler/tools/fpp-check/test/container/ok.fpp new file mode 100644 index 000000000..1f1689783 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/ok.fpp @@ -0,0 +1,32 @@ +module Fw { + + port DpRequest + port DpResponse + port DpSend + port Time + +} + +passive component C { + + product request port productRequestOut + sync product recv port productRecvIn + product send port productSendOut + time get port timeGetOut + + @ A container with no ID and no default priority + product container Basic + + @ A container with ID and no default priority + product container IdOnly id 0x100 + + @ A container with ID and default priority + product container IdPriority id 0x200 default priority 3 + + @ A record with no ID + product record Basic: U32 + + @ A record with an ID + product record Id: U32 id 0x100 + +} diff --git a/compiler/tools/fpp-check/test/container/ok.ref.txt b/compiler/tools/fpp-check/test/container/ok.ref.txt new file mode 100644 index 000000000..e69de29bb diff --git a/compiler/tools/fpp-check/test/container/priority_negative.fpp b/compiler/tools/fpp-check/test/container/priority_negative.fpp new file mode 100644 index 000000000..20096c789 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/priority_negative.fpp @@ -0,0 +1,5 @@ +active component C { + + product container C id 0x100 default priority -1 + +} diff --git a/compiler/tools/fpp-check/test/container/priority_negative.ref.txt b/compiler/tools/fpp-check/test/container/priority_negative.ref.txt new file mode 100644 index 000000000..f1e9b3746 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/priority_negative.ref.txt @@ -0,0 +1,6 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/priority_negative.fpp:3.49 + product container C id 0x100 default priority -1 + ^ +error: invalid integer value -1 +value may not be negative diff --git a/compiler/tools/fpp-check/test/container/priority_not_numeric.fpp b/compiler/tools/fpp-check/test/container/priority_not_numeric.fpp new file mode 100644 index 000000000..8a560b99c --- /dev/null +++ b/compiler/tools/fpp-check/test/container/priority_not_numeric.fpp @@ -0,0 +1,5 @@ +active component C { + + product container C id 0x100 default priority "abc" + +} diff --git a/compiler/tools/fpp-check/test/container/priority_not_numeric.ref.txt b/compiler/tools/fpp-check/test/container/priority_not_numeric.ref.txt new file mode 100644 index 000000000..faba9cbb7 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/priority_not_numeric.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/container/priority_not_numeric.fpp:3.49 + product container C id 0x100 default priority "abc" + ^ +error: cannot convert string to a numeric type diff --git a/compiler/tools/fpp-check/test/container/run b/compiler/tools/fpp-check/test/container/run new file mode 100755 index 000000000..92816cad0 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/run @@ -0,0 +1,4 @@ +#!/bin/sh + +export LOCAL_PATH_PREFIX=`cd ../../../../..; echo $PWD` +../run-script diff --git a/compiler/tools/fpp-check/test/container/tests.sh b/compiler/tools/fpp-check/test/container/tests.sh new file mode 100644 index 000000000..da6fed098 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/tests.sh @@ -0,0 +1,14 @@ +tests=" +duplicate_id_explicit +duplicate_id_implicit +duplicate_name +id_negative +id_not_numeric +missing_ports +missing_product_recv_port +missing_product_send_port +missing_record +ok +priority_negative +priority_not_numeric +" diff --git a/compiler/tools/fpp-check/test/container/update-ref b/compiler/tools/fpp-check/test/container/update-ref new file mode 100755 index 000000000..0f11071e7 --- /dev/null +++ b/compiler/tools/fpp-check/test/container/update-ref @@ -0,0 +1,4 @@ +#!/bin/sh + +export LOCAL_PATH_PREFIX=`cd ../../../../..; echo $PWD` +../update-ref-script diff --git a/compiler/tools/fpp-check/test/port_instance/async_input_active.fpp b/compiler/tools/fpp-check/test/port_instance/async_input_active.fpp new file mode 100644 index 000000000..25f0deffe --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/async_input_active.fpp @@ -0,0 +1,7 @@ +port P + +active component C { + + async input port p: P + +} diff --git a/compiler/tools/fpp-check/test/port_instance/async_input_active.ref.txt b/compiler/tools/fpp-check/test/port_instance/async_input_active.ref.txt new file mode 100644 index 000000000..e69de29bb diff --git a/compiler/tools/fpp-check/test/port_instance/async_product_recv_active.fpp b/compiler/tools/fpp-check/test/port_instance/async_product_recv_active.fpp new file mode 100644 index 000000000..5bfd6bbc3 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/async_product_recv_active.fpp @@ -0,0 +1,11 @@ +module Fw { + + port DpResponse + +} + +active component C { + + async product recv port productRecvIn + +} diff --git a/compiler/tools/fpp-check/test/port_instance/async_product_recv_active.ref.txt b/compiler/tools/fpp-check/test/port_instance/async_product_recv_active.ref.txt new file mode 100644 index 000000000..e69de29bb diff --git a/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.fpp b/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.fpp new file mode 100644 index 000000000..ab2431773 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.fpp @@ -0,0 +1,11 @@ +module Fw { + + port DpResponse + +} + +passive component C { + + async product recv port productRecvIn + +} diff --git a/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.ref.txt b/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.ref.txt new file mode 100644 index 000000000..1c1fe87f2 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/async_product_recv_passive.fpp:9.3 + async product recv port productRecvIn + ^ +error: passive component may not have async input diff --git a/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.fpp b/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.fpp new file mode 100644 index 000000000..ee5ea11b3 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.fpp @@ -0,0 +1,11 @@ +module Fw { + + port DpResponse + +} + +active component C { + + async product recv port productRecvIn priority "abc" + +} diff --git a/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.ref.txt b/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.ref.txt new file mode 100644 index 000000000..562dc3ee2 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/bad_priority_product_recv.fpp:9.50 + async product recv port productRecvIn priority "abc" + ^ +error: cannot convert string to a numeric type diff --git a/compiler/tools/fpp-check/test/port_instance/ok.fpp b/compiler/tools/fpp-check/test/port_instance/ok.fpp index 01cb6356d..5c811ac06 100644 --- a/compiler/tools/fpp-check/test/port_instance/ok.fpp +++ b/compiler/tools/fpp-check/test/port_instance/ok.fpp @@ -3,6 +3,9 @@ module Fw { port Cmd port CmdReg port CmdResponse + port DpRequest + port DpResponse + port DpSend port Log port LogText port PrmGet @@ -25,12 +28,15 @@ active component C { guarded input port s3: serial output port s4: serial + async product recv port productRecvIn priority 3 drop command recv port cmdIn command reg port cmdRegIn command resp port cmdResponseIn event port eventOut param get port paramGetOut param set port paramSetOut + product request port productRequestOut + product send port productSendOut telemetry port tlmOut text event port textEventOut time get port timeGetOut diff --git a/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.fpp b/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.fpp new file mode 100644 index 000000000..d450afda7 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.fpp @@ -0,0 +1,12 @@ +module Fw { + + port Cmd + +} + +passive component C { + + sync command recv port cmdIn + +} + diff --git a/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.ref.txt b/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.ref.txt new file mode 100644 index 000000000..682827703 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/special_input_kind_command.fpp:9.3 + sync command recv port cmdIn + ^ +error: command recv port may not specify input kind diff --git a/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.fpp b/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.fpp new file mode 100644 index 000000000..156fe12f7 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.fpp @@ -0,0 +1,12 @@ +module Fw { + + port DpResponse + +} + +passive component C { + + product recv port productRecvIn + +} + diff --git a/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.ref.txt b/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.ref.txt new file mode 100644 index 000000000..a32fe5764 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/special_input_kind_missing_product_recv.fpp:9.3 + product recv port productRecvIn + ^ +error: product recv port must specify input kind diff --git a/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.fpp b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.fpp new file mode 100644 index 000000000..79c146976 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.fpp @@ -0,0 +1,11 @@ +module Fw { + + port DpResponse + +} + +passive component C { + + sync product recv port productRecvIn priority 10 + +} diff --git a/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.ref.txt b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.ref.txt new file mode 100644 index 000000000..0af664291 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/sync_product_recv_priority.fpp:9.49 + sync product recv port productRecvIn priority 10 + ^ +error: only async input may have a priority diff --git a/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.fpp b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.fpp new file mode 100644 index 000000000..cf6fbb9c7 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.fpp @@ -0,0 +1,11 @@ +module Fw { + + port DpResponse + +} + +passive component C { + + sync product recv port productRecvIn drop + +} diff --git a/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.ref.txt b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.ref.txt new file mode 100644 index 000000000..92804bffb --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/sync_product_recv_queue_full.fpp:9.40 + sync product recv port productRecvIn drop + ^ +error: only async input may have queue full behavior diff --git a/compiler/tools/fpp-check/test/port_instance/tests.sh b/compiler/tools/fpp-check/test/port_instance/tests.sh index d611dc63d..9c06a4335 100644 --- a/compiler/tools/fpp-check/test/port_instance/tests.sh +++ b/compiler/tools/fpp-check/test/port_instance/tests.sh @@ -1,14 +1,22 @@ tests=" +async_input_active async_input_passive async_input_ref_params async_input_return_value +async_product_recv_active +async_product_recv_passive bad_array_size bad_priority +bad_priority_product_recv duplicate_command_recv duplicate_general ok +special_input_kind_command +special_input_kind_missing_product_recv sync_input_priority sync_input_queue_full +sync_product_recv_priority +sync_product_recv_queue_full undef_command_recv undef_command_reg undef_command_resp @@ -16,5 +24,10 @@ undef_event undef_general undef_param_get undef_param_set +undef_product_recv +undef_product_request +undef_product_send +undef_telemetry undef_text_event +undef_time_get " diff --git a/compiler/tools/fpp-check/test/port_instance/undef_product_recv.fpp b/compiler/tools/fpp-check/test/port_instance/undef_product_recv.fpp new file mode 100644 index 000000000..2541d9aad --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_product_recv.fpp @@ -0,0 +1,5 @@ +active component C { + + async product recv port productRecvIn + +} diff --git a/compiler/tools/fpp-check/test/port_instance/undef_product_recv.ref.txt b/compiler/tools/fpp-check/test/port_instance/undef_product_recv.ref.txt new file mode 100644 index 000000000..c31d065ba --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_product_recv.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_product_recv.fpp:3.3 + async product recv port productRecvIn + ^ +error: undefined symbol Fw diff --git a/compiler/tools/fpp-check/test/port_instance/undef_product_request.fpp b/compiler/tools/fpp-check/test/port_instance/undef_product_request.fpp new file mode 100644 index 000000000..49a213505 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_product_request.fpp @@ -0,0 +1,5 @@ +passive component C { + + product request port productRequestOut + +} diff --git a/compiler/tools/fpp-check/test/port_instance/undef_product_request.ref.txt b/compiler/tools/fpp-check/test/port_instance/undef_product_request.ref.txt new file mode 100644 index 000000000..365a693f8 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_product_request.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_product_request.fpp:3.3 + product request port productRequestOut + ^ +error: undefined symbol Fw diff --git a/compiler/tools/fpp-check/test/port_instance/undef_product_send.fpp b/compiler/tools/fpp-check/test/port_instance/undef_product_send.fpp new file mode 100644 index 000000000..4d4871362 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_product_send.fpp @@ -0,0 +1,5 @@ +passive component C { + + product send port productSendOut + +} diff --git a/compiler/tools/fpp-check/test/port_instance/undef_product_send.ref.txt b/compiler/tools/fpp-check/test/port_instance/undef_product_send.ref.txt new file mode 100644 index 000000000..d40e44963 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_product_send.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_product_send.fpp:3.3 + product send port productSendOut + ^ +error: undefined symbol Fw diff --git a/compiler/tools/fpp-check/test/port_instance/undef_telemetry.ref.txt b/compiler/tools/fpp-check/test/port_instance/undef_telemetry.ref.txt new file mode 100644 index 000000000..b68567539 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_telemetry.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_telemetry.fpp:3.3 + telemetry port tlmOut + ^ +error: undefined symbol Fw diff --git a/compiler/tools/fpp-check/test/port_instance/undef_time_get.ref.txt b/compiler/tools/fpp-check/test/port_instance/undef_time_get.ref.txt new file mode 100644 index 000000000..9f063fae9 --- /dev/null +++ b/compiler/tools/fpp-check/test/port_instance/undef_time_get.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_time_get.fpp:3.3 + time get port timeGetOut + ^ +error: undefined symbol Fw diff --git a/compiler/tools/fpp-check/test/record/clean b/compiler/tools/fpp-check/test/record/clean new file mode 100755 index 000000000..32e49663c --- /dev/null +++ b/compiler/tools/fpp-check/test/record/clean @@ -0,0 +1,6 @@ +#!/bin/sh -e + +. ../../../../scripts/utils.sh + +clean +rm -f default-tests.sh default-update-ref.sh diff --git a/compiler/tools/fpp-check/test/record/duplicate_id_explicit.fpp b/compiler/tools/fpp-check/test/record/duplicate_id_explicit.fpp new file mode 100644 index 000000000..2793bf6bc --- /dev/null +++ b/compiler/tools/fpp-check/test/record/duplicate_id_explicit.fpp @@ -0,0 +1,7 @@ +active component C { + + product record R1: U32 id 0x10 + + product record R2: U32 id 0x10 + +} diff --git a/compiler/tools/fpp-check/test/record/duplicate_id_explicit.ref.txt b/compiler/tools/fpp-check/test/record/duplicate_id_explicit.ref.txt new file mode 100644 index 000000000..7e9034a4e --- /dev/null +++ b/compiler/tools/fpp-check/test/record/duplicate_id_explicit.ref.txt @@ -0,0 +1,9 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/duplicate_id_explicit.fpp:5.3 + product record R2: U32 id 0x10 + ^ +error: duplicate identifier value (16 dec, 10 hex) +previous occurrence is here: +[ local path prefix ]/compiler/tools/fpp-check/test/record/duplicate_id_explicit.fpp:3.3 + product record R1: U32 id 0x10 + ^ diff --git a/compiler/tools/fpp-check/test/record/duplicate_id_implicit.fpp b/compiler/tools/fpp-check/test/record/duplicate_id_implicit.fpp new file mode 100644 index 000000000..3a5352544 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/duplicate_id_implicit.fpp @@ -0,0 +1,9 @@ +active component C { + + product record R1: U32 id 0x11 + + product record R2: U32 id 0x10 + + product record R3: U32 + +} diff --git a/compiler/tools/fpp-check/test/record/duplicate_id_implicit.ref.txt b/compiler/tools/fpp-check/test/record/duplicate_id_implicit.ref.txt new file mode 100644 index 000000000..7d974eb48 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/duplicate_id_implicit.ref.txt @@ -0,0 +1,9 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/duplicate_id_implicit.fpp:7.3 + product record R3: U32 + ^ +error: duplicate identifier value (17 dec, 11 hex) +previous occurrence is here: +[ local path prefix ]/compiler/tools/fpp-check/test/record/duplicate_id_implicit.fpp:3.3 + product record R1: U32 id 0x11 + ^ diff --git a/compiler/tools/fpp-check/test/record/duplicate_name.fpp b/compiler/tools/fpp-check/test/record/duplicate_name.fpp new file mode 100644 index 000000000..33dbb8419 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/duplicate_name.fpp @@ -0,0 +1,6 @@ +active component C { + + product record R: U32 + product record R: U32 + +} diff --git a/compiler/tools/fpp-check/test/record/duplicate_name.ref.txt b/compiler/tools/fpp-check/test/record/duplicate_name.ref.txt new file mode 100644 index 000000000..5fa87388d --- /dev/null +++ b/compiler/tools/fpp-check/test/record/duplicate_name.ref.txt @@ -0,0 +1,9 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/duplicate_name.fpp:4.3 + product record R: U32 + ^ +error: duplicate record name R +previous occurrence is here: +[ local path prefix ]/compiler/tools/fpp-check/test/record/duplicate_name.fpp:3.3 + product record R: U32 + ^ diff --git a/compiler/tools/fpp-check/test/record/id_negative.fpp b/compiler/tools/fpp-check/test/record/id_negative.fpp new file mode 100644 index 000000000..25976de38 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/id_negative.fpp @@ -0,0 +1,5 @@ +active component C { + + product record R: U32 id -1 + +} diff --git a/compiler/tools/fpp-check/test/record/id_negative.ref.txt b/compiler/tools/fpp-check/test/record/id_negative.ref.txt new file mode 100644 index 000000000..5ad4f54e2 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/id_negative.ref.txt @@ -0,0 +1,6 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/id_negative.fpp:3.28 + product record R: U32 id -1 + ^ +error: invalid integer value -1 +value may not be negative diff --git a/compiler/tools/fpp-check/test/record/id_not_numeric.fpp b/compiler/tools/fpp-check/test/record/id_not_numeric.fpp new file mode 100644 index 000000000..d605524bc --- /dev/null +++ b/compiler/tools/fpp-check/test/record/id_not_numeric.fpp @@ -0,0 +1,5 @@ +active component C { + + product record R: U32 id "abc" + +} diff --git a/compiler/tools/fpp-check/test/record/id_not_numeric.ref.txt b/compiler/tools/fpp-check/test/record/id_not_numeric.ref.txt new file mode 100644 index 000000000..bdf6f8cfd --- /dev/null +++ b/compiler/tools/fpp-check/test/record/id_not_numeric.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/id_not_numeric.fpp:3.28 + product record R: U32 id "abc" + ^ +error: cannot convert string to a numeric type diff --git a/compiler/tools/fpp-check/test/record/missing_container.fpp b/compiler/tools/fpp-check/test/record/missing_container.fpp new file mode 100644 index 000000000..a0d91dee8 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_container.fpp @@ -0,0 +1,18 @@ +module Fw { + + port DpGet + port DpSend + port Time + +} + +passive component C { + + product get port productGetOut + product send port productSendOut + time get port timeGetOut + + @ A record + product record Record: U32 + +} diff --git a/compiler/tools/fpp-check/test/record/missing_container.ref.txt b/compiler/tools/fpp-check/test/record/missing_container.ref.txt new file mode 100644 index 000000000..e0e1dafb4 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_container.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/missing_container.fpp:16.3 + product record Record: U32 + ^ +error: component that specifies records must specify at least one container diff --git a/compiler/tools/fpp-check/test/record/missing_ports.fpp b/compiler/tools/fpp-check/test/record/missing_ports.fpp new file mode 100644 index 000000000..bbabca1f1 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_ports.fpp @@ -0,0 +1,5 @@ +passive component C { + + product record R: U32 + +} diff --git a/compiler/tools/fpp-check/test/record/missing_ports.ref.txt b/compiler/tools/fpp-check/test/record/missing_ports.ref.txt new file mode 100644 index 000000000..d89d2cf16 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_ports.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/missing_ports.fpp:1.1 +passive component C { +^ +error: component with data product specifiers must have product get port or product request port diff --git a/compiler/tools/fpp-check/test/record/missing_product_recv_port.fpp b/compiler/tools/fpp-check/test/record/missing_product_recv_port.fpp new file mode 100644 index 000000000..b2432aa47 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_product_recv_port.fpp @@ -0,0 +1,18 @@ +module Fw { + port DpResponse + port DpRequest + port DpSend + port Time +} + +passive component C { + + product record R: U32 + + product request port productRequestOut + + product send port productSendOut + + time get port timeGetOut + +} diff --git a/compiler/tools/fpp-check/test/record/missing_product_recv_port.ref.txt b/compiler/tools/fpp-check/test/record/missing_product_recv_port.ref.txt new file mode 100644 index 000000000..35f2e6ab0 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_product_recv_port.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/missing_product_recv_port.fpp:8.1 +passive component C { +^ +error: component with product request specifier must have product recv port diff --git a/compiler/tools/fpp-check/test/record/missing_product_send_port.fpp b/compiler/tools/fpp-check/test/record/missing_product_send_port.fpp new file mode 100644 index 000000000..02dae8aa5 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_product_send_port.fpp @@ -0,0 +1,11 @@ +module Fw { + port DpGet +} + +passive component C { + + product record R: U32 + + product get port productGet + +} diff --git a/compiler/tools/fpp-check/test/record/missing_product_send_port.ref.txt b/compiler/tools/fpp-check/test/record/missing_product_send_port.ref.txt new file mode 100644 index 000000000..0549f13f5 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/missing_product_send_port.ref.txt @@ -0,0 +1,5 @@ +fpp-check +[ local path prefix ]/compiler/tools/fpp-check/test/record/missing_product_send_port.fpp:5.1 +passive component C { +^ +error: component with data product specifiers must have product send port diff --git a/compiler/tools/fpp-check/test/record/ok.fpp b/compiler/tools/fpp-check/test/record/ok.fpp new file mode 100644 index 000000000..94c4c5439 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/ok.fpp @@ -0,0 +1,29 @@ +module Fw { + + port DpRequest + port DpResponse + port DpSend + port Time + +} + +passive component C { + + product request port productRequestOut + sync product recv port productRecvIn + product send port productSendOut + time get port timeGetOut + + @ A container + product container Container + + @ A record with no ID + product record NoId: U32 + + @ A record with ID + product record Id: U32 id 0x100 + + @ An array record + product record U32Array: U32 array + +} diff --git a/compiler/tools/fpp-check/test/record/ok.ref.txt b/compiler/tools/fpp-check/test/record/ok.ref.txt new file mode 100644 index 000000000..e69de29bb diff --git a/compiler/tools/fpp-check/test/record/run b/compiler/tools/fpp-check/test/record/run new file mode 100755 index 000000000..92816cad0 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/run @@ -0,0 +1,4 @@ +#!/bin/sh + +export LOCAL_PATH_PREFIX=`cd ../../../../..; echo $PWD` +../run-script diff --git a/compiler/tools/fpp-check/test/record/tests.sh b/compiler/tools/fpp-check/test/record/tests.sh new file mode 100644 index 000000000..a78c4def0 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/tests.sh @@ -0,0 +1,12 @@ +tests=" +duplicate_id_explicit +duplicate_id_implicit +duplicate_name +id_negative +id_not_numeric +missing_container +missing_ports +missing_product_recv_port +missing_product_send_port +ok +" diff --git a/compiler/tools/fpp-check/test/record/update-ref b/compiler/tools/fpp-check/test/record/update-ref new file mode 100755 index 000000000..0f11071e7 --- /dev/null +++ b/compiler/tools/fpp-check/test/record/update-ref @@ -0,0 +1,4 @@ +#!/bin/sh + +export LOCAL_PATH_PREFIX=`cd ../../../../..; echo $PWD` +../update-ref-script diff --git a/compiler/tools/fpp-depend/test/spec_port_instance.fpp b/compiler/tools/fpp-depend/test/spec_async_input_port.fpp similarity index 100% rename from compiler/tools/fpp-depend/test/spec_port_instance.fpp rename to compiler/tools/fpp-depend/test/spec_async_input_port.fpp diff --git a/compiler/tools/fpp-depend/test/spec_port_instance.ref.txt b/compiler/tools/fpp-depend/test/spec_async_input_port.ref.txt similarity index 100% rename from compiler/tools/fpp-depend/test/spec_port_instance.ref.txt rename to compiler/tools/fpp-depend/test/spec_async_input_port.ref.txt diff --git a/compiler/tools/fpp-depend/test/spec_async_product_recv_port.fpp b/compiler/tools/fpp-depend/test/spec_async_product_recv_port.fpp new file mode 100644 index 000000000..98c485e64 --- /dev/null +++ b/compiler/tools/fpp-depend/test/spec_async_product_recv_port.fpp @@ -0,0 +1,8 @@ +locate port Fw.DpResponse at "DpResponse.fpp" +locate constant a at "a.fpp" + +active component C { + + async product recv port p priority a + +} diff --git a/compiler/tools/fpp-depend/test/spec_async_product_recv_port.ref.txt b/compiler/tools/fpp-depend/test/spec_async_product_recv_port.ref.txt new file mode 100644 index 000000000..2f56074f5 --- /dev/null +++ b/compiler/tools/fpp-depend/test/spec_async_product_recv_port.ref.txt @@ -0,0 +1,2 @@ +[ local path prefix ]/compiler/tools/fpp-depend/test/DpResponse.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/a.fpp diff --git a/compiler/tools/fpp-depend/test/spec_container.fpp b/compiler/tools/fpp-depend/test/spec_container.fpp new file mode 100644 index 000000000..c0e7467f1 --- /dev/null +++ b/compiler/tools/fpp-depend/test/spec_container.fpp @@ -0,0 +1,8 @@ +locate constant a at "a.fpp" +locate constant b at "b.fpp" + +active component C { + + product container C id a default priority b + +} diff --git a/compiler/tools/fpp-depend/test/spec_container.ref.txt b/compiler/tools/fpp-depend/test/spec_container.ref.txt new file mode 100644 index 000000000..0b35645cc --- /dev/null +++ b/compiler/tools/fpp-depend/test/spec_container.ref.txt @@ -0,0 +1,2 @@ +[ local path prefix ]/compiler/tools/fpp-depend/test/a.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/b.fpp diff --git a/compiler/tools/fpp-depend/test/spec_record.fpp b/compiler/tools/fpp-depend/test/spec_record.fpp new file mode 100644 index 000000000..91e698a61 --- /dev/null +++ b/compiler/tools/fpp-depend/test/spec_record.fpp @@ -0,0 +1,8 @@ +locate type T at "T.fpp" +locate constant a at "a.fpp" + +active component C { + + product record R: T id a + +} diff --git a/compiler/tools/fpp-depend/test/spec_record.ref.txt b/compiler/tools/fpp-depend/test/spec_record.ref.txt new file mode 100644 index 000000000..a37d8451a --- /dev/null +++ b/compiler/tools/fpp-depend/test/spec_record.ref.txt @@ -0,0 +1,2 @@ +[ local path prefix ]/compiler/tools/fpp-depend/test/T.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/a.fpp diff --git a/compiler/tools/fpp-depend/test/special_ports.fpp b/compiler/tools/fpp-depend/test/special_ports.fpp new file mode 100644 index 000000000..f3e500836 --- /dev/null +++ b/compiler/tools/fpp-depend/test/special_ports.fpp @@ -0,0 +1,40 @@ +locate port Fw.Cmd at "Cmd.fpp" +locate port Fw.CmdReg at "CmdReg.fpp" +locate port Fw.CmdResponse at "CmdResponse.fpp" +locate port Fw.Log at "Log.fpp" +locate port Fw.PrmGet at "PrmGet.fpp" +locate port Fw.PrmSet at "PrmSet.fpp" +locate port Fw.DpRequest at "DpRequest.fpp" +locate port Fw.DpResponse at "DpResponse.fpp" +locate port Fw.DpSend at "DpSend.fpp" +locate port Fw.Tlm at "Tlm.fpp" +locate port Fw.LogText at "LogText.fpp" +locate port Fw.Time at "Time.fpp" + +active component C { + + command recv port cmdIn + + command reg port cmdRegIn + + command resp port cmdResponseIn + + event port eventOut + + param get port prmGetOut + + param set port prmSetOut + + async product recv port productRecvIn + + product request port productRequestOut + + product send port productSendOut + + telemetry port tlmOut + + text event port textEventOut + + time get port timeGetOut + +} diff --git a/compiler/tools/fpp-depend/test/special_ports.ref.txt b/compiler/tools/fpp-depend/test/special_ports.ref.txt new file mode 100644 index 000000000..a37517efe --- /dev/null +++ b/compiler/tools/fpp-depend/test/special_ports.ref.txt @@ -0,0 +1,12 @@ +[ local path prefix ]/compiler/tools/fpp-depend/test/Cmd.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/CmdReg.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/CmdResponse.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/DpRequest.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/DpResponse.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/DpSend.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/Log.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/LogText.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/PrmGet.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/PrmSet.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/Time.fpp +[ local path prefix ]/compiler/tools/fpp-depend/test/Tlm.fpp diff --git a/compiler/tools/fpp-depend/test/tests.sh b/compiler/tools/fpp-depend/test/tests.sh index 27e0472fa..5db2f2dfb 100644 --- a/compiler/tools/fpp-depend/test/tests.sh +++ b/compiler/tools/fpp-depend/test/tests.sh @@ -32,15 +32,19 @@ locate_constant_inconsistent locate_constant_modules_1 locate_constant_modules_2 missing +spec_async_input_port +spec_async_product_recv_port spec_command spec_comp_instance spec_connection_graph_direct spec_connection_graph_pattern +spec_container spec_event spec_internal_port spec_param -spec_port_instance +spec_record spec_tlm_channel spec_top_import +special_ports transitive_instance " diff --git a/compiler/tools/fpp-format/test/component.fpp b/compiler/tools/fpp-format/test/component.fpp index 1040bd3f9..85a901840 100644 --- a/compiler/tools/fpp-format/test/component.fpp +++ b/compiler/tools/fpp-format/test/component.fpp @@ -36,5 +36,13 @@ active component C { internal port I(a: U32, b: F32) priority 10 assert @< Internal port specifier + @ Data product container specifier + product container C id 0x100 default priority 10 + @< Data product container specifier + + @ Data product record specifier + product record R: U32 id 0x100 + @< Data product record specifier + } @< Component definition diff --git a/compiler/tools/fpp-format/test/component.ref.txt b/compiler/tools/fpp-format/test/component.ref.txt index d3c9669c3..8551cbbe2 100644 --- a/compiler/tools/fpp-format/test/component.ref.txt +++ b/compiler/tools/fpp-format/test/component.ref.txt @@ -71,4 +71,10 @@ active component C { priority 10 \ assert @< Internal port specifier + @ Data product container specifier + product container C id 0x100 default priority 10 @< Data product container specifier + + @ Data product record specifier + product record R: U32 id 0x100 @< Data product record specifier + } @< Component definition diff --git a/compiler/tools/fpp-format/test/include.ref.txt b/compiler/tools/fpp-format/test/include.ref.txt index 2d0183fd9..f417f168f 100644 --- a/compiler/tools/fpp-format/test/include.ref.txt +++ b/compiler/tools/fpp-format/test/include.ref.txt @@ -26,6 +26,12 @@ module DefinitionsAndSpecifiers { Z } + @ Container specifier + product container C id 0x00 default priority 10 @< Container specifier + + @ Record specifier + product record R: U32 array id 0x00 @< Record specifier + @ Command specifier async command C( a: U32 @@ -48,6 +54,11 @@ module DefinitionsAndSpecifiers { @ Special port instance specifier command recv port cmdIn @< Special port instance specifier + @ Async product receive port + async product recv port productRecvIn \ + priority 10 \ + assert @< Async product receive port + output port p2: [10] P @ Port matching specifier diff --git a/compiler/tools/fpp-format/test/no_include.ref.txt b/compiler/tools/fpp-format/test/no_include.ref.txt index b207007e3..c805ea27d 100644 --- a/compiler/tools/fpp-format/test/no_include.ref.txt +++ b/compiler/tools/fpp-format/test/no_include.ref.txt @@ -26,6 +26,12 @@ module DefinitionsAndSpecifiers { Z } + @ Container specifier + product container C id 0x00 default priority 10 @< Container specifier + + @ Record specifier + product record R: U32 array id 0x00 @< Record specifier + @ Command specifier async command C( a: U32 @@ -48,6 +54,11 @@ module DefinitionsAndSpecifiers { @ Special port instance specifier command recv port cmdIn @< Special port instance specifier + @ Async product receive port + async product recv port productRecvIn \ + priority 10 \ + assert @< Async product receive port + output port p2: [10] P @ Port matching specifier diff --git a/compiler/tools/fpp-format/test/syntax.fpp b/compiler/tools/fpp-format/test/syntax.fpp index ee9e8f603..2b99a8f60 100644 --- a/compiler/tools/fpp-format/test/syntax.fpp +++ b/compiler/tools/fpp-format/test/syntax.fpp @@ -17,6 +17,14 @@ module DefinitionsAndSpecifiers { struct S { x: [3] U32, y: F32, z: string } enum E { X, Y, Z } + @ Container specifier + product container C id 0x00 default priority 10 + @< Container specifier + + @ Record specifier + product record R: U32 array id 0x00 + @< Record specifier + @ Command specifier async command C(a: U32, b: F32) opcode 0x00 priority 10 assert @< Command specifier @@ -33,6 +41,10 @@ module DefinitionsAndSpecifiers { command recv port cmdIn @< Special port instance specifier + @ Async product receive port + async product recv port productRecvIn priority 10 assert + @< Async product receive port + output port p2: [10] P @ Port matching specifier match p1 with p2 diff --git a/compiler/tools/fpp-from-xml/test/top/fprime_ref.ref.txt b/compiler/tools/fpp-from-xml/test/top/fprime_ref.ref.txt index 176418d0b..03c3ea5ef 100644 --- a/compiler/tools/fpp-from-xml/test/top/fprime_ref.ref.txt +++ b/compiler/tools/fpp-from-xml/test/top/fprime_ref.ref.txt @@ -134,7 +134,7 @@ topology Ref { uplink.bufferDeallocate[0] -> fileUplinkBufferManager.bufferSendIn[0] fileUplink.bufferSendOut[0] -> fileUplinkBufferManager.bufferSendIn[0] downlink.framedAllocate[0] -> staticMemory.bufferAllocate[1] - downlink.framedOut[0] -> comm.send[0] + downlink.framedOut[0] -> comm.$send[0] comm.deallocate[0] -> staticMemory.bufferDeallocate[1] eventLogger.PktSend[0] -> downlink.comIn[0] chanTlm.PktSend[0] -> downlink.comIn[0] diff --git a/compiler/tools/fpp-locate-uses/test/defs.fpp b/compiler/tools/fpp-locate-uses/test/defs.fpp index 9f1a38843..812e035cb 100644 --- a/compiler/tools/fpp-locate-uses/test/defs.fpp +++ b/compiler/tools/fpp-locate-uses/test/defs.fpp @@ -4,6 +4,9 @@ module Fw { port Cmd port CmdReg port CmdResponse + port DpRequest + port DpResponse + port DpSend port Log port LogText port PrmGet @@ -71,3 +74,8 @@ constant queue_size_def = 10 constant stack_size_def = 10 constant priority_def = 10 constant cpu_def = 0 +type RecordType +constant record_id = 0 +constant container_id = 0 +constant container_priority = 0 +constant product_recv_priority = 0 diff --git a/compiler/tools/fpp-locate-uses/test/stdin.ref.txt b/compiler/tools/fpp-locate-uses/test/stdin.ref.txt index cbae9b506..cf7677068 100644 --- a/compiler/tools/fpp-locate-uses/test/stdin.ref.txt +++ b/compiler/tools/fpp-locate-uses/test/stdin.ref.txt @@ -4,15 +4,22 @@ locate constant C1.a at "defs.fpp" locate constant M.a at "defs.fpp" locate constant a at "defs.fpp" locate constant base_id_def at "defs.fpp" +locate constant container_id at "defs.fpp" +locate constant container_priority at "defs.fpp" locate constant cpu_def at "defs.fpp" locate constant priority_def at "defs.fpp" +locate constant product_recv_priority at "defs.fpp" locate constant queue_size_def at "defs.fpp" +locate constant record_id at "defs.fpp" locate constant stack_size_def at "defs.fpp" locate instance M.c11 at "defs.fpp" locate instance c11 at "defs.fpp" locate port Fw.Cmd at "defs.fpp" locate port Fw.CmdReg at "defs.fpp" locate port Fw.CmdResponse at "defs.fpp" +locate port Fw.DpRequest at "defs.fpp" +locate port Fw.DpResponse at "defs.fpp" +locate port Fw.DpSend at "defs.fpp" locate port Fw.Log at "defs.fpp" locate port Fw.LogText at "defs.fpp" locate port Fw.PrmGet at "defs.fpp" @@ -33,5 +40,6 @@ locate type M.E at "defs.fpp" locate type M.S at "defs.fpp" locate type M.T at "defs.fpp" locate type Phases at "defs.fpp" +locate type RecordType at "defs.fpp" locate type S at "defs.fpp" locate type T at "defs.fpp" diff --git a/compiler/tools/fpp-locate-uses/test/uses.ref.txt b/compiler/tools/fpp-locate-uses/test/uses.ref.txt index cbae9b506..cf7677068 100644 --- a/compiler/tools/fpp-locate-uses/test/uses.ref.txt +++ b/compiler/tools/fpp-locate-uses/test/uses.ref.txt @@ -4,15 +4,22 @@ locate constant C1.a at "defs.fpp" locate constant M.a at "defs.fpp" locate constant a at "defs.fpp" locate constant base_id_def at "defs.fpp" +locate constant container_id at "defs.fpp" +locate constant container_priority at "defs.fpp" locate constant cpu_def at "defs.fpp" locate constant priority_def at "defs.fpp" +locate constant product_recv_priority at "defs.fpp" locate constant queue_size_def at "defs.fpp" +locate constant record_id at "defs.fpp" locate constant stack_size_def at "defs.fpp" locate instance M.c11 at "defs.fpp" locate instance c11 at "defs.fpp" locate port Fw.Cmd at "defs.fpp" locate port Fw.CmdReg at "defs.fpp" locate port Fw.CmdResponse at "defs.fpp" +locate port Fw.DpRequest at "defs.fpp" +locate port Fw.DpResponse at "defs.fpp" +locate port Fw.DpSend at "defs.fpp" locate port Fw.Log at "defs.fpp" locate port Fw.LogText at "defs.fpp" locate port Fw.PrmGet at "defs.fpp" @@ -33,5 +40,6 @@ locate type M.E at "defs.fpp" locate type M.S at "defs.fpp" locate type M.T at "defs.fpp" locate type Phases at "defs.fpp" +locate type RecordType at "defs.fpp" locate type S at "defs.fpp" locate type T at "defs.fpp" diff --git a/compiler/tools/fpp-locate-uses/test/uses/uses.fpp b/compiler/tools/fpp-locate-uses/test/uses/uses.fpp index 25abf403b..f9cac4720 100644 --- a/compiler/tools/fpp-locate-uses/test/uses/uses.fpp +++ b/compiler/tools/fpp-locate-uses/test/uses/uses.fpp @@ -34,6 +34,15 @@ active component C3 { time get port timeGetOut } +active component C4 { + product request port productRequestOut + async product recv port productRecvIn priority product_recv_priority + product send port productSendOut + time get port timeGetOut + product container C id container_id default priority container_priority + product record R: RecordType id record_id +} + instance c12: C1 \ base id base_id_def \ queue size queue_size_def \ diff --git a/compiler/tools/fpp-locate-uses/test/uses_dir.ref.txt b/compiler/tools/fpp-locate-uses/test/uses_dir.ref.txt index 493a8edfd..ae5db6dc8 100644 --- a/compiler/tools/fpp-locate-uses/test/uses_dir.ref.txt +++ b/compiler/tools/fpp-locate-uses/test/uses_dir.ref.txt @@ -4,15 +4,22 @@ locate constant C1.a at "../defs.fpp" locate constant M.a at "../defs.fpp" locate constant a at "../defs.fpp" locate constant base_id_def at "../defs.fpp" +locate constant container_id at "../defs.fpp" +locate constant container_priority at "../defs.fpp" locate constant cpu_def at "../defs.fpp" locate constant priority_def at "../defs.fpp" +locate constant product_recv_priority at "../defs.fpp" locate constant queue_size_def at "../defs.fpp" +locate constant record_id at "../defs.fpp" locate constant stack_size_def at "../defs.fpp" locate instance M.c11 at "../defs.fpp" locate instance c11 at "../defs.fpp" locate port Fw.Cmd at "../defs.fpp" locate port Fw.CmdReg at "../defs.fpp" locate port Fw.CmdResponse at "../defs.fpp" +locate port Fw.DpRequest at "../defs.fpp" +locate port Fw.DpResponse at "../defs.fpp" +locate port Fw.DpSend at "../defs.fpp" locate port Fw.Log at "../defs.fpp" locate port Fw.LogText at "../defs.fpp" locate port Fw.PrmGet at "../defs.fpp" @@ -33,5 +40,6 @@ locate type M.E at "../defs.fpp" locate type M.S at "../defs.fpp" locate type M.T at "../defs.fpp" locate type Phases at "../defs.fpp" +locate type RecordType at "../defs.fpp" locate type S at "../defs.fpp" locate type T at "../defs.fpp" diff --git a/compiler/tools/fpp-syntax/test/syntax-ast.ref.txt b/compiler/tools/fpp-syntax/test/syntax-ast.ref.txt index 319d61f8c..e9b9c7547 100644 --- a/compiler/tools/fpp-syntax/test/syntax-ast.ref.txt +++ b/compiler/tools/fpp-syntax/test/syntax-ast.ref.txt @@ -43,6 +43,18 @@ def module ident Y def enum constant ident Z + @ Container specifier + spec container + ident C + id literal int 0x00 + default priority literal int 10 + @< Container specifier + @ Record specifier + spec record + ident R + type name U32 array + id literal int 0x00 + @< Record specifier @ Command specifier spec command kind async @@ -82,6 +94,14 @@ def module kind command recv ident cmdIn @< Special port instance specifier + @ Async product receive port + spec port instance special + input kind async + kind product recv + ident productRecvIn + priority literal int 10 + queue full assert + @< Async product receive port spec port instance general kind output ident p2 diff --git a/compiler/tools/fpp-syntax/test/syntax-include-ast.ref.txt b/compiler/tools/fpp-syntax/test/syntax-include-ast.ref.txt index b57e5a737..bdea0bad2 100644 --- a/compiler/tools/fpp-syntax/test/syntax-include-ast.ref.txt +++ b/compiler/tools/fpp-syntax/test/syntax-include-ast.ref.txt @@ -43,6 +43,18 @@ def module ident Y def enum constant ident Z + @ Container specifier + spec container + ident C + id literal int 0x00 + default priority literal int 10 + @< Container specifier + @ Record specifier + spec record + ident R + type name U32 array + id literal int 0x00 + @< Record specifier @ Command specifier spec command kind async @@ -82,6 +94,14 @@ def module kind command recv ident cmdIn @< Special port instance specifier + @ Async product receive port + spec port instance special + input kind async + kind product recv + ident productRecvIn + priority literal int 10 + queue full assert + @< Async product receive port spec port instance general kind output ident p2 diff --git a/compiler/tools/fpp-syntax/test/syntax-stdin.ref.txt b/compiler/tools/fpp-syntax/test/syntax-stdin.ref.txt index b57e5a737..bdea0bad2 100644 --- a/compiler/tools/fpp-syntax/test/syntax-stdin.ref.txt +++ b/compiler/tools/fpp-syntax/test/syntax-stdin.ref.txt @@ -43,6 +43,18 @@ def module ident Y def enum constant ident Z + @ Container specifier + spec container + ident C + id literal int 0x00 + default priority literal int 10 + @< Container specifier + @ Record specifier + spec record + ident R + type name U32 array + id literal int 0x00 + @< Record specifier @ Command specifier spec command kind async @@ -82,6 +94,14 @@ def module kind command recv ident cmdIn @< Special port instance specifier + @ Async product receive port + spec port instance special + input kind async + kind product recv + ident productRecvIn + priority literal int 10 + queue full assert + @< Async product receive port spec port instance general kind output ident p2 diff --git a/compiler/tools/fpp-syntax/test/syntax.fpp b/compiler/tools/fpp-syntax/test/syntax.fpp index ee9e8f603..2b99a8f60 100644 --- a/compiler/tools/fpp-syntax/test/syntax.fpp +++ b/compiler/tools/fpp-syntax/test/syntax.fpp @@ -17,6 +17,14 @@ module DefinitionsAndSpecifiers { struct S { x: [3] U32, y: F32, z: string } enum E { X, Y, Z } + @ Container specifier + product container C id 0x00 default priority 10 + @< Container specifier + + @ Record specifier + product record R: U32 array id 0x00 + @< Record specifier + @ Command specifier async command C(a: U32, b: F32) opcode 0x00 priority 10 assert @< Command specifier @@ -33,6 +41,10 @@ module DefinitionsAndSpecifiers { command recv port cmdIn @< Special port instance specifier + @ Async product receive port + async product recv port productRecvIn priority 10 assert + @< Async product receive port + output port p2: [10] P @ Port matching specifier match p1 with p2 diff --git a/compiler/tools/fpp-to-cpp/test/.gitignore b/compiler/tools/fpp-to-cpp/test/.gitignore index 1bcc68679..510e5850a 100644 --- a/compiler/tools/fpp-to-cpp/test/.gitignore +++ b/compiler/tools/fpp-to-cpp/test/.gitignore @@ -1,12 +1,16 @@ -*.out.* *.diff.txt *.names.txt -default-tests.sh -default-update-ref.sh *.o -*Ac.hpp -*Ac.cpp -*.template.hpp +*.out.* *.template.cpp +*.template.hpp +*Ac.cpp +*Ac.hpp +*GTestBase.cpp +*GTestBase.hpp +*TesterBase.cpp +*TesterBase.hpp +default-tests.sh +default-update-ref.sh !*/include/* diff --git a/compiler/tools/fpp-to-cpp/test/component/active.fpp b/compiler/tools/fpp-to-cpp/test/component/active.fpp index c73a4c7e9..e333a84fc 100644 --- a/compiler/tools/fpp-to-cpp/test/component/active.fpp +++ b/compiler/tools/fpp-to-cpp/test/component/active.fpp @@ -3,16 +3,18 @@ module M { @ An active component active component ActiveTest { + include "include/internal_ports.fppi" + include "include/product_ports_async.fppi" + include "include/special_ports.fppi" include "include/typed_ports.fppi" include "include/typed_ports_async.fppi" - include "include/special_ports.fppi" - include "include/internal_ports.fppi" include "include/commands.fppi" include "include/commands_async.fppi" include "include/events.fppi" - include "include/telemetry.fppi" include "include/params.fppi" + include "include/products.fppi" + include "include/telemetry.fppi" } @@ -80,3 +82,58 @@ active component ActiveParams { include "include/params.fppi" } + +@ An active component with async data products +active component ActiveAsyncProducts { + + include "include/product_ports_async.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ An active component with sync data products +active component ActiveSyncProducts { + + include "include/product_ports_sync.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ An active component with guarded data products +active component ActiveGuardedProducts { + + include "include/product_ports_guarded.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ An active component with data product get +active component ActiveGetProducts { + + include "include/product_ports_get.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ An active component with async product request and ports only +active component ActiveAsyncProductPortsOnly { + + include "include/product_ports_async.fppi" + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp new file mode 100644 index 000000000..dde695b88 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp @@ -0,0 +1,566 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/ActiveAsyncProductPortsOnlyComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + ACTIVEASYNCPRODUCTPORTSONLY_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + PRODUCTRECVIN_DPRESPONSE, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE productRecvInPortSize[Fw::InputDpResponsePort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputDpResponsePort* ActiveAsyncProductPortsOnlyComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductPortsOnlyComponentBase :: + ActiveAsyncProductPortsOnlyComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +ActiveAsyncProductPortsOnlyComponentBase :: + ~ActiveAsyncProductPortsOnlyComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductPortsOnlyComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductPortsOnlyComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductPortsOnlyComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool ActiveAsyncProductPortsOnlyComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductPortsOnlyComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + productRecvIn_preMsgHook( + portNum, + id, + buffer, + status + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(PRODUCTRECVIN_DPRESPONSE) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument id + _status = msg.serialize(id); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument buffer + _status = msg.serialize(buffer); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument status + _status = msg.serialize(status); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void ActiveAsyncProductPortsOnlyComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus ActiveAsyncProductPortsOnlyComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == ACTIVEASYNCPRODUCTPORTSONLY_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port productRecvIn + case PRODUCTRECVIN_DPRESPONSE: { + // Deserialize argument id + FwDpIdType id; + deserStatus = msg.deserialize(id); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument buffer + Fw::Buffer buffer; + deserStatus = msg.deserialize(buffer); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument status + Fw::Success status; + deserStatus = msg.deserialize(status); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductPortsOnlyComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + (void) portNum; + (void) id; + (void) buffer; + (void) status; + // No data products defined +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.hpp new file mode 100644 index 000000000..2c8e1f051 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.hpp @@ -0,0 +1,291 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProductPortsOnly component base class +// ====================================================================== + +#ifndef ActiveAsyncProductPortsOnlyComponentAc_HPP +#define ActiveAsyncProductPortsOnlyComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" + +//! \class ActiveAsyncProductPortsOnlyComponentBase +//! \brief Auto-generated base for ActiveAsyncProductPortsOnly component +//! +//! An active component with async product request and ports only +class ActiveAsyncProductPortsOnlyComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class ActiveAsyncProductPortsOnlyComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize ActiveAsyncProductPortsOnlyComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveAsyncProductPortsOnlyComponentBase object + ActiveAsyncProductPortsOnlyComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy ActiveAsyncProductPortsOnlyComponentBase object + virtual ~ActiveAsyncProductPortsOnlyComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp new file mode 100644 index 000000000..0f9357ca0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -0,0 +1,3678 @@ +// ====================================================================== +// \title ActiveAsyncProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/ActiveAsyncProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + ACTIVEASYNCPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + PRODUCTRECVIN_DPRESPONSE, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE productRecvInPortSize[Fw::InputDpResponsePort::SERIALIZED_SIZE]; + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +ActiveAsyncProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +ActiveAsyncProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const ActiveAsyncProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * ActiveAsyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const ActiveAsyncProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + ActiveAsyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* ActiveAsyncProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* ActiveAsyncProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* ActiveAsyncProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveAsyncProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveAsyncProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveAsyncProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveAsyncProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveAsyncProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveAsyncProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveAsyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void ActiveAsyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveAsyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void ActiveAsyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveAsyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductsComponentBase :: + ActiveAsyncProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +ActiveAsyncProductsComponentBase :: + ~ActiveAsyncProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool ActiveAsyncProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool ActiveAsyncProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool ActiveAsyncProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool ActiveAsyncProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool ActiveAsyncProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + productRecvIn_preMsgHook( + portNum, + id, + buffer, + status + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(PRODUCTRECVIN_DPRESPONSE) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument id + _status = msg.serialize(id); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument buffer + _status = msg.serialize(buffer); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument status + _status = msg.serialize(status); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveAsyncProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 ActiveAsyncProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 ActiveAsyncProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void ActiveAsyncProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void ActiveAsyncProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveAsyncProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveAsyncProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveAsyncProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveAsyncProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 ActiveAsyncProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 ActiveAsyncProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void ActiveAsyncProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void ActiveAsyncProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveAsyncProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveAsyncProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveAsyncProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void ActiveAsyncProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 ActiveAsyncProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void ActiveAsyncProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time ActiveAsyncProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void ActiveAsyncProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus ActiveAsyncProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == ACTIVEASYNCPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port productRecvIn + case PRODUCTRECVIN_DPRESPONSE: { + // Deserialize argument id + FwDpIdType id; + deserStatus = msg.deserialize(id); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument buffer + Fw::Buffer buffer; + deserStatus = msg.deserialize(buffer); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument status + Fw::Success status; + deserStatus = msg.deserialize(status); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + break; + } + + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void ActiveAsyncProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void ActiveAsyncProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 ActiveAsyncProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 ActiveAsyncProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void ActiveAsyncProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void ActiveAsyncProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveAsyncProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void ActiveAsyncProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp new file mode 100644 index 000000000..00bfe1fb4 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp @@ -0,0 +1,1665 @@ +// ====================================================================== +// \title ActiveAsyncProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProducts component base class +// ====================================================================== + +#ifndef ActiveAsyncProductsComponentAc_HPP +#define ActiveAsyncProductsComponentAc_HPP + +#include "ActiveAsyncProducts_DataSerializableAc.hpp" +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class ActiveAsyncProductsComponentBase +//! \brief Auto-generated base for ActiveAsyncProducts component +//! +//! An active component with async data products +class ActiveAsyncProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class ActiveAsyncProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const ActiveAsyncProducts_Data* array, //!< An array of ActiveAsyncProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const ActiveAsyncProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize ActiveAsyncProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveAsyncProductsComponentBase object + ActiveAsyncProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy ActiveAsyncProductsComponentBase object + virtual ~ActiveAsyncProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp index 2fdf93e1c..5fa84c560 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp @@ -1675,7 +1675,7 @@ void ActiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1696,7 +1696,7 @@ U32 ActiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1716,7 +1716,7 @@ U32 ActiveCommandsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1731,7 +1731,7 @@ void ActiveCommandsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2189,7 +2189,7 @@ void ActiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2228,7 +2228,7 @@ F32 ActiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2266,7 +2266,7 @@ F32 ActiveCommandsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2299,7 +2299,7 @@ void ActiveCommandsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp index 0f8e15d43..2138b444d 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp @@ -1594,7 +1594,7 @@ void ActiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1615,7 +1615,7 @@ U32 ActiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1635,7 +1635,7 @@ U32 ActiveEventsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1650,7 +1650,7 @@ void ActiveEventsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2108,7 +2108,7 @@ void ActiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2147,7 +2147,7 @@ F32 ActiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2185,7 +2185,7 @@ F32 ActiveEventsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2218,7 +2218,7 @@ void ActiveEventsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp new file mode 100644 index 000000000..66ea3fc2f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -0,0 +1,3428 @@ +// ====================================================================== +// \title ActiveGetProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/ActiveGetProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + ACTIVEGETPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +ActiveGetProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +ActiveGetProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const ActiveGetProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * ActiveGetProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const ActiveGetProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + ActiveGetProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productGetOut_OutputPorts()); + port++ + ) { + this->m_productGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* ActiveGetProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* ActiveGetProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveGetProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveGetProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveGetProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveGetProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveGetProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveGetProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveGetProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void ActiveGetProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGetProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGetProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGetProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGetProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGetProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveGetProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void ActiveGetProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGetProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGetProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveGetProductsComponentBase :: + ActiveGetProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +ActiveGetProductsComponentBase :: + ~ActiveGetProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_productGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGetProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool ActiveGetProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_productGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool ActiveGetProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool ActiveGetProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool ActiveGetProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGetProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGetProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 ActiveGetProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 ActiveGetProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void ActiveGetProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void ActiveGetProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGetProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGetProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGetProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGetProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 ActiveGetProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 ActiveGetProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void ActiveGetProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void ActiveGetProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveGetProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveGetProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveGetProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +Fw::Success ActiveGetProductsComponentBase :: + productGetOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_productGetOut_OutputPort[portNum].invoke( + id, + size, + buffer + ); +} + +void ActiveGetProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 ActiveGetProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void ActiveGetProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGetProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time ActiveGetProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void ActiveGetProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus ActiveGetProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == ACTIVEGETPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void ActiveGetProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 ActiveGetProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 ActiveGetProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void ActiveGetProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void ActiveGetProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGetProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveGetProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveGetProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +Fw::Success::T ActiveGetProductsComponentBase :: + dpGet( + ContainerId::T containerId, + FwSizeType size, + DpContainer& container + ) +{ + const FwDpIdType baseId = this->getIdBase(); + const FwDpIdType globalId = baseId + containerId; + Fw::Buffer buffer; + const Fw::Success::T status = this->productGetOut_out(0, globalId, size, buffer); + if (status == Fw::Success::SUCCESS) { + container.setId(globalId); + container.setBuffer(buffer); + container.setBaseId(baseId); + } + return status; +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp new file mode 100644 index 000000000..2d132291a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp @@ -0,0 +1,1604 @@ +// ====================================================================== +// \title ActiveGetProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGetProducts component base class +// ====================================================================== + +#ifndef ActiveGetProductsComponentAc_HPP +#define ActiveGetProductsComponentAc_HPP + +#include "ActiveGetProducts_DataSerializableAc.hpp" +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpGetPortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class ActiveGetProductsComponentBase +//! \brief Auto-generated base for ActiveGetProducts component +//! +//! An active component with data product get +class ActiveGetProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class ActiveGetProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTGETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const ActiveGetProducts_Data* array, //!< An array of ActiveGetProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const ActiveGetProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize ActiveGetProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productGetOut[portNum] + void set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpGetPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveGetProductsComponentBase object + ActiveGetProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy ActiveGetProductsComponentBase object + virtual ~ActiveGetProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productGetOut output ports + //! + //! \return The number of productGetOut output ports + NATIVE_INT_TYPE getNum_productGetOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productGetOut is connected + //! + //! \return Whether port productGetOut is connected + bool isConnected_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productGetOut + Fw::Success productGetOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Get a buffer and use it to initialize container Container1 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container1( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container1, size, container); + } + + //! Get a buffer and use it to initialize container Container2 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container2( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container2, size, container); + } + + //! Get a buffer and use it to initialize container Container3 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container3( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container3, size, container); + } + + //! Get a buffer and use it to initialize container Container4 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container4( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container4, size, container); + } + + //! Get a buffer and use it to initialize container Container5 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container5( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container5, size, container); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Get a buffer and use it to initialize a data product container + //! \return The status of the buffer request + Fw::Success::T dpGet( + ContainerId::T containerId, //!< The component-local container id (input) + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productGetOut + Fw::OutputDpGetPort m_productGetOut_OutputPort[NUM_PRODUCTGETOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp new file mode 100644 index 000000000..56b17240b --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -0,0 +1,3598 @@ +// ====================================================================== +// \title ActiveGuardedProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/ActiveGuardedProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + ACTIVEGUARDEDPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +ActiveGuardedProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +ActiveGuardedProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const ActiveGuardedProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * ActiveGuardedProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const ActiveGuardedProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + ActiveGuardedProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* ActiveGuardedProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* ActiveGuardedProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* ActiveGuardedProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveGuardedProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveGuardedProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveGuardedProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveGuardedProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveGuardedProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveGuardedProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveGuardedProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void ActiveGuardedProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveGuardedProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void ActiveGuardedProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveGuardedProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveGuardedProductsComponentBase :: + ActiveGuardedProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +ActiveGuardedProductsComponentBase :: + ~ActiveGuardedProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool ActiveGuardedProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool ActiveGuardedProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool ActiveGuardedProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool ActiveGuardedProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool ActiveGuardedProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + // Unlock guard mutex + this->unLock(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGuardedProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 ActiveGuardedProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 ActiveGuardedProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void ActiveGuardedProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void ActiveGuardedProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGuardedProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGuardedProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGuardedProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveGuardedProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 ActiveGuardedProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 ActiveGuardedProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void ActiveGuardedProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void ActiveGuardedProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveGuardedProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveGuardedProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveGuardedProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void ActiveGuardedProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 ActiveGuardedProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void ActiveGuardedProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time ActiveGuardedProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void ActiveGuardedProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus ActiveGuardedProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == ACTIVEGUARDEDPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void ActiveGuardedProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void ActiveGuardedProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 ActiveGuardedProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 ActiveGuardedProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void ActiveGuardedProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void ActiveGuardedProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveGuardedProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void ActiveGuardedProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp new file mode 100644 index 000000000..fecc20334 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp @@ -0,0 +1,1665 @@ +// ====================================================================== +// \title ActiveGuardedProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGuardedProducts component base class +// ====================================================================== + +#ifndef ActiveGuardedProductsComponentAc_HPP +#define ActiveGuardedProductsComponentAc_HPP + +#include "ActiveGuardedProducts_DataSerializableAc.hpp" +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class ActiveGuardedProductsComponentBase +//! \brief Auto-generated base for ActiveGuardedProducts component +//! +//! An active component with guarded data products +class ActiveGuardedProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class ActiveGuardedProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const ActiveGuardedProducts_Data* array, //!< An array of ActiveGuardedProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const ActiveGuardedProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize ActiveGuardedProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveGuardedProductsComponentBase object + ActiveGuardedProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy ActiveGuardedProductsComponentBase object + virtual ~ActiveGuardedProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp index 24ba15288..92aa7a316 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp @@ -1830,7 +1830,7 @@ void ActiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1851,7 +1851,7 @@ U32 ActiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1871,7 +1871,7 @@ U32 ActiveParamsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1886,7 +1886,7 @@ void ActiveParamsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2344,7 +2344,7 @@ void ActiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2383,7 +2383,7 @@ F32 ActiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2421,7 +2421,7 @@ F32 ActiveParamsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2454,7 +2454,7 @@ void ActiveParamsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp index 47b60074c..5aebc6de2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp @@ -2290,7 +2290,7 @@ void ActiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -2311,7 +2311,7 @@ U32 ActiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -2331,7 +2331,7 @@ U32 ActiveSerialComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -2346,7 +2346,7 @@ void ActiveSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2804,7 +2804,7 @@ void ActiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2843,7 +2843,7 @@ F32 ActiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2881,7 +2881,7 @@ F32 ActiveSerialComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2914,7 +2914,7 @@ void ActiveSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, @@ -3153,7 +3153,7 @@ void ActiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->serialGuarded_handler( portNum, buffer @@ -3175,7 +3175,7 @@ void ActiveSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->serialSync_handler( portNum, buffer diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp new file mode 100644 index 000000000..f584d82a9 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -0,0 +1,3592 @@ +// ====================================================================== +// \title ActiveSyncProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/ActiveSyncProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + ACTIVESYNCPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +ActiveSyncProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +ActiveSyncProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const ActiveSyncProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * ActiveSyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const ActiveSyncProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + ActiveSyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* ActiveSyncProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* ActiveSyncProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* ActiveSyncProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveSyncProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveSyncProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveSyncProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* ActiveSyncProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveSyncProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* ActiveSyncProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveSyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void ActiveSyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void ActiveSyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void ActiveSyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void ActiveSyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveSyncProductsComponentBase :: + ActiveSyncProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +ActiveSyncProductsComponentBase :: + ~ActiveSyncProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE ActiveSyncProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool ActiveSyncProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool ActiveSyncProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool ActiveSyncProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool ActiveSyncProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool ActiveSyncProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveSyncProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 ActiveSyncProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 ActiveSyncProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void ActiveSyncProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void ActiveSyncProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveSyncProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveSyncProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveSyncProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void ActiveSyncProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 ActiveSyncProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 ActiveSyncProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void ActiveSyncProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void ActiveSyncProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveSyncProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveSyncProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void ActiveSyncProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void ActiveSyncProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 ActiveSyncProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void ActiveSyncProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveSyncProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time ActiveSyncProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void ActiveSyncProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus ActiveSyncProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == ACTIVESYNCPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void ActiveSyncProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void ActiveSyncProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 ActiveSyncProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 ActiveSyncProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void ActiveSyncProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void ActiveSyncProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveSyncProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveSyncProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveSyncProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + ActiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void ActiveSyncProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void ActiveSyncProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp new file mode 100644 index 000000000..018e4acc0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp @@ -0,0 +1,1665 @@ +// ====================================================================== +// \title ActiveSyncProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveSyncProducts component base class +// ====================================================================== + +#ifndef ActiveSyncProductsComponentAc_HPP +#define ActiveSyncProductsComponentAc_HPP + +#include "ActiveSyncProducts_DataSerializableAc.hpp" +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class ActiveSyncProductsComponentBase +//! \brief Auto-generated base for ActiveSyncProducts component +//! +//! An active component with sync data products +class ActiveSyncProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class ActiveSyncProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const ActiveSyncProducts_Data* array, //!< An array of ActiveSyncProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const ActiveSyncProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize ActiveSyncProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveSyncProductsComponentBase object + ActiveSyncProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy ActiveSyncProductsComponentBase object + virtual ~ActiveSyncProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp index 997710f25..fb0911c23 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp @@ -1597,7 +1597,7 @@ void ActiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1618,7 +1618,7 @@ U32 ActiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1638,7 +1638,7 @@ U32 ActiveTelemetryComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1653,7 +1653,7 @@ void ActiveTelemetryComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2111,7 +2111,7 @@ void ActiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2150,7 +2150,7 @@ F32 ActiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2188,7 +2188,7 @@ F32 ActiveTelemetryComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2221,7 +2221,7 @@ void ActiveTelemetryComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index b8bd8f4f0..9f16c57bc 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -17,6 +17,7 @@ namespace M { namespace { enum MsgTypeEnum { ACTIVETEST_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + PRODUCTRECVIN_DPRESPONSE, NOARGSASYNC_NOARGS, TYPEDASYNC_TYPED, TYPEDASYNCASSERT_TYPED, @@ -38,6 +39,7 @@ namespace M { // Get the max size by constructing a union of the async input, command, and // internal port serialization sizes union BuffUnion { + BYTE productRecvInPortSize[Fw::InputDpResponsePort::SERIALIZED_SIZE]; BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; @@ -106,6 +108,166 @@ namespace M { }; } + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + ActiveTestComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) + { + + } + + ActiveTestComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) + { + + } + + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const M::ActiveTest_Data* array, + FwSizeType size + ) + { + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * M::ActiveTest_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_DataRecord(const M::ActiveTest_Data& elt) + { + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + M::ActiveTest_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) + { + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) + { + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) + { + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + // ---------------------------------------------------------------------- // Component initialization // ---------------------------------------------------------------------- @@ -145,6 +307,32 @@ namespace M { #endif } + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + // Connect input port noArgsAsync for ( PlatformIntType port = 0; @@ -588,6 +776,48 @@ namespace M { #endif } + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + #if FW_ENABLE_TEXT_LOGGING == 1 // Connect output port textEventOut for ( @@ -762,6 +992,17 @@ namespace M { return &this->m_cmdIn_InputPort[portNum]; } + Fw::InputDpResponsePort* ActiveTestComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) + { + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; + } + // ---------------------------------------------------------------------- // Getters for typed input ports // ---------------------------------------------------------------------- @@ -983,6 +1224,34 @@ namespace M { this->m_prmSetOut_OutputPort[portNum].addCallPort(port); } + void ActiveTestComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) + { + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); + } + + void ActiveTestComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) + { + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); + } + #if FW_ENABLE_TEXT_LOGGING == 1 void ActiveTestComponentBase :: @@ -1151,6 +1420,34 @@ namespace M { this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); } + void ActiveTestComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) + { + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); + } + + void ActiveTestComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) + { + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); + } + #if FW_ENABLE_TEXT_LOGGING == 1 void ActiveTestComponentBase :: @@ -1579,6 +1876,12 @@ namespace M { return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); } + NATIVE_INT_TYPE ActiveTestComponentBase :: + getNum_productRecvIn_InputPorts() const + { + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); + } + // ---------------------------------------------------------------------- // Getters for numbers of typed input ports // ---------------------------------------------------------------------- @@ -1695,6 +1998,18 @@ namespace M { return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); } + NATIVE_INT_TYPE ActiveTestComponentBase :: + getNum_productRequestOut_OutputPorts() const + { + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); + } + + NATIVE_INT_TYPE ActiveTestComponentBase :: + getNum_productSendOut_OutputPorts() const + { + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); + } + #if FW_ENABLE_TEXT_LOGGING == 1 NATIVE_INT_TYPE ActiveTestComponentBase :: @@ -1804,6 +2119,28 @@ namespace M { return this->m_prmSetOut_OutputPort[portNum].isConnected(); } + bool ActiveTestComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) + { + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); + } + + bool ActiveTestComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) + { + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); + } + #if FW_ENABLE_TEXT_LOGGING == 1 bool ActiveTestComponentBase :: @@ -1889,6 +2226,83 @@ namespace M { return this->m_typedReturnOut_OutputPort[portNum].isConnected(); } + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + void ActiveTestComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) + { + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + productRecvIn_preMsgHook( + portNum, + id, + buffer, + status + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(PRODUCTRECVIN_DPRESPONSE) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument id + _status = msg.serialize(id); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument buffer + _status = msg.serialize(buffer); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument status + _status = msg.serialize(status); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); + } + // ---------------------------------------------------------------------- // Port handler base-class functions for typed input ports // @@ -1947,7 +2361,7 @@ namespace M { // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1968,7 +2382,7 @@ namespace M { // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1988,7 +2402,7 @@ namespace M { U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -2003,7 +2417,7 @@ namespace M { static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2461,7 +2875,7 @@ namespace M { // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2500,7 +2914,7 @@ namespace M { // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2538,7 +2952,7 @@ namespace M { F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2571,7 +2985,7 @@ namespace M { static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, @@ -2584,6 +2998,25 @@ namespace M { ); } + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + void ActiveTestComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) + { + // Default: no-op + } + // ---------------------------------------------------------------------- // Pre-message hooks for typed async input ports // @@ -2658,6 +3091,44 @@ namespace M { // Default: no-op } + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + void ActiveTestComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) + { + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); + } + + void ActiveTestComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) + { + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); + } + // ---------------------------------------------------------------------- // Invocation functions for typed output ports // ---------------------------------------------------------------------- @@ -5170,6 +5641,34 @@ namespace M { return _local; } + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + void ActiveTestComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) + { + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); + } + // ---------------------------------------------------------------------- // Time // ---------------------------------------------------------------------- @@ -5250,6 +5749,42 @@ namespace M { ); switch (msgType) { + // Handle async input port productRecvIn + case PRODUCTRECVIN_DPRESPONSE: { + // Deserialize argument id + FwDpIdType id; + deserStatus = msg.deserialize(id); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument buffer + Fw::Buffer buffer; + deserStatus = msg.deserialize(buffer); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument status + Fw::Success status; + deserStatus = msg.deserialize(status); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + break; + } + // Handle async input port noArgsAsync case NOARGSASYNC_NOARGS: { // Call handler function @@ -6295,6 +6830,25 @@ namespace M { } } + void ActiveTestComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) + { + FW_ASSERT(callComp); + ActiveTestComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); + } + // ---------------------------------------------------------------------- // Calls for messages received on typed input ports // ---------------------------------------------------------------------- @@ -6872,4 +7426,69 @@ namespace M { return Fw::CmdResponse::EXECUTION_ERROR; } + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + void ActiveTestComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) + { + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); + } + + void ActiveTestComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) + { + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } + } + } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp index 0f70dda3f..6594d772a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp @@ -8,6 +8,7 @@ #define M_ActiveTestComponentAc_HPP #include "AArrayAc.hpp" +#include "ActiveTest_DataSerializableAc.hpp" #include "EEnumAc.hpp" #include "FpConfig.hpp" #include "Fw/Cmd/CmdPortAc.hpp" @@ -15,6 +16,10 @@ #include "Fw/Cmd/CmdResponsePortAc.hpp" #include "Fw/Cmd/CmdString.hpp" #include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" #include "Fw/Log/LogPortAc.hpp" #include "Fw/Log/LogString.hpp" #if FW_ENABLE_TEXT_LOGGING == 1 @@ -62,6 +67,7 @@ namespace M { //! Enumerations for numbers of special input ports enum { NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, }; //! Enumerations for numbers of typed input ports @@ -88,6 +94,8 @@ namespace M { NUM_EVENTOUT_OUTPUT_PORTS = 1, NUM_PRMGETOUT_OUTPUT_PORTS = 1, NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, NUM_TIMEGETOUT_OUTPUT_PORTS = 1, NUM_TLMOUT_OUTPUT_PORTS = 1, @@ -178,6 +186,108 @@ namespace M { PARAMID_PARAMSTRUCT = 0x32, //!< A parameter with struct data and set/save opcodes }; + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const M::ActiveTest_Data* array, //!< An array of M::ActiveTest_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const M::ActiveTest_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + public: // ---------------------------------------------------------------------- @@ -203,6 +313,13 @@ namespace M { NATIVE_INT_TYPE portNum //!< The port number ); + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + public: // ---------------------------------------------------------------------- @@ -336,6 +453,18 @@ namespace M { Fw::InputPrmSetPort* port //!< The input port ); + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Connect port to textEventOut[portNum] @@ -420,6 +549,18 @@ namespace M { Fw::InputSerializePort* port //!< The port ); + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Connect port to textEventOut[portNum] @@ -513,6 +654,11 @@ namespace M { //! \return The number of cmdIn input ports NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + PROTECTED: // ---------------------------------------------------------------------- @@ -615,6 +761,16 @@ namespace M { //! \return The number of prmSetOut output ports NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get the number of textEventOut output ports @@ -701,6 +857,20 @@ namespace M { NATIVE_INT_TYPE portNum //!< The port number ); + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Check whether port textEventOut is connected @@ -760,6 +930,22 @@ namespace M { NATIVE_INT_TYPE portNum //!< The port number ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1016,6 +1202,24 @@ namespace M { const S& s //!< A struct ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1079,6 +1283,26 @@ namespace M { const S& s //!< A struct ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1813,6 +2037,89 @@ namespace M { Fw::ParamValid& valid //!< Whether the parameter is valid ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + PROTECTED: // ---------------------------------------------------------------------- @@ -1863,6 +2170,15 @@ namespace M { Fw::CmdArgBuffer& args //!< Buffer containing arguments ); + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PRIVATE: // ---------------------------------------------------------------------- @@ -2087,6 +2403,26 @@ namespace M { //! \return The command response Fw::CmdResponse paramSave_ParamStruct(); + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + PRIVATE: // ---------------------------------------------------------------------- @@ -2096,6 +2432,9 @@ namespace M { //! Input port cmdIn Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + PRIVATE: // ---------------------------------------------------------------------- @@ -2162,6 +2501,12 @@ namespace M { //! Output port prmSetOut Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Output port textEventOut diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp index 266fd3f21..867fa1eed 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp @@ -1327,7 +1327,7 @@ void PassiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1348,7 +1348,7 @@ U32 PassiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1368,7 +1368,7 @@ U32 PassiveCommandsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1383,7 +1383,7 @@ void PassiveCommandsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -1408,7 +1408,7 @@ void PassiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -1447,7 +1447,7 @@ F32 PassiveCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -1485,7 +1485,7 @@ F32 PassiveCommandsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -1518,7 +1518,7 @@ void PassiveCommandsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp index 779673c29..cdea59e2d 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.hpp @@ -35,7 +35,7 @@ //! \class PassiveCommandsComponentBase //! \brief Auto-generated base for PassiveCommands component //! -//! An passive component with commands +//! A passive component with commands class PassiveCommandsComponentBase : public Fw::PassiveComponentBase { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp index 7b50cb2ed..694c2c8fb 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp @@ -1271,7 +1271,7 @@ void PassiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1292,7 +1292,7 @@ U32 PassiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1312,7 +1312,7 @@ U32 PassiveEventsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1327,7 +1327,7 @@ void PassiveEventsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -1352,7 +1352,7 @@ void PassiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -1391,7 +1391,7 @@ F32 PassiveEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -1429,7 +1429,7 @@ F32 PassiveEventsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -1462,7 +1462,7 @@ void PassiveEventsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp index 88ec9579a..b0622088a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.hpp @@ -35,7 +35,7 @@ //! \class PassiveEventsComponentBase //! \brief Auto-generated base for PassiveEvents component //! -//! An passive component with events +//! A passive component with events class PassiveEventsComponentBase : public Fw::PassiveComponentBase { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp new file mode 100644 index 000000000..24954730e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp @@ -0,0 +1,219 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/PassiveGetProductPortsOnlyComponentAc.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveGetProductPortsOnlyComponentBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect output port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productGetOut_OutputPorts()); + port++ + ) { + this->m_productGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductPortsOnlyComponentBase :: + set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductPortsOnlyComponentBase :: + PassiveGetProductPortsOnlyComponentBase(const char* compName) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveGetProductPortsOnlyComponentBase :: + ~PassiveGetProductPortsOnlyComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductPortsOnlyComponentBase :: + getNum_productGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductPortsOnlyComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool PassiveGetProductPortsOnlyComponentBase :: + isConnected_productGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductPortsOnlyComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +Fw::Success PassiveGetProductPortsOnlyComponentBase :: + productGetOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_productGetOut_OutputPort[portNum].invoke( + id, + size, + buffer + ); +} + +void PassiveGetProductPortsOnlyComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.hpp new file mode 100644 index 000000000..8e1cf9508 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.hpp @@ -0,0 +1,174 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProductPortsOnly component base class +// ====================================================================== + +#ifndef PassiveGetProductPortsOnlyComponentAc_HPP +#define PassiveGetProductPortsOnlyComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpGetPortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" + +//! \class PassiveGetProductPortsOnlyComponentBase +//! \brief Auto-generated base for PassiveGetProductPortsOnly component +//! +//! A passive component with product get and ports only +class PassiveGetProductPortsOnlyComponentBase : + public Fw::PassiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class PassiveGetProductPortsOnlyComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special output ports + enum { + NUM_PRODUCTGETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize PassiveGetProductPortsOnlyComponentBase object + void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productGetOut[portNum] + void set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpGetPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveGetProductPortsOnlyComponentBase object + PassiveGetProductPortsOnlyComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy PassiveGetProductPortsOnlyComponentBase object + virtual ~PassiveGetProductPortsOnlyComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of productGetOut output ports + //! + //! \return The number of productGetOut output ports + NATIVE_INT_TYPE getNum_productGetOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port productGetOut is connected + //! + //! \return Whether port productGetOut is connected + bool isConnected_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productGetOut + Fw::Success productGetOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port productGetOut + Fw::OutputDpGetPort m_productGetOut_OutputPort[NUM_PRODUCTGETOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp new file mode 100644 index 000000000..3895bce37 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -0,0 +1,2132 @@ +// ====================================================================== +// \title PassiveGetProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/PassiveGetProductsComponentAc.hpp" + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +PassiveGetProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +PassiveGetProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const PassiveGetProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * PassiveGetProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const PassiveGetProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + PassiveGetProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productGetOut_OutputPorts()); + port++ + ) { + this->m_productGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* PassiveGetProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* PassiveGetProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveGetProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveGetProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* PassiveGetProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* PassiveGetProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* PassiveGetProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* PassiveGetProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* PassiveGetProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void PassiveGetProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void PassiveGetProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGetProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGetProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGetProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGetProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGetProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void PassiveGetProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void PassiveGetProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGetProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGetProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductsComponentBase :: + PassiveGetProductsComponentBase(const char* compName) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveGetProductsComponentBase :: + ~PassiveGetProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_productGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGetProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool PassiveGetProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_productGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool PassiveGetProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool PassiveGetProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool PassiveGetProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGetProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 PassiveGetProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 PassiveGetProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void PassiveGetProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void PassiveGetProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 PassiveGetProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 PassiveGetProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void PassiveGetProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +Fw::Success PassiveGetProductsComponentBase :: + productGetOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_productGetOut_OutputPort[portNum].invoke( + id, + size, + buffer + ); +} + +void PassiveGetProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 PassiveGetProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void PassiveGetProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGetProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time PassiveGetProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void PassiveGetProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 PassiveGetProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 PassiveGetProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void PassiveGetProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void PassiveGetProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGetProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 PassiveGetProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void PassiveGetProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +Fw::Success::T PassiveGetProductsComponentBase :: + dpGet( + ContainerId::T containerId, + FwSizeType size, + DpContainer& container + ) +{ + const FwDpIdType baseId = this->getIdBase(); + const FwDpIdType globalId = baseId + containerId; + Fw::Buffer buffer; + const Fw::Success::T status = this->productGetOut_out(0, globalId, size, buffer); + if (status == Fw::Success::SUCCESS) { + container.setId(globalId); + container.setBuffer(buffer); + container.setBaseId(baseId); + } + return status; +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp new file mode 100644 index 000000000..903ed0a46 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp @@ -0,0 +1,1287 @@ +// ====================================================================== +// \title PassiveGetProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProducts component base class +// ====================================================================== + +#ifndef PassiveGetProductsComponentAc_HPP +#define PassiveGetProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpGetPortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "PassiveGetProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class PassiveGetProductsComponentBase +//! \brief Auto-generated base for PassiveGetProducts component +//! +//! A passive component with data product get +class PassiveGetProductsComponentBase : + public Fw::PassiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class PassiveGetProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTGETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const PassiveGetProducts_Data* array, //!< An array of PassiveGetProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const PassiveGetProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize PassiveGetProductsComponentBase object + void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productGetOut[portNum] + void set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpGetPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveGetProductsComponentBase object + PassiveGetProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy PassiveGetProductsComponentBase object + virtual ~PassiveGetProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productGetOut output ports + //! + //! \return The number of productGetOut output ports + NATIVE_INT_TYPE getNum_productGetOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productGetOut is connected + //! + //! \return Whether port productGetOut is connected + bool isConnected_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productGetOut + Fw::Success productGetOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Get a buffer and use it to initialize container Container1 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container1( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container1, size, container); + } + + //! Get a buffer and use it to initialize container Container2 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container2( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container2, size, container); + } + + //! Get a buffer and use it to initialize container Container3 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container3( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container3, size, container); + } + + //! Get a buffer and use it to initialize container Container4 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container4( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container4, size, container); + } + + //! Get a buffer and use it to initialize container Container5 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container5( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container5, size, container); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Get a buffer and use it to initialize a data product container + //! \return The status of the buffer request + Fw::Success::T dpGet( + ContainerId::T containerId, //!< The component-local container id (input) + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productGetOut + Fw::OutputDpGetPort m_productGetOut_OutputPort[NUM_PRODUCTGETOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp new file mode 100644 index 000000000..32b76a8be --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -0,0 +1,2302 @@ +// ====================================================================== +// \title PassiveGuardedProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/PassiveGuardedProductsComponentAc.hpp" + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +PassiveGuardedProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +PassiveGuardedProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const PassiveGuardedProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * PassiveGuardedProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const PassiveGuardedProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + PassiveGuardedProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* PassiveGuardedProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* PassiveGuardedProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* PassiveGuardedProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveGuardedProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveGuardedProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* PassiveGuardedProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* PassiveGuardedProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* PassiveGuardedProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* PassiveGuardedProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* PassiveGuardedProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void PassiveGuardedProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void PassiveGuardedProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void PassiveGuardedProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void PassiveGuardedProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveGuardedProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGuardedProductsComponentBase :: + PassiveGuardedProductsComponentBase(const char* compName) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveGuardedProductsComponentBase :: + ~PassiveGuardedProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool PassiveGuardedProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool PassiveGuardedProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool PassiveGuardedProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool PassiveGuardedProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool PassiveGuardedProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + // Unlock guard mutex + this->unLock(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 PassiveGuardedProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 PassiveGuardedProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void PassiveGuardedProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void PassiveGuardedProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 PassiveGuardedProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 PassiveGuardedProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void PassiveGuardedProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void PassiveGuardedProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 PassiveGuardedProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void PassiveGuardedProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time PassiveGuardedProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void PassiveGuardedProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void PassiveGuardedProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 PassiveGuardedProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 PassiveGuardedProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void PassiveGuardedProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void PassiveGuardedProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void PassiveGuardedProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void PassiveGuardedProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp new file mode 100644 index 000000000..e41ab3ac0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp @@ -0,0 +1,1348 @@ +// ====================================================================== +// \title PassiveGuardedProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGuardedProducts component base class +// ====================================================================== + +#ifndef PassiveGuardedProductsComponentAc_HPP +#define PassiveGuardedProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "PassiveGuardedProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class PassiveGuardedProductsComponentBase +//! \brief Auto-generated base for PassiveGuardedProducts component +//! +//! A passive component with guarded data products +class PassiveGuardedProductsComponentBase : + public Fw::PassiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class PassiveGuardedProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const PassiveGuardedProducts_Data* array, //!< An array of PassiveGuardedProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const PassiveGuardedProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize PassiveGuardedProductsComponentBase object + void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveGuardedProductsComponentBase object + PassiveGuardedProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy PassiveGuardedProductsComponentBase object + virtual ~PassiveGuardedProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp index fe2b5edc7..23eb6cc4a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp @@ -1507,7 +1507,7 @@ void PassiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1528,7 +1528,7 @@ U32 PassiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1548,7 +1548,7 @@ U32 PassiveParamsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1563,7 +1563,7 @@ void PassiveParamsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -1588,7 +1588,7 @@ void PassiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -1627,7 +1627,7 @@ F32 PassiveParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -1665,7 +1665,7 @@ F32 PassiveParamsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -1698,7 +1698,7 @@ void PassiveParamsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp index d8c353898..57b3c992b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.hpp @@ -36,7 +36,7 @@ //! \class PassiveParamsComponentBase //! \brief Auto-generated base for PassiveParams component //! -//! An passive component with params +//! A passive component with params class PassiveParamsComponentBase : public Fw::PassiveComponentBase { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp index 0a23279ad..e61246230 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp @@ -1728,7 +1728,7 @@ void PassiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1749,7 +1749,7 @@ U32 PassiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1769,7 +1769,7 @@ U32 PassiveSerialComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1784,7 +1784,7 @@ void PassiveSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -1809,7 +1809,7 @@ void PassiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -1848,7 +1848,7 @@ F32 PassiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -1886,7 +1886,7 @@ F32 PassiveSerialComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -1919,7 +1919,7 @@ void PassiveSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, @@ -1953,7 +1953,7 @@ void PassiveSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->serialGuarded_handler( portNum, buffer @@ -1975,7 +1975,7 @@ void PassiveSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->serialSync_handler( portNum, buffer diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp new file mode 100644 index 000000000..117f2fc41 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp @@ -0,0 +1,372 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/PassiveSyncProductPortsOnlyComponentAc.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputDpResponsePort* PassiveSyncProductPortsOnlyComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductPortsOnlyComponentBase :: + PassiveSyncProductPortsOnlyComponentBase(const char* compName) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveSyncProductPortsOnlyComponentBase :: + ~PassiveSyncProductPortsOnlyComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductPortsOnlyComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductPortsOnlyComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductPortsOnlyComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool PassiveSyncProductPortsOnlyComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductPortsOnlyComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void PassiveSyncProductPortsOnlyComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductPortsOnlyComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + (void) portNum; + (void) id; + (void) buffer; + (void) status; + // No data products defined +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.hpp new file mode 100644 index 000000000..5ffc39e26 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.hpp @@ -0,0 +1,281 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProductPortsOnly component base class +// ====================================================================== + +#ifndef PassiveSyncProductPortsOnlyComponentAc_HPP +#define PassiveSyncProductPortsOnlyComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" + +//! \class PassiveSyncProductPortsOnlyComponentBase +//! \brief Auto-generated base for PassiveSyncProductPortsOnly component +//! +//! A passive component with sync product request and ports only +class PassiveSyncProductPortsOnlyComponentBase : + public Fw::PassiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class PassiveSyncProductPortsOnlyComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize PassiveSyncProductPortsOnlyComponentBase object + void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveSyncProductPortsOnlyComponentBase object + PassiveSyncProductPortsOnlyComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy PassiveSyncProductPortsOnlyComponentBase object + virtual ~PassiveSyncProductPortsOnlyComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp new file mode 100644 index 000000000..c03ad1000 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -0,0 +1,2296 @@ +// ====================================================================== +// \title PassiveSyncProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/PassiveSyncProductsComponentAc.hpp" + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +PassiveSyncProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +PassiveSyncProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const PassiveSyncProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * PassiveSyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const PassiveSyncProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + PassiveSyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* PassiveSyncProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* PassiveSyncProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* PassiveSyncProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveSyncProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveSyncProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* PassiveSyncProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* PassiveSyncProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* PassiveSyncProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* PassiveSyncProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* PassiveSyncProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void PassiveSyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void PassiveSyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void PassiveSyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void PassiveSyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveSyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductsComponentBase :: + PassiveSyncProductsComponentBase(const char* compName) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveSyncProductsComponentBase :: + ~PassiveSyncProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveSyncProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool PassiveSyncProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool PassiveSyncProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool PassiveSyncProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool PassiveSyncProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool PassiveSyncProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 PassiveSyncProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 PassiveSyncProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void PassiveSyncProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void PassiveSyncProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 PassiveSyncProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 PassiveSyncProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void PassiveSyncProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void PassiveSyncProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 PassiveSyncProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void PassiveSyncProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveSyncProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time PassiveSyncProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void PassiveSyncProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void PassiveSyncProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 PassiveSyncProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 PassiveSyncProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void PassiveSyncProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void PassiveSyncProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveSyncProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 PassiveSyncProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void PassiveSyncProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + PassiveSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void PassiveSyncProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void PassiveSyncProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp new file mode 100644 index 000000000..5906da79d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp @@ -0,0 +1,1348 @@ +// ====================================================================== +// \title PassiveSyncProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProducts component base class +// ====================================================================== + +#ifndef PassiveSyncProductsComponentAc_HPP +#define PassiveSyncProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "PassiveSyncProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class PassiveSyncProductsComponentBase +//! \brief Auto-generated base for PassiveSyncProducts component +//! +//! A passive component with sync data products +class PassiveSyncProductsComponentBase : + public Fw::PassiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class PassiveSyncProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const PassiveSyncProducts_Data* array, //!< An array of PassiveSyncProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const PassiveSyncProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize PassiveSyncProductsComponentBase object + void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveSyncProductsComponentBase object + PassiveSyncProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy PassiveSyncProductsComponentBase object + virtual ~PassiveSyncProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp index b2a7d7562..3cc42be14 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp @@ -1274,7 +1274,7 @@ void PassiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1295,7 +1295,7 @@ U32 PassiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1315,7 +1315,7 @@ U32 PassiveTelemetryComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1330,7 +1330,7 @@ void PassiveTelemetryComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -1355,7 +1355,7 @@ void PassiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -1394,7 +1394,7 @@ F32 PassiveTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -1432,7 +1432,7 @@ F32 PassiveTelemetryComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -1465,7 +1465,7 @@ void PassiveTelemetryComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp index 1af0eb151..52bc1654a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.hpp @@ -35,7 +35,7 @@ //! \class PassiveTelemetryComponentBase //! \brief Auto-generated base for PassiveTelemetry component //! -//! An passive component with telemetry +//! A passive component with telemetry class PassiveTelemetryComponentBase : public Fw::PassiveComponentBase { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index a76e505bf..327646509 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -12,6 +12,166 @@ #endif #include "base/PassiveTestComponentAc.hpp" +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +PassiveTestComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +PassiveTestComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const PassiveTest_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * PassiveTest_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_DataRecord(const PassiveTest_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + PassiveTest_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + // ---------------------------------------------------------------------- // Component initialization // ---------------------------------------------------------------------- @@ -48,6 +208,32 @@ void PassiveTestComponentBase :: #endif } + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + // Connect input port noArgsGuarded for ( PlatformIntType port = 0; @@ -361,6 +547,48 @@ void PassiveTestComponentBase :: #endif } + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + #if FW_ENABLE_TEXT_LOGGING == 1 // Connect output port textEventOut for ( @@ -526,6 +754,17 @@ Fw::InputCmdPort* PassiveTestComponentBase :: return &this->m_cmdIn_InputPort[portNum]; } +Fw::InputDpResponsePort* PassiveTestComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + // ---------------------------------------------------------------------- // Getters for typed input ports // ---------------------------------------------------------------------- @@ -692,6 +931,34 @@ void PassiveTestComponentBase :: this->m_prmSetOut_OutputPort[portNum].addCallPort(port); } +void PassiveTestComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void PassiveTestComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + #if FW_ENABLE_TEXT_LOGGING == 1 void PassiveTestComponentBase :: @@ -860,6 +1127,34 @@ void PassiveTestComponentBase :: this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); } +void PassiveTestComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void PassiveTestComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + #if FW_ENABLE_TEXT_LOGGING == 1 void PassiveTestComponentBase :: @@ -1268,6 +1563,12 @@ NATIVE_INT_TYPE PassiveTestComponentBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); } +NATIVE_INT_TYPE PassiveTestComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + // ---------------------------------------------------------------------- // Getters for numbers of typed input ports // ---------------------------------------------------------------------- @@ -1354,6 +1655,18 @@ NATIVE_INT_TYPE PassiveTestComponentBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); } +NATIVE_INT_TYPE PassiveTestComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE PassiveTestComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + #if FW_ENABLE_TEXT_LOGGING == 1 NATIVE_INT_TYPE PassiveTestComponentBase :: @@ -1463,6 +1776,28 @@ bool PassiveTestComponentBase :: return this->m_prmSetOut_OutputPort[portNum].isConnected(); } +bool PassiveTestComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool PassiveTestComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + #if FW_ENABLE_TEXT_LOGGING == 1 bool PassiveTestComponentBase :: @@ -1548,6 +1883,35 @@ bool PassiveTestComponentBase :: return this->m_typedReturnOut_OutputPort[portNum].isConnected(); } +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void PassiveTestComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); +} + // ---------------------------------------------------------------------- // Port handler base-class functions for typed input ports // @@ -1566,7 +1930,7 @@ void PassiveTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1587,7 +1951,7 @@ U32 PassiveTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1607,7 +1971,7 @@ U32 PassiveTestComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1622,7 +1986,7 @@ void PassiveTestComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -1647,7 +2011,7 @@ void PassiveTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -1686,7 +2050,7 @@ F32 PassiveTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -1724,7 +2088,7 @@ F32 PassiveTestComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -1757,7 +2121,7 @@ void PassiveTestComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, @@ -1770,6 +2134,63 @@ void PassiveTestComponentBase :: ); } +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void PassiveTestComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void PassiveTestComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void PassiveTestComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + // ---------------------------------------------------------------------- // Invocation functions for typed output ports // ---------------------------------------------------------------------- @@ -3675,6 +4096,34 @@ S PassiveTestComponentBase :: return _local; } +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void PassiveTestComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + // ---------------------------------------------------------------------- // Time // ---------------------------------------------------------------------- @@ -3962,6 +4411,25 @@ void PassiveTestComponentBase :: } } +void PassiveTestComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + PassiveTestComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + // ---------------------------------------------------------------------- // Calls for messages received on typed input ports // ---------------------------------------------------------------------- @@ -4419,3 +4887,68 @@ Fw::CmdResponse PassiveTestComponentBase :: return Fw::CmdResponse::EXECUTION_ERROR; } + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void PassiveTestComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void PassiveTestComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp index c98194692..e744a7a88 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp @@ -15,6 +15,10 @@ #include "Fw/Cmd/CmdResponsePortAc.hpp" #include "Fw/Cmd/CmdString.hpp" #include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" #include "Fw/Log/LogPortAc.hpp" #include "Fw/Log/LogString.hpp" #if FW_ENABLE_TEXT_LOGGING == 1 @@ -31,6 +35,7 @@ #include "NoArgsPortAc.hpp" #include "NoArgsReturnPortAc.hpp" #include "Os/Mutex.hpp" +#include "PassiveTest_DataSerializableAc.hpp" #include "SSerializableAc.hpp" #include "TypedPortAc.hpp" #include "TypedReturnPortAc.hpp" @@ -59,6 +64,7 @@ class PassiveTestComponentBase : //! Enumerations for numbers of special input ports enum { NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, }; //! Enumerations for numbers of typed input ports @@ -80,6 +86,8 @@ class PassiveTestComponentBase : NUM_EVENTOUT_OUTPUT_PORTS = 1, NUM_PRMGETOUT_OUTPUT_PORTS = 1, NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, NUM_TIMEGETOUT_OUTPUT_PORTS = 1, NUM_TLMOUT_OUTPUT_PORTS = 1, @@ -165,6 +173,108 @@ class PassiveTestComponentBase : PARAMID_PARAMSTRUCT = 0x32, //!< A parameter with struct data and set/save opcodes }; + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const PassiveTest_Data* array, //!< An array of PassiveTest_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const PassiveTest_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + public: // ---------------------------------------------------------------------- @@ -189,6 +299,13 @@ class PassiveTestComponentBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + public: // ---------------------------------------------------------------------- @@ -287,6 +404,18 @@ class PassiveTestComponentBase : Fw::InputPrmSetPort* port //!< The input port ); + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Connect port to textEventOut[portNum] @@ -371,6 +500,18 @@ class PassiveTestComponentBase : Fw::InputSerializePort* port //!< The port ); + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Connect port to textEventOut[portNum] @@ -464,6 +605,11 @@ class PassiveTestComponentBase : //! \return The number of cmdIn input ports NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + PROTECTED: // ---------------------------------------------------------------------- @@ -541,6 +687,16 @@ class PassiveTestComponentBase : //! \return The number of prmSetOut output ports NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get the number of textEventOut output ports @@ -627,6 +783,20 @@ class PassiveTestComponentBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Check whether port textEventOut is connected @@ -686,6 +856,22 @@ class PassiveTestComponentBase : NATIVE_INT_TYPE portNum //!< The port number ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -836,6 +1022,44 @@ class PassiveTestComponentBase : const S& s //!< A struct ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1369,6 +1593,89 @@ class PassiveTestComponentBase : Fw::ParamValid& valid //!< Whether the parameter is valid ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + PROTECTED: // ---------------------------------------------------------------------- @@ -1410,6 +1717,15 @@ class PassiveTestComponentBase : Fw::CmdArgBuffer& args //!< Buffer containing arguments ); + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PRIVATE: // ---------------------------------------------------------------------- @@ -1576,6 +1892,26 @@ class PassiveTestComponentBase : //! \return The command response Fw::CmdResponse paramSave_ParamStruct(); + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + PRIVATE: // ---------------------------------------------------------------------- @@ -1585,6 +1921,9 @@ class PassiveTestComponentBase : //! Input port cmdIn Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + PRIVATE: // ---------------------------------------------------------------------- @@ -1636,6 +1975,12 @@ class PassiveTestComponentBase : //! Output port prmSetOut Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Output port textEventOut diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp new file mode 100644 index 000000000..417e6e1fa --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp @@ -0,0 +1,571 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnlyComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProductPortsOnly component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/QueuedAsyncProductPortsOnlyComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + QUEUEDASYNCPRODUCTPORTSONLY_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + PRODUCTRECVIN_DPRESPONSE, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE productRecvInPortSize[Fw::InputDpResponsePort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::QueuedComponentBase::init(instance); + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputDpResponsePort* QueuedAsyncProductPortsOnlyComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductPortsOnlyComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductPortsOnlyComponentBase :: + QueuedAsyncProductPortsOnlyComponentBase(const char* compName) : + Fw::QueuedComponentBase(compName) +{ + +} + +QueuedAsyncProductPortsOnlyComponentBase :: + ~QueuedAsyncProductPortsOnlyComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductPortsOnlyComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductPortsOnlyComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductPortsOnlyComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool QueuedAsyncProductPortsOnlyComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductPortsOnlyComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + productRecvIn_preMsgHook( + portNum, + id, + buffer, + status + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(PRODUCTRECVIN_DPRESPONSE) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument id + _status = msg.serialize(id); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument buffer + _status = msg.serialize(buffer); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument status + _status = msg.serialize(status); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void QueuedAsyncProductPortsOnlyComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus QueuedAsyncProductPortsOnlyComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_NONBLOCKING + ); + if (Os::Queue::QUEUE_NO_MORE_MSGS == msgStatus) { + return Fw::QueuedComponentBase::MSG_DISPATCH_EMPTY; + } + else { + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + } + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == QUEUEDASYNCPRODUCTPORTSONLY_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port productRecvIn + case PRODUCTRECVIN_DPRESPONSE: { + // Deserialize argument id + FwDpIdType id; + deserStatus = msg.deserialize(id); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument buffer + Fw::Buffer buffer; + deserStatus = msg.deserialize(buffer); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument status + Fw::Success status; + deserStatus = msg.deserialize(status); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductPortsOnlyComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + (void) portNum; + (void) id; + (void) buffer; + (void) status; + // No data products defined +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.hpp new file mode 100644 index 000000000..7a3946d5e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.hpp @@ -0,0 +1,291 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnlyComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProductPortsOnly component base class +// ====================================================================== + +#ifndef QueuedAsyncProductPortsOnlyComponentAc_HPP +#define QueuedAsyncProductPortsOnlyComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" + +//! \class QueuedAsyncProductPortsOnlyComponentBase +//! \brief Auto-generated base for QueuedAsyncProductPortsOnly component +//! +//! An queued component with async product request and ports only +class QueuedAsyncProductPortsOnlyComponentBase : + public Fw::QueuedComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class QueuedAsyncProductPortsOnlyComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize QueuedAsyncProductPortsOnlyComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedAsyncProductPortsOnlyComponentBase object + QueuedAsyncProductPortsOnlyComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy QueuedAsyncProductPortsOnlyComponentBase object + virtual ~QueuedAsyncProductPortsOnlyComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp new file mode 100644 index 000000000..f5c9ce6b0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -0,0 +1,3678 @@ +// ====================================================================== +// \title QueuedAsyncProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/QueuedAsyncProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + QUEUEDASYNCPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + PRODUCTRECVIN_DPRESPONSE, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE productRecvInPortSize[Fw::InputDpResponsePort::SERIALIZED_SIZE]; + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +QueuedAsyncProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +QueuedAsyncProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const QueuedAsyncProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * QueuedAsyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const QueuedAsyncProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + QueuedAsyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* QueuedAsyncProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* QueuedAsyncProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* QueuedAsyncProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedAsyncProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedAsyncProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedAsyncProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedAsyncProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedAsyncProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedAsyncProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedAsyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void QueuedAsyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedAsyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void QueuedAsyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedAsyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductsComponentBase :: + QueuedAsyncProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +QueuedAsyncProductsComponentBase :: + ~QueuedAsyncProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool QueuedAsyncProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool QueuedAsyncProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool QueuedAsyncProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool QueuedAsyncProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool QueuedAsyncProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + productRecvIn_preMsgHook( + portNum, + id, + buffer, + status + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(PRODUCTRECVIN_DPRESPONSE) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument id + _status = msg.serialize(id); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument buffer + _status = msg.serialize(buffer); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument status + _status = msg.serialize(status); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedAsyncProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 QueuedAsyncProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 QueuedAsyncProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void QueuedAsyncProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void QueuedAsyncProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedAsyncProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedAsyncProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedAsyncProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedAsyncProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 QueuedAsyncProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 QueuedAsyncProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void QueuedAsyncProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void QueuedAsyncProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedAsyncProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedAsyncProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedAsyncProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void QueuedAsyncProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 QueuedAsyncProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void QueuedAsyncProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time QueuedAsyncProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void QueuedAsyncProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus QueuedAsyncProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == QUEUEDASYNCPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port productRecvIn + case PRODUCTRECVIN_DPRESPONSE: { + // Deserialize argument id + FwDpIdType id; + deserStatus = msg.deserialize(id); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument buffer + Fw::Buffer buffer; + deserStatus = msg.deserialize(buffer); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument status + Fw::Success status; + deserStatus = msg.deserialize(status); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + break; + } + + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void QueuedAsyncProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void QueuedAsyncProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 QueuedAsyncProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 QueuedAsyncProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void QueuedAsyncProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void QueuedAsyncProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedAsyncProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedAsyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void QueuedAsyncProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp new file mode 100644 index 000000000..2fcb1a61a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp @@ -0,0 +1,1665 @@ +// ====================================================================== +// \title QueuedAsyncProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProducts component base class +// ====================================================================== + +#ifndef QueuedAsyncProductsComponentAc_HPP +#define QueuedAsyncProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "QueuedAsyncProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class QueuedAsyncProductsComponentBase +//! \brief Auto-generated base for QueuedAsyncProducts component +//! +//! A queued component with async data products +class QueuedAsyncProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class QueuedAsyncProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const QueuedAsyncProducts_Data* array, //!< An array of QueuedAsyncProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const QueuedAsyncProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize QueuedAsyncProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedAsyncProductsComponentBase object + QueuedAsyncProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy QueuedAsyncProductsComponentBase object + virtual ~QueuedAsyncProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp index 238683cee..f8591614f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp @@ -1675,7 +1675,7 @@ void QueuedCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1696,7 +1696,7 @@ U32 QueuedCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1716,7 +1716,7 @@ U32 QueuedCommandsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1731,7 +1731,7 @@ void QueuedCommandsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2189,7 +2189,7 @@ void QueuedCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2228,7 +2228,7 @@ F32 QueuedCommandsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2266,7 +2266,7 @@ F32 QueuedCommandsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2299,7 +2299,7 @@ void QueuedCommandsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp index f7602b09a..df3b6fb6e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp @@ -1594,7 +1594,7 @@ void QueuedEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1615,7 +1615,7 @@ U32 QueuedEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1635,7 +1635,7 @@ U32 QueuedEventsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1650,7 +1650,7 @@ void QueuedEventsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2108,7 +2108,7 @@ void QueuedEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2147,7 +2147,7 @@ F32 QueuedEventsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2185,7 +2185,7 @@ F32 QueuedEventsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2218,7 +2218,7 @@ void QueuedEventsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp new file mode 100644 index 000000000..df03b367d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -0,0 +1,3428 @@ +// ====================================================================== +// \title QueuedGetProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/QueuedGetProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + QUEUEDGETPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +QueuedGetProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +QueuedGetProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const QueuedGetProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * QueuedGetProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const QueuedGetProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + QueuedGetProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productGetOut_OutputPorts()); + port++ + ) { + this->m_productGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* QueuedGetProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* QueuedGetProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedGetProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedGetProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedGetProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedGetProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedGetProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedGetProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedGetProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void QueuedGetProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGetProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGetProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGetProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGetProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGetProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedGetProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void QueuedGetProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGetProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGetProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedGetProductsComponentBase :: + QueuedGetProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +QueuedGetProductsComponentBase :: + ~QueuedGetProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_productGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGetProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool QueuedGetProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_productGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool QueuedGetProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool QueuedGetProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool QueuedGetProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGetProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGetProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 QueuedGetProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 QueuedGetProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void QueuedGetProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void QueuedGetProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGetProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGetProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGetProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGetProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 QueuedGetProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 QueuedGetProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void QueuedGetProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void QueuedGetProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedGetProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedGetProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedGetProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +Fw::Success QueuedGetProductsComponentBase :: + productGetOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productGetOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_productGetOut_OutputPort[portNum].invoke( + id, + size, + buffer + ); +} + +void QueuedGetProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 QueuedGetProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void QueuedGetProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGetProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time QueuedGetProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void QueuedGetProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus QueuedGetProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == QUEUEDGETPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void QueuedGetProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 QueuedGetProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 QueuedGetProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void QueuedGetProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void QueuedGetProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGetProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedGetProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedGetProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGetProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +Fw::Success::T QueuedGetProductsComponentBase :: + dpGet( + ContainerId::T containerId, + FwSizeType size, + DpContainer& container + ) +{ + const FwDpIdType baseId = this->getIdBase(); + const FwDpIdType globalId = baseId + containerId; + Fw::Buffer buffer; + const Fw::Success::T status = this->productGetOut_out(0, globalId, size, buffer); + if (status == Fw::Success::SUCCESS) { + container.setId(globalId); + container.setBuffer(buffer); + container.setBaseId(baseId); + } + return status; +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp new file mode 100644 index 000000000..59265c2d7 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp @@ -0,0 +1,1604 @@ +// ====================================================================== +// \title QueuedGetProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGetProducts component base class +// ====================================================================== + +#ifndef QueuedGetProductsComponentAc_HPP +#define QueuedGetProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpGetPortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "QueuedGetProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class QueuedGetProductsComponentBase +//! \brief Auto-generated base for QueuedGetProducts component +//! +//! A queued component with data product get +class QueuedGetProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class QueuedGetProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTGETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const QueuedGetProducts_Data* array, //!< An array of QueuedGetProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const QueuedGetProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize QueuedGetProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productGetOut[portNum] + void set_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpGetPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedGetProductsComponentBase object + QueuedGetProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy QueuedGetProductsComponentBase object + virtual ~QueuedGetProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productGetOut output ports + //! + //! \return The number of productGetOut output ports + NATIVE_INT_TYPE getNum_productGetOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productGetOut is connected + //! + //! \return Whether port productGetOut is connected + bool isConnected_productGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productGetOut + Fw::Success productGetOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Get a buffer and use it to initialize container Container1 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container1( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container1, size, container); + } + + //! Get a buffer and use it to initialize container Container2 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container2( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container2, size, container); + } + + //! Get a buffer and use it to initialize container Container3 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container3( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container3, size, container); + } + + //! Get a buffer and use it to initialize container Container4 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container4( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container4, size, container); + } + + //! Get a buffer and use it to initialize container Container5 + //! \return The status of the buffer request + Fw::Success::T dpGet_Container5( + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ) { + return this->dpGet(ContainerId::Container5, size, container); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Get a buffer and use it to initialize a data product container + //! \return The status of the buffer request + Fw::Success::T dpGet( + ContainerId::T containerId, //!< The component-local container id (input) + FwSizeType size, //!< The buffer size (input) + DpContainer& container //!< The container (output) + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productGetOut + Fw::OutputDpGetPort m_productGetOut_OutputPort[NUM_PRODUCTGETOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp new file mode 100644 index 000000000..499a245f3 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -0,0 +1,3598 @@ +// ====================================================================== +// \title QueuedGuardedProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/QueuedGuardedProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + QUEUEDGUARDEDPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +QueuedGuardedProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +QueuedGuardedProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const QueuedGuardedProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * QueuedGuardedProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const QueuedGuardedProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + QueuedGuardedProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* QueuedGuardedProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* QueuedGuardedProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* QueuedGuardedProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedGuardedProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedGuardedProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedGuardedProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedGuardedProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedGuardedProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedGuardedProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedGuardedProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void QueuedGuardedProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedGuardedProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void QueuedGuardedProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedGuardedProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedGuardedProductsComponentBase :: + QueuedGuardedProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +QueuedGuardedProductsComponentBase :: + ~QueuedGuardedProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool QueuedGuardedProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool QueuedGuardedProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool QueuedGuardedProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool QueuedGuardedProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool QueuedGuardedProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + // Unlock guard mutex + this->unLock(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGuardedProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 QueuedGuardedProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 QueuedGuardedProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void QueuedGuardedProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void QueuedGuardedProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGuardedProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGuardedProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGuardedProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedGuardedProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 QueuedGuardedProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 QueuedGuardedProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void QueuedGuardedProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void QueuedGuardedProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedGuardedProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedGuardedProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedGuardedProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void QueuedGuardedProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 QueuedGuardedProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void QueuedGuardedProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time QueuedGuardedProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void QueuedGuardedProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus QueuedGuardedProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == QUEUEDGUARDEDPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void QueuedGuardedProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void QueuedGuardedProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 QueuedGuardedProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 QueuedGuardedProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void QueuedGuardedProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void QueuedGuardedProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedGuardedProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedGuardedProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void QueuedGuardedProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp new file mode 100644 index 000000000..79382d0bb --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp @@ -0,0 +1,1665 @@ +// ====================================================================== +// \title QueuedGuardedProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGuardedProducts component base class +// ====================================================================== + +#ifndef QueuedGuardedProductsComponentAc_HPP +#define QueuedGuardedProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "QueuedGuardedProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class QueuedGuardedProductsComponentBase +//! \brief Auto-generated base for QueuedGuardedProducts component +//! +//! A queued component with guarded data products +class QueuedGuardedProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class QueuedGuardedProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const QueuedGuardedProducts_Data* array, //!< An array of QueuedGuardedProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const QueuedGuardedProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize QueuedGuardedProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedGuardedProductsComponentBase object + QueuedGuardedProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy QueuedGuardedProductsComponentBase object + virtual ~QueuedGuardedProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp index 8d5e7c72e..b104ca16a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp @@ -1830,7 +1830,7 @@ void QueuedParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1851,7 +1851,7 @@ U32 QueuedParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1871,7 +1871,7 @@ U32 QueuedParamsComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1886,7 +1886,7 @@ void QueuedParamsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2344,7 +2344,7 @@ void QueuedParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2383,7 +2383,7 @@ F32 QueuedParamsComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2421,7 +2421,7 @@ F32 QueuedParamsComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2454,7 +2454,7 @@ void QueuedParamsComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp index 3d1e9050e..dc63d02aa 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp @@ -2290,7 +2290,7 @@ void QueuedSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -2311,7 +2311,7 @@ U32 QueuedSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -2331,7 +2331,7 @@ U32 QueuedSerialComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -2346,7 +2346,7 @@ void QueuedSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2804,7 +2804,7 @@ void QueuedSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2843,7 +2843,7 @@ F32 QueuedSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2881,7 +2881,7 @@ F32 QueuedSerialComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2914,7 +2914,7 @@ void QueuedSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, @@ -3153,7 +3153,7 @@ void QueuedSerialComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->serialGuarded_handler( portNum, buffer @@ -3175,7 +3175,7 @@ void QueuedSerialComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->serialSync_handler( portNum, buffer diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp new file mode 100644 index 000000000..a6b097f80 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -0,0 +1,3592 @@ +// ====================================================================== +// \title QueuedSyncProductsComponentAc.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component base class +// ====================================================================== + +#include + +#include "Fw/Types/Assert.hpp" +#if FW_ENABLE_TEXT_LOGGING +#include "Fw/Types/String.hpp" +#endif +#include "base/QueuedSyncProductsComponentAc.hpp" + +namespace { + enum MsgTypeEnum { + QUEUEDSYNCPRODUCTS_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + NOARGSASYNC_NOARGS, + TYPEDASYNC_TYPED, + TYPEDASYNCASSERT_TYPED, + TYPEDASYNCBLOCKPRIORITY_TYPED, + TYPEDASYNCDROPPRIORITY_TYPED, + }; + + // Get the max size by constructing a union of the async input, command, and + // internal port serialization sizes + union BuffUnion { + BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; + BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncBlockPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE typedAsyncDropPriorityPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; + BYTE cmdPortSize[Fw::InputCmdPort::SERIALIZED_SIZE]; + }; + + // Define a message buffer class large enough to handle all the + // asynchronous inputs to the component + class ComponentIpcSerializableBuffer : + public Fw::SerializeBufferBase + { + + public: + + enum { + // Max. message size = size of data + message id + port + SERIALIZATION_SIZE = + sizeof(BuffUnion) + + sizeof(NATIVE_INT_TYPE) + + sizeof(NATIVE_INT_TYPE) + }; + + NATIVE_UINT_TYPE getBuffCapacity() const { + return sizeof(m_buff); + } + + U8* getBuffAddr() { + return m_buff; + } + + const U8* getBuffAddr() const { + return m_buff; + } + + private: + // Should be the max of all the input ports serialized sizes... + U8 m_buff[SERIALIZATION_SIZE]; + + }; +} + +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +QueuedSyncProductsComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +QueuedSyncProductsComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const QueuedSyncProducts_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * QueuedSyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_DataRecord(const QueuedSyncProducts_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + QueuedSyncProducts_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + init( + NATIVE_INT_TYPE queueDepth, + NATIVE_INT_TYPE instance + ) +{ + // Initialize base class + Fw::ActiveComponentBase::init(instance); + + // Connect input port cmdIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdIn_InputPorts()); + port++ + ) { + this->m_cmdIn_InputPort[port].init(); + this->m_cmdIn_InputPort[port].addCallComp( + this, + m_p_cmdIn_in + ); + this->m_cmdIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsAsync_InputPorts()); + port++ + ) { + this->m_noArgsAsync_InputPort[port].init(); + this->m_noArgsAsync_InputPort[port].addCallComp( + this, + m_p_noArgsAsync_in + ); + this->m_noArgsAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsGuarded_InputPorts()); + port++ + ) { + this->m_noArgsGuarded_InputPort[port].init(); + this->m_noArgsGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsGuarded_in + ); + this->m_noArgsGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnGuarded_InputPorts()); + port++ + ) { + this->m_noArgsReturnGuarded_InputPort[port].init(); + this->m_noArgsReturnGuarded_InputPort[port].addCallComp( + this, + m_p_noArgsReturnGuarded_in + ); + this->m_noArgsReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnSync_InputPorts()); + port++ + ) { + this->m_noArgsReturnSync_InputPort[port].init(); + this->m_noArgsReturnSync_InputPort[port].addCallComp( + this, + m_p_noArgsReturnSync_in + ); + this->m_noArgsReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsSync_InputPorts()); + port++ + ) { + this->m_noArgsSync_InputPort[port].init(); + this->m_noArgsSync_InputPort[port].addCallComp( + this, + m_p_noArgsSync_in + ); + this->m_noArgsSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsync_InputPorts()); + port++ + ) { + this->m_typedAsync_InputPort[port].init(); + this->m_typedAsync_InputPort[port].addCallComp( + this, + m_p_typedAsync_in + ); + this->m_typedAsync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncAssert_InputPorts()); + port++ + ) { + this->m_typedAsyncAssert_InputPort[port].init(); + this->m_typedAsyncAssert_InputPort[port].addCallComp( + this, + m_p_typedAsyncAssert_in + ); + this->m_typedAsyncAssert_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncAssert_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncAssert_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncBlockPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncBlockPriority_InputPort[port].init(); + this->m_typedAsyncBlockPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncBlockPriority_in + ); + this->m_typedAsyncBlockPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncBlockPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncBlockPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedAsyncDropPriority_InputPorts()); + port++ + ) { + this->m_typedAsyncDropPriority_InputPort[port].init(); + this->m_typedAsyncDropPriority_InputPort[port].addCallComp( + this, + m_p_typedAsyncDropPriority_in + ); + this->m_typedAsyncDropPriority_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedAsyncDropPriority_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedAsyncDropPriority_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedGuarded_InputPorts()); + port++ + ) { + this->m_typedGuarded_InputPort[port].init(); + this->m_typedGuarded_InputPort[port].addCallComp( + this, + m_p_typedGuarded_in + ); + this->m_typedGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnGuarded_InputPorts()); + port++ + ) { + this->m_typedReturnGuarded_InputPort[port].init(); + this->m_typedReturnGuarded_InputPort[port].addCallComp( + this, + m_p_typedReturnGuarded_in + ); + this->m_typedReturnGuarded_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnGuarded_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnGuarded_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnSync_InputPorts()); + port++ + ) { + this->m_typedReturnSync_InputPort[port].init(); + this->m_typedReturnSync_InputPort[port].addCallComp( + this, + m_p_typedReturnSync_in + ); + this->m_typedReturnSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect input port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedSync_InputPorts()); + port++ + ) { + this->m_typedSync_InputPort[port].init(); + this->m_typedSync_InputPort[port].addCallComp( + this, + m_p_typedSync_in + ); + this->m_typedSync_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedSync_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedSync_InputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdRegOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdRegOut_OutputPorts()); + port++ + ) { + this->m_cmdRegOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdRegOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port cmdResponseOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_cmdResponseOut_OutputPorts()); + port++ + ) { + this->m_cmdResponseOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_cmdResponseOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port eventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_eventOut_OutputPorts()); + port++ + ) { + this->m_eventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_eventOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmGetOut_OutputPorts()); + port++ + ) { + this->m_prmGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port prmSetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_prmSetOut_OutputPorts()); + port++ + ) { + this->m_prmSetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_prmSetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_prmSetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + +#if FW_ENABLE_TEXT_LOGGING == 1 + // Connect output port textEventOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_textEventOut_OutputPorts()); + port++ + ) { + this->m_textEventOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_textEventOut_OutputPort[port].setObjName(portName); +#endif + } +#endif + + // Connect output port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_timeGetOut_OutputPorts()); + port++ + ) { + this->m_timeGetOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_timeGetOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port tlmOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_tlmOut_OutputPorts()); + port++ + ) { + this->m_tlmOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_tlmOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsOut_OutputPorts()); + port++ + ) { + this->m_noArgsOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_noArgsReturnOut_OutputPorts()); + port++ + ) { + this->m_noArgsReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_noArgsReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_noArgsReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedOut_OutputPorts()); + port++ + ) { + this->m_typedOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_typedReturnOut_OutputPorts()); + port++ + ) { + this->m_typedReturnOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_typedReturnOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_typedReturnOut_OutputPort[port].setObjName(portName); +#endif + } + + Os::Queue::QueueStatus qStat = this->createQueue( + queueDepth, + ComponentIpcSerializableBuffer::SERIALIZATION_SIZE + ); + FW_ASSERT( + Os::Queue::QUEUE_OK == qStat, + static_cast(qStat) + ); +} + +// ---------------------------------------------------------------------- +// Getters for special input ports +// ---------------------------------------------------------------------- + +Fw::InputCmdPort* QueuedSyncProductsComponentBase :: + get_cmdIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_cmdIn_InputPort[portNum]; +} + +Fw::InputDpResponsePort* QueuedSyncProductsComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Getters for typed input ports +// ---------------------------------------------------------------------- + +Ports::InputNoArgsPort* QueuedSyncProductsComponentBase :: + get_noArgsAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsAsync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedSyncProductsComponentBase :: + get_noArgsGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedSyncProductsComponentBase :: + get_noArgsReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnGuarded_InputPort[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedSyncProductsComponentBase :: + get_noArgsReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsReturnSync_InputPort[portNum]; +} + +Ports::InputNoArgsPort* QueuedSyncProductsComponentBase :: + get_noArgsSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_noArgsSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsComponentBase :: + get_typedAsync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsComponentBase :: + get_typedAsyncAssert_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncAssert_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsComponentBase :: + get_typedAsyncBlockPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncBlockPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsComponentBase :: + get_typedAsyncDropPriority_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedAsyncDropPriority_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsComponentBase :: + get_typedGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedSyncProductsComponentBase :: + get_typedReturnGuarded_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnGuarded_InputPort[portNum]; +} + +Ports::InputTypedReturnPort* QueuedSyncProductsComponentBase :: + get_typedReturnSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedReturnSync_InputPort[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsComponentBase :: + get_typedSync_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + return &this->m_typedSync_InputPort[portNum]; +} + +// ---------------------------------------------------------------------- +// Connect input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdRegPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputCmdResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmGetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputPrmSetPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedSyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputLogTextPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].addCallPort(port); +} + +#endif + +void QueuedSyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTimePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputTlmPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Connect typed input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedReturnOut_OutputPort[portNum].addCallPort(port); +} + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to special output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_eventOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +void QueuedSyncProductsComponentBase :: + set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_textEventOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +void QueuedSyncProductsComponentBase :: + set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_tlmOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +#if FW_PORT_SERIALIZATION + +// ---------------------------------------------------------------------- +// Connect serial input ports to typed output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_noArgsOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedSyncProductsComponentBase :: + set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_typedOut_OutputPort[portNum].registerSerialPort(port); +} + +#endif + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedSyncProductsComponentBase :: + QueuedSyncProductsComponentBase(const char* compName) : + Fw::ActiveComponentBase(compName) +{ + +} + +QueuedSyncProductsComponentBase :: + ~QueuedSyncProductsComponentBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_cmdIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed input ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedAsync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsync_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedAsyncAssert_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncAssert_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedAsyncBlockPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncBlockPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedAsyncDropPriority_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedAsyncDropPriority_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedReturnGuarded_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnGuarded_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedReturnSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnSync_InputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedSync_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedSync_InputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of special output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_cmdRegOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_cmdResponseOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_eventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_prmGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_prmSetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_textEventOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort)); +} + +#endif + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_timeGetOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_tlmOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Getters for numbers of typed output ports +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_noArgsReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedSyncProductsComponentBase :: + getNum_typedReturnOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_typedReturnOut_OutputPort)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for special output ports +// ---------------------------------------------------------------------- + +bool QueuedSyncProductsComponentBase :: + isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdRegOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdRegOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_cmdResponseOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_cmdResponseOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_eventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_eventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_eventOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_prmGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_prmSetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_prmSetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_prmSetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +bool QueuedSyncProductsComponentBase :: + isConnected_textEventOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_textEventOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_textEventOut_OutputPort[portNum].isConnected(); +} + +#endif + +bool QueuedSyncProductsComponentBase :: + isConnected_timeGetOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_timeGetOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_timeGetOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_tlmOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_tlmOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Connection status queries for typed output ports +// ---------------------------------------------------------------------- + +bool QueuedSyncProductsComponentBase :: + isConnected_noArgsOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_noArgsReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_noArgsReturnOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_typedOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedOut_OutputPort[portNum].isConnected(); +} + +bool QueuedSyncProductsComponentBase :: + isConnected_typedReturnOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_typedReturnOut_OutputPort[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Port handler base-class functions for typed input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + noArgsAsync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + noArgsAsync_preMsgHook(portNum); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(NOARGSASYNC_NOARGS) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedSyncProductsComponentBase :: + noArgsGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->noArgsGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); +} + +U32 QueuedSyncProductsComponentBase :: + noArgsReturnGuarded_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->noArgsReturnGuarded_handler(portNum); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +U32 QueuedSyncProductsComponentBase :: + noArgsReturnSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsReturnSync_InputPorts(), + static_cast(portNum) + ); + + U32 retVal; + + // Call handler function + retVal = this->noArgsReturnSync_handler(portNum); + + return retVal; +} + +void QueuedSyncProductsComponentBase :: + noArgsSync_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_noArgsSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->noArgsSync_handler(portNum); +} + +void QueuedSyncProductsComponentBase :: + typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsync_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsync_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNC_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedSyncProductsComponentBase :: + typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncAssert_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncAssert_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCASSERT_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedSyncProductsComponentBase :: + typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncBlockPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncBlockPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCBLOCKPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedSyncProductsComponentBase :: + typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedAsyncDropPriority_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + typedAsyncDropPriority_preMsgHook( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(TYPEDASYNCDROPPRIORITY_TYPED) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument u32 + _status = msg.serialize(u32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument f32 + _status = msg.serialize(f32); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument b + _status = msg.serialize(b); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument str1 + _status = msg.serialize(str1); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument e + _status = msg.serialize(e); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument a + _status = msg.serialize(a); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument s + _status = msg.serialize(s); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block); + + if (qStatus == Os::Queue::QUEUE_FULL) { + this->incNumMsgDropped(); + return; + } + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + +void QueuedSyncProductsComponentBase :: + typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedGuarded_InputPorts(), + static_cast(portNum) + ); + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + this->typedGuarded_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); +} + +F32 QueuedSyncProductsComponentBase :: + typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnGuarded_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Lock guard mutex before calling + this->lock(); + + // Call handler function + retVal = this->typedReturnGuarded_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + // Unlock guard mutex + this->unLock(); + + return retVal; +} + +F32 QueuedSyncProductsComponentBase :: + typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedReturnSync_InputPorts(), + static_cast(portNum) + ); + + F32 retVal; + + // Call handler function + retVal = this->typedReturnSync_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); + + return retVal; +} + +void QueuedSyncProductsComponentBase :: + typedSync_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_typedSync_InputPorts(), + static_cast(portNum) + ); + + // Call handler function + this->typedSync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Pre-message hooks for typed async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + noArgsAsync_preMsgHook(NATIVE_INT_TYPE portNum) +{ + // Default: no-op +} + +void QueuedSyncProductsComponentBase :: + typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedSyncProductsComponentBase :: + typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedSyncProductsComponentBase :: + typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +void QueuedSyncProductsComponentBase :: + typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Default: no-op +} + +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void QueuedSyncProductsComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for typed output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + noArgsOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsOut_OutputPorts(), + static_cast(portNum) + ); + this->m_noArgsOut_OutputPort[portNum].invoke(); +} + +U32 QueuedSyncProductsComponentBase :: + noArgsReturnOut_out(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_noArgsReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_noArgsReturnOut_OutputPort[portNum].invoke(); +} + +void QueuedSyncProductsComponentBase :: + typedOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedOut_OutputPorts(), + static_cast(portNum) + ); + this->m_typedOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedSyncProductsComponentBase :: + typedReturnOut_out( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT( + portNum < this->getNum_typedReturnOut_OutputPorts(), + static_cast(portNum) + ); + return this->m_typedReturnOut_OutputPort[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + +// ---------------------------------------------------------------------- +// Time +// ---------------------------------------------------------------------- + +Fw::Time QueuedSyncProductsComponentBase :: + getTime() +{ + if (this->m_timeGetOut_OutputPort[0].isConnected()) { + Fw::Time _time; + this->m_timeGetOut_OutputPort[0].invoke(_time); + return _time; + } + else { + return Fw::Time(TB_NONE, 0, 0); + } +} + +// ---------------------------------------------------------------------- +// Mutex operations for guarded ports +// +// You can override these operations to provide more sophisticated +// synchronization +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + lock() +{ + this->m_guardedPortMutex.lock(); +} + +void QueuedSyncProductsComponentBase :: + unLock() +{ + this->m_guardedPortMutex.unLock(); +} + +// ---------------------------------------------------------------------- +// Message dispatch functions +// ---------------------------------------------------------------------- + +Fw::QueuedComponentBase::MsgDispatchStatus QueuedSyncProductsComponentBase :: + doDispatch() +{ + ComponentIpcSerializableBuffer msg; + NATIVE_INT_TYPE priority = 0; + + Os::Queue::QueueStatus msgStatus = this->m_queue.receive( + msg, + priority, + Os::Queue::QUEUE_BLOCKING + ); + FW_ASSERT( + msgStatus == Os::Queue::QUEUE_OK, + static_cast(msgStatus) + ); + + // Reset to beginning of buffer + msg.resetDeser(); + + NATIVE_INT_TYPE desMsg = 0; + Fw::SerializeStatus deserStatus = msg.deserialize(desMsg); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + MsgTypeEnum msgType = static_cast(desMsg); + + if (msgType == QUEUEDSYNCPRODUCTS_COMPONENT_EXIT) { + return MSG_DISPATCH_EXIT; + } + + NATIVE_INT_TYPE portNum = 0; + deserStatus = msg.deserialize(portNum); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + switch (msgType) { + // Handle async input port noArgsAsync + case NOARGSASYNC_NOARGS: { + // Call handler function + this->noArgsAsync_handler(portNum); + + break; + } + + // Handle async input port typedAsync + case TYPEDASYNC_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsync_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncAssert + case TYPEDASYNCASSERT_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncAssert_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncBlockPriority + case TYPEDASYNCBLOCKPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncBlockPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + // Handle async input port typedAsyncDropPriority + case TYPEDASYNCDROPPRIORITY_TYPED: { + // Deserialize argument u32 + U32 u32; + deserStatus = msg.deserialize(u32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument f32 + F32 f32; + deserStatus = msg.deserialize(f32); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument b + bool b; + deserStatus = msg.deserialize(b); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument str1 + Ports::TypedPortStrings::StringSize80 str1; + deserStatus = msg.deserialize(str1); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument e + E e; + deserStatus = msg.deserialize(e); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument a + A a; + deserStatus = msg.deserialize(a); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument s + S s; + deserStatus = msg.deserialize(s); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->typedAsyncDropPriority_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); + + break; + } + + default: + return MSG_DISPATCH_ERROR; + } + + return MSG_DISPATCH_OK; +} + +// ---------------------------------------------------------------------- +// Calls for messages received on special input ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwOpcodeType opCode, + U32 cmdSeq, + Fw::CmdArgBuffer& args + ) +{ + FW_ASSERT(callComp); + + const U32 idBase = callComp->getIdBase(); + FW_ASSERT(opCode >= idBase, opCode, idBase); +} + +void QueuedSyncProductsComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + +// ---------------------------------------------------------------------- +// Calls for messages received on typed input ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsAsync_handlerBase(portNum); +} + +void QueuedSyncProductsComponentBase :: + m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsGuarded_handlerBase(portNum); +} + +U32 QueuedSyncProductsComponentBase :: + m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnGuarded_handlerBase(portNum); +} + +U32 QueuedSyncProductsComponentBase :: + m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->noArgsReturnSync_handlerBase(portNum); +} + +void QueuedSyncProductsComponentBase :: + m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->noArgsSync_handlerBase(portNum); +} + +void QueuedSyncProductsComponentBase :: + m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsComponentBase :: + m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncAssert_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsComponentBase :: + m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncBlockPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsComponentBase :: + m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedAsyncDropPriority_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsComponentBase :: + m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedGuarded_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedSyncProductsComponentBase :: + m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnGuarded_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedSyncProductsComponentBase :: + m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + return compPtr->typedReturnSync_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedSyncProductsComponentBase :: + m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp); + QueuedSyncProductsComponentBase* compPtr = static_cast(callComp); + compPtr->typedSync_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void QueuedSyncProductsComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void QueuedSyncProductsComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp new file mode 100644 index 000000000..c66973280 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp @@ -0,0 +1,1665 @@ +// ====================================================================== +// \title QueuedSyncProductsComponentAc.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedSyncProducts component base class +// ====================================================================== + +#ifndef QueuedSyncProductsComponentAc_HPP +#define QueuedSyncProductsComponentAc_HPP + +#include "FpConfig.hpp" +#include "Fw/Cmd/CmdPortAc.hpp" +#include "Fw/Cmd/CmdRegPortAc.hpp" +#include "Fw/Cmd/CmdResponsePortAc.hpp" +#include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" +#include "Fw/Log/LogPortAc.hpp" +#if FW_ENABLE_TEXT_LOGGING == 1 +#include "Fw/Log/LogTextPortAc.hpp" +#endif +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Port/OutputSerializePort.hpp" +#include "Fw/Prm/PrmGetPortAc.hpp" +#include "Fw/Prm/PrmSetPortAc.hpp" +#include "Fw/Time/TimePortAc.hpp" +#include "Fw/Tlm/TlmPortAc.hpp" +#include "NoArgsPortAc.hpp" +#include "NoArgsReturnPortAc.hpp" +#include "Os/Mutex.hpp" +#include "QueuedSyncProducts_DataSerializableAc.hpp" +#include "TypedPortAc.hpp" +#include "TypedReturnPortAc.hpp" + +//! \class QueuedSyncProductsComponentBase +//! \brief Auto-generated base for QueuedSyncProducts component +//! +//! A queued component with sync data products +class QueuedSyncProductsComponentBase : + public Fw::ActiveComponentBase +{ + + // ---------------------------------------------------------------------- + // Friend classes + // ---------------------------------------------------------------------- + + //! Friend class for white-box testing + friend class QueuedSyncProductsComponentBaseFriend; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + //! Enumerations for numbers of special input ports + enum { + NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed input ports + enum { + NUM_NOARGSASYNC_INPUT_PORTS = 1, + NUM_NOARGSGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNGUARDED_INPUT_PORTS = 1, + NUM_NOARGSRETURNSYNC_INPUT_PORTS = 3, + NUM_NOARGSSYNC_INPUT_PORTS = 3, + NUM_TYPEDASYNC_INPUT_PORTS = 1, + NUM_TYPEDASYNCASSERT_INPUT_PORTS = 1, + NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS = 1, + NUM_TYPEDGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNGUARDED_INPUT_PORTS = 1, + NUM_TYPEDRETURNSYNC_INPUT_PORTS = 3, + NUM_TYPEDSYNC_INPUT_PORTS = 3, + }; + + //! Enumerations for numbers of special output ports + enum { + NUM_CMDREGOUT_OUTPUT_PORTS = 1, + NUM_CMDRESPONSEOUT_OUTPUT_PORTS = 1, + NUM_EVENTOUT_OUTPUT_PORTS = 1, + NUM_PRMGETOUT_OUTPUT_PORTS = 1, + NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, + NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, + NUM_TIMEGETOUT_OUTPUT_PORTS = 1, + NUM_TLMOUT_OUTPUT_PORTS = 1, + }; + + //! Enumerations for numbers of typed output ports + enum { + NUM_NOARGSOUT_OUTPUT_PORTS = 1, + NUM_NOARGSRETURNOUT_OUTPUT_PORTS = 1, + NUM_TYPEDOUT_OUTPUT_PORTS = 1, + NUM_TYPEDRETURNOUT_OUTPUT_PORTS = 1, + }; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const QueuedSyncProducts_Data* array, //!< An array of QueuedSyncProducts_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const QueuedSyncProducts_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize QueuedSyncProductsComponentBase object + void init( + NATIVE_INT_TYPE queueDepth, //!< The queue depth + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for special input ports + // ---------------------------------------------------------------------- + + //! Get special input port at index + //! + //! \return cmdIn[portNum] + Fw::InputCmdPort* get_cmdIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for typed input ports + // ---------------------------------------------------------------------- + + //! Get typed input port at index + //! + //! \return noArgsAsync[portNum] + Ports::InputNoArgsPort* get_noArgsAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsGuarded[portNum] + Ports::InputNoArgsPort* get_noArgsGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnGuarded[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsReturnSync[portNum] + Ports::InputNoArgsReturnPort* get_noArgsReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return noArgsSync[portNum] + Ports::InputNoArgsPort* get_noArgsSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsync[portNum] + Ports::InputTypedPort* get_typedAsync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncAssert[portNum] + Ports::InputTypedPort* get_typedAsyncAssert_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncBlockPriority[portNum] + Ports::InputTypedPort* get_typedAsyncBlockPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedAsyncDropPriority[portNum] + Ports::InputTypedPort* get_typedAsyncDropPriority_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedGuarded[portNum] + Ports::InputTypedPort* get_typedGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnGuarded[portNum] + Ports::InputTypedReturnPort* get_typedReturnGuarded_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedReturnSync[portNum] + Ports::InputTypedReturnPort* get_typedReturnSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get typed input port at index + //! + //! \return typedSync[portNum] + Ports::InputTypedPort* get_typedSync_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + public: + + // ---------------------------------------------------------------------- + // Connect input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdRegPort* port //!< The input port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdResponsePort* port //!< The input port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogPort* port //!< The input port + ); + + //! Connect port to prmGetOut[portNum] + void set_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmGetPort* port //!< The input port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputPrmSetPort* port //!< The input port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputLogTextPort* port //!< The input port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTimePort* port //!< The input port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputTlmPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Connect typed input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnOut[portNum] + void set_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnOut[portNum] + void set_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to special output ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdRegOut[portNum] + void set_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to cmdResponseOut[portNum] + void set_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to eventOut[portNum] + void set_eventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to prmSetOut[portNum] + void set_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Connect port to textEventOut[portNum] + void set_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + //! Connect port to timeGetOut[portNum] + void set_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to tlmOut[portNum] + void set_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + +#if FW_PORT_SERIALIZATION + + public: + + // ---------------------------------------------------------------------- + // Connect serial input ports to typed output ports + // ---------------------------------------------------------------------- + + //! Connect port to noArgsOut[portNum] + void set_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to typedOut[portNum] + void set_typedOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + +#endif + + PROTECTED: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedSyncProductsComponentBase object + QueuedSyncProductsComponentBase( + const char* compName = "" //!< The component name + ); + + //! Destroy QueuedSyncProductsComponentBase object + virtual ~QueuedSyncProductsComponentBase(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special input ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdIn input ports + //! + //! \return The number of cmdIn input ports + NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed input ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsAsync input ports + //! + //! \return The number of noArgsAsync input ports + NATIVE_INT_TYPE getNum_noArgsAsync_InputPorts() const; + + //! Get the number of noArgsGuarded input ports + //! + //! \return The number of noArgsGuarded input ports + NATIVE_INT_TYPE getNum_noArgsGuarded_InputPorts() const; + + //! Get the number of noArgsReturnGuarded input ports + //! + //! \return The number of noArgsReturnGuarded input ports + NATIVE_INT_TYPE getNum_noArgsReturnGuarded_InputPorts() const; + + //! Get the number of noArgsReturnSync input ports + //! + //! \return The number of noArgsReturnSync input ports + NATIVE_INT_TYPE getNum_noArgsReturnSync_InputPorts() const; + + //! Get the number of noArgsSync input ports + //! + //! \return The number of noArgsSync input ports + NATIVE_INT_TYPE getNum_noArgsSync_InputPorts() const; + + //! Get the number of typedAsync input ports + //! + //! \return The number of typedAsync input ports + NATIVE_INT_TYPE getNum_typedAsync_InputPorts() const; + + //! Get the number of typedAsyncAssert input ports + //! + //! \return The number of typedAsyncAssert input ports + NATIVE_INT_TYPE getNum_typedAsyncAssert_InputPorts() const; + + //! Get the number of typedAsyncBlockPriority input ports + //! + //! \return The number of typedAsyncBlockPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncBlockPriority_InputPorts() const; + + //! Get the number of typedAsyncDropPriority input ports + //! + //! \return The number of typedAsyncDropPriority input ports + NATIVE_INT_TYPE getNum_typedAsyncDropPriority_InputPorts() const; + + //! Get the number of typedGuarded input ports + //! + //! \return The number of typedGuarded input ports + NATIVE_INT_TYPE getNum_typedGuarded_InputPorts() const; + + //! Get the number of typedReturnGuarded input ports + //! + //! \return The number of typedReturnGuarded input ports + NATIVE_INT_TYPE getNum_typedReturnGuarded_InputPorts() const; + + //! Get the number of typedReturnSync input ports + //! + //! \return The number of typedReturnSync input ports + NATIVE_INT_TYPE getNum_typedReturnSync_InputPorts() const; + + //! Get the number of typedSync input ports + //! + //! \return The number of typedSync input ports + NATIVE_INT_TYPE getNum_typedSync_InputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of special output ports + // ---------------------------------------------------------------------- + + //! Get the number of cmdRegOut output ports + //! + //! \return The number of cmdRegOut output ports + NATIVE_INT_TYPE getNum_cmdRegOut_OutputPorts() const; + + //! Get the number of cmdResponseOut output ports + //! + //! \return The number of cmdResponseOut output ports + NATIVE_INT_TYPE getNum_cmdResponseOut_OutputPorts() const; + + //! Get the number of eventOut output ports + //! + //! \return The number of eventOut output ports + NATIVE_INT_TYPE getNum_eventOut_OutputPorts() const; + + //! Get the number of prmGetOut output ports + //! + //! \return The number of prmGetOut output ports + NATIVE_INT_TYPE getNum_prmGetOut_OutputPorts() const; + + //! Get the number of prmSetOut output ports + //! + //! \return The number of prmSetOut output ports + NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of textEventOut output ports + //! + //! \return The number of textEventOut output ports + NATIVE_INT_TYPE getNum_textEventOut_OutputPorts() const; + +#endif + + //! Get the number of timeGetOut output ports + //! + //! \return The number of timeGetOut output ports + NATIVE_INT_TYPE getNum_timeGetOut_OutputPorts() const; + + //! Get the number of tlmOut output ports + //! + //! \return The number of tlmOut output ports + NATIVE_INT_TYPE getNum_tlmOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Getters for numbers of typed output ports + // ---------------------------------------------------------------------- + + //! Get the number of noArgsOut output ports + //! + //! \return The number of noArgsOut output ports + NATIVE_INT_TYPE getNum_noArgsOut_OutputPorts() const; + + //! Get the number of noArgsReturnOut output ports + //! + //! \return The number of noArgsReturnOut output ports + NATIVE_INT_TYPE getNum_noArgsReturnOut_OutputPorts() const; + + //! Get the number of typedOut output ports + //! + //! \return The number of typedOut output ports + NATIVE_INT_TYPE getNum_typedOut_OutputPorts() const; + + //! Get the number of typedReturnOut output ports + //! + //! \return The number of typedReturnOut output ports + NATIVE_INT_TYPE getNum_typedReturnOut_OutputPorts() const; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for special output ports + // ---------------------------------------------------------------------- + + //! Check whether port cmdRegOut is connected + //! + //! \return Whether port cmdRegOut is connected + bool isConnected_cmdRegOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port cmdResponseOut is connected + //! + //! \return Whether port cmdResponseOut is connected + bool isConnected_cmdResponseOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port eventOut is connected + //! + //! \return Whether port eventOut is connected + bool isConnected_eventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmGetOut is connected + //! + //! \return Whether port prmGetOut is connected + bool isConnected_prmGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port prmSetOut is connected + //! + //! \return Whether port prmSetOut is connected + bool isConnected_prmSetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Check whether port textEventOut is connected + //! + //! \return Whether port textEventOut is connected + bool isConnected_textEventOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Check whether port timeGetOut is connected + //! + //! \return Whether port timeGetOut is connected + bool isConnected_timeGetOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port tlmOut is connected + //! + //! \return Whether port tlmOut is connected + bool isConnected_tlmOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Connection status queries for typed output ports + // ---------------------------------------------------------------------- + + //! Check whether port noArgsOut is connected + //! + //! \return Whether port noArgsOut is connected + bool isConnected_noArgsOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port noArgsReturnOut is connected + //! + //! \return Whether port noArgsReturnOut is connected + bool isConnected_noArgsReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedOut is connected + //! + //! \return Whether port typedOut is connected + bool isConnected_typedOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port typedReturnOut is connected + //! + //! \return Whether port typedReturnOut is connected + bool isConnected_typedReturnOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for typed input ports + // ---------------------------------------------------------------------- + + //! Handler for input port noArgsAsync + virtual void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsGuarded + virtual void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnGuarded + virtual U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsReturnSync + virtual U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port noArgsSync + virtual void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port typedAsync + virtual void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncAssert + virtual void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedGuarded + virtual void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnGuarded + virtual F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedReturnSync + virtual F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port typedSync + virtual void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for typed input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port noArgsAsync + void noArgsAsync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsGuarded + void noArgsGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnGuarded + U32 noArgsReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsReturnSync + U32 noArgsReturnSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port noArgsSync + void noArgsSync_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for input port typedAsync + void typedAsync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncAssert + void typedAsyncAssert_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncBlockPriority + void typedAsyncBlockPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedAsyncDropPriority + void typedAsyncDropPriority_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedGuarded + void typedGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnGuarded + F32 typedReturnGuarded_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedReturnSync + F32 typedReturnSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for input port typedSync + void typedSync_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for typed async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port noArgsAsync + virtual void noArgsAsync_preMsgHook( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Pre-message hook for async input port typedAsync + virtual void typedAsync_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncAssert + virtual void typedAsyncAssert_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncBlockPriority + virtual void typedAsyncBlockPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Pre-message hook for async input port typedAsyncDropPriority + virtual void typedAsyncDropPriority_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for typed output ports + // ---------------------------------------------------------------------- + + //! Invoke output port noArgsOut + void noArgsOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port noArgsReturnOut + U32 noArgsReturnOut_out( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke output port typedOut + void typedOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke output port typedReturnOut + F32 typedReturnOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + PROTECTED: + + // ---------------------------------------------------------------------- + // Time + // ---------------------------------------------------------------------- + + //! Get the time + //! + //! \\return The current time + Fw::Time getTime(); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Mutex operations for guarded ports + // + // You can override these operations to provide more sophisticated + // synchronization + // ---------------------------------------------------------------------- + + //! Lock the guarded mutex + virtual void lock(); + + //! Unlock the guarded mutex + virtual void unLock(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Message dispatch functions + // ---------------------------------------------------------------------- + + //! Called in the message loop to dispatch a message from the queue + virtual MsgDispatchStatus doDispatch(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on special input ports + // ---------------------------------------------------------------------- + + //! Callback for port cmdIn + static void m_p_cmdIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwOpcodeType opCode, //!< Command Op Code + U32 cmdSeq, //!< Command Sequence + Fw::CmdArgBuffer& args //!< Buffer containing arguments + ); + + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Calls for messages received on typed input ports + // ---------------------------------------------------------------------- + + //! Callback for port noArgsAsync + static void m_p_noArgsAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsGuarded + static void m_p_noArgsGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnGuarded + static U32 m_p_noArgsReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsReturnSync + static U32 m_p_noArgsReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port noArgsSync + static void m_p_noArgsSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Callback for port typedAsync + static void m_p_typedAsync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncAssert + static void m_p_typedAsyncAssert_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncBlockPriority + static void m_p_typedAsyncBlockPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedAsyncDropPriority + static void m_p_typedAsyncDropPriority_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedGuarded + static void m_p_typedGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnGuarded + static F32 m_p_typedReturnGuarded_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedReturnSync + static F32 m_p_typedReturnSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Callback for port typedSync + static void m_p_typedSync_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special input ports + // ---------------------------------------------------------------------- + + //! Input port cmdIn + Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed input ports + // ---------------------------------------------------------------------- + + //! Input port noArgsAsync + Ports::InputNoArgsPort m_noArgsAsync_InputPort[NUM_NOARGSASYNC_INPUT_PORTS]; + + //! Input port noArgsGuarded + Ports::InputNoArgsPort m_noArgsGuarded_InputPort[NUM_NOARGSGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnGuarded + Ports::InputNoArgsReturnPort m_noArgsReturnGuarded_InputPort[NUM_NOARGSRETURNGUARDED_INPUT_PORTS]; + + //! Input port noArgsReturnSync + Ports::InputNoArgsReturnPort m_noArgsReturnSync_InputPort[NUM_NOARGSRETURNSYNC_INPUT_PORTS]; + + //! Input port noArgsSync + Ports::InputNoArgsPort m_noArgsSync_InputPort[NUM_NOARGSSYNC_INPUT_PORTS]; + + //! Input port typedAsync + Ports::InputTypedPort m_typedAsync_InputPort[NUM_TYPEDASYNC_INPUT_PORTS]; + + //! Input port typedAsyncAssert + Ports::InputTypedPort m_typedAsyncAssert_InputPort[NUM_TYPEDASYNCASSERT_INPUT_PORTS]; + + //! Input port typedAsyncBlockPriority + Ports::InputTypedPort m_typedAsyncBlockPriority_InputPort[NUM_TYPEDASYNCBLOCKPRIORITY_INPUT_PORTS]; + + //! Input port typedAsyncDropPriority + Ports::InputTypedPort m_typedAsyncDropPriority_InputPort[NUM_TYPEDASYNCDROPPRIORITY_INPUT_PORTS]; + + //! Input port typedGuarded + Ports::InputTypedPort m_typedGuarded_InputPort[NUM_TYPEDGUARDED_INPUT_PORTS]; + + //! Input port typedReturnGuarded + Ports::InputTypedReturnPort m_typedReturnGuarded_InputPort[NUM_TYPEDRETURNGUARDED_INPUT_PORTS]; + + //! Input port typedReturnSync + Ports::InputTypedReturnPort m_typedReturnSync_InputPort[NUM_TYPEDRETURNSYNC_INPUT_PORTS]; + + //! Input port typedSync + Ports::InputTypedPort m_typedSync_InputPort[NUM_TYPEDSYNC_INPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Special output ports + // ---------------------------------------------------------------------- + + //! Output port cmdRegOut + Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS]; + + //! Output port cmdResponseOut + Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS]; + + //! Output port eventOut + Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS]; + + //! Output port prmGetOut + Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS]; + + //! Output port prmSetOut + Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Output port textEventOut + Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS]; + +#endif + + //! Output port timeGetOut + Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS]; + + //! Output port tlmOut + Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Typed output ports + // ---------------------------------------------------------------------- + + //! Output port noArgsOut + Ports::OutputNoArgsPort m_noArgsOut_OutputPort[NUM_NOARGSOUT_OUTPUT_PORTS]; + + //! Output port noArgsReturnOut + Ports::OutputNoArgsReturnPort m_noArgsReturnOut_OutputPort[NUM_NOARGSRETURNOUT_OUTPUT_PORTS]; + + //! Output port typedOut + Ports::OutputTypedPort m_typedOut_OutputPort[NUM_TYPEDOUT_OUTPUT_PORTS]; + + //! Output port typedReturnOut + Ports::OutputTypedReturnPort m_typedReturnOut_OutputPort[NUM_TYPEDRETURNOUT_OUTPUT_PORTS]; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Mutexes + // ---------------------------------------------------------------------- + + //! Mutex for guarded ports + Os::Mutex m_guardedPortMutex; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp index 75b054559..15b56a28e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp @@ -1597,7 +1597,7 @@ void QueuedTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1618,7 +1618,7 @@ U32 QueuedTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1638,7 +1638,7 @@ U32 QueuedTelemetryComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -1653,7 +1653,7 @@ void QueuedTelemetryComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2111,7 +2111,7 @@ void QueuedTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2150,7 +2150,7 @@ F32 QueuedTelemetryComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2188,7 +2188,7 @@ F32 QueuedTelemetryComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2221,7 +2221,7 @@ void QueuedTelemetryComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 0f3b87ab2..c0508a414 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -15,6 +15,7 @@ namespace { enum MsgTypeEnum { QUEUEDTEST_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT, + PRODUCTRECVIN_DPRESPONSE, NOARGSASYNC_NOARGS, TYPEDASYNC_TYPED, TYPEDASYNCASSERT_TYPED, @@ -36,6 +37,7 @@ namespace { // Get the max size by constructing a union of the async input, command, and // internal port serialization sizes union BuffUnion { + BYTE productRecvInPortSize[Fw::InputDpResponsePort::SERIALIZED_SIZE]; BYTE noArgsAsyncPortSize[Ports::InputNoArgsPort::SERIALIZED_SIZE]; BYTE typedAsyncPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; BYTE typedAsyncAssertPortSize[Ports::InputTypedPort::SERIALIZED_SIZE]; @@ -104,6 +106,166 @@ namespace { }; } +// ---------------------------------------------------------------------- +// Types for data products +// ---------------------------------------------------------------------- + +QueuedTestComponentBase::DpContainer :: + DpContainer( + FwDpIdType id, + const Fw::Buffer& buffer, + FwDpIdType baseId + ) : + Fw::DpContainer(id, buffer), + baseId(baseId) +{ + +} + +QueuedTestComponentBase::DpContainer :: + DpContainer() : + Fw::DpContainer(), + baseId(0) +{ + +} + +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_DataArrayRecord( + const QueuedTest_Data* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * QueuedTest_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_DataRecord(const QueuedTest_Data& elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + QueuedTest_Data::SERIALIZED_SIZE; + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::DataRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_U32ArrayRecord( + const U32* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + status = serializeRepr.serialize(array[i]); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_U32Record(U32 elt) +{ + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(U32); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U32Record; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(elt); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_U8ArrayRecord( + const U8* array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + Fw::SerializeBufferBase& serializeRepr = this->buffer.getSerializeRepr(); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeType) + + size * sizeof(U8); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (serializeRepr.getBuffLength() + sizeDelta <= serializeRepr.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; + status = serializeRepr.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = serializeRepr.serialize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + const bool omitSerializedLength = true; + status = serializeRepr.serialize(array, size, omitSerializedLength); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + // ---------------------------------------------------------------------- // Component initialization // ---------------------------------------------------------------------- @@ -143,6 +305,32 @@ void QueuedTestComponentBase :: #endif } + // Connect input port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRecvIn_InputPorts()); + port++ + ) { + this->m_productRecvIn_InputPort[port].init(); + this->m_productRecvIn_InputPort[port].addCallComp( + this, + m_p_productRecvIn_in + ); + this->m_productRecvIn_InputPort[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRecvIn_InputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRecvIn_InputPort[port].setObjName(portName); +#endif + } + // Connect input port noArgsAsync for ( PlatformIntType port = 0; @@ -586,6 +774,48 @@ void QueuedTestComponentBase :: #endif } + // Connect output port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productRequestOut_OutputPorts()); + port++ + ) { + this->m_productRequestOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productRequestOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productRequestOut_OutputPort[port].setObjName(portName); +#endif + } + + // Connect output port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_productSendOut_OutputPorts()); + port++ + ) { + this->m_productSendOut_OutputPort[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_productSendOut_OutputPort[port].setObjName(portName); +#endif + } + #if FW_ENABLE_TEXT_LOGGING == 1 // Connect output port textEventOut for ( @@ -760,6 +990,17 @@ Fw::InputCmdPort* QueuedTestComponentBase :: return &this->m_cmdIn_InputPort[portNum]; } +Fw::InputDpResponsePort* QueuedTestComponentBase :: + get_productRecvIn_InputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + return &this->m_productRecvIn_InputPort[portNum]; +} + // ---------------------------------------------------------------------- // Getters for typed input ports // ---------------------------------------------------------------------- @@ -981,6 +1222,34 @@ void QueuedTestComponentBase :: this->m_prmSetOut_OutputPort[portNum].addCallPort(port); } +void QueuedTestComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpRequestPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].addCallPort(port); +} + +void QueuedTestComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputDpSendPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].addCallPort(port); +} + #if FW_ENABLE_TEXT_LOGGING == 1 void QueuedTestComponentBase :: @@ -1149,6 +1418,34 @@ void QueuedTestComponentBase :: this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port); } +void QueuedTestComponentBase :: + set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productRequestOut_OutputPort[portNum].registerSerialPort(port); +} + +void QueuedTestComponentBase :: + set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, + Fw::InputSerializePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + this->m_productSendOut_OutputPort[portNum].registerSerialPort(port); +} + #if FW_ENABLE_TEXT_LOGGING == 1 void QueuedTestComponentBase :: @@ -1577,6 +1874,12 @@ NATIVE_INT_TYPE QueuedTestComponentBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort)); } +NATIVE_INT_TYPE QueuedTestComponentBase :: + getNum_productRecvIn_InputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRecvIn_InputPort)); +} + // ---------------------------------------------------------------------- // Getters for numbers of typed input ports // ---------------------------------------------------------------------- @@ -1693,6 +1996,18 @@ NATIVE_INT_TYPE QueuedTestComponentBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort)); } +NATIVE_INT_TYPE QueuedTestComponentBase :: + getNum_productRequestOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestOut_OutputPort)); +} + +NATIVE_INT_TYPE QueuedTestComponentBase :: + getNum_productSendOut_OutputPorts() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort)); +} + #if FW_ENABLE_TEXT_LOGGING == 1 NATIVE_INT_TYPE QueuedTestComponentBase :: @@ -1802,6 +2117,28 @@ bool QueuedTestComponentBase :: return this->m_prmSetOut_OutputPort[portNum].isConnected(); } +bool QueuedTestComponentBase :: + isConnected_productRequestOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productRequestOut_OutputPort[portNum].isConnected(); +} + +bool QueuedTestComponentBase :: + isConnected_productSendOut_OutputPort(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + + return this->m_productSendOut_OutputPort[portNum].isConnected(); +} + #if FW_ENABLE_TEXT_LOGGING == 1 bool QueuedTestComponentBase :: @@ -1887,6 +2224,83 @@ bool QueuedTestComponentBase :: return this->m_typedReturnOut_OutputPort[portNum].isConnected(); } +// ---------------------------------------------------------------------- +// Port handler base-class functions for special input ports +// +// Call these functions directly to bypass the corresponding ports +// ---------------------------------------------------------------------- + +void QueuedTestComponentBase :: + productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_productRecvIn_InputPorts(), + static_cast(portNum) + ); + + // Call pre-message hook + productRecvIn_preMsgHook( + portNum, + id, + buffer, + status + ); + ComponentIpcSerializableBuffer msg; + Fw::SerializeStatus _status = Fw::FW_SERIALIZE_OK; + + // Serialize message ID + _status = msg.serialize( + static_cast(PRODUCTRECVIN_DPRESPONSE) + ); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize port number + _status = msg.serialize(portNum); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument id + _status = msg.serialize(id); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument buffer + _status = msg.serialize(buffer); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Serialize argument status + _status = msg.serialize(status); + FW_ASSERT( + _status == Fw::FW_SERIALIZE_OK, + static_cast(_status) + ); + + // Send message + Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING; + Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block); + + FW_ASSERT( + qStatus == Os::Queue::QUEUE_OK, + static_cast(qStatus) + ); +} + // ---------------------------------------------------------------------- // Port handler base-class functions for typed input ports // @@ -1945,7 +2359,7 @@ void QueuedTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsGuarded_handler(portNum); // Unlock guard mutex @@ -1966,7 +2380,7 @@ U32 QueuedTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnGuarded_handler(portNum); // Unlock guard mutex @@ -1986,7 +2400,7 @@ U32 QueuedTestComponentBase :: U32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->noArgsReturnSync_handler(portNum); return retVal; @@ -2001,7 +2415,7 @@ void QueuedTestComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->noArgsSync_handler(portNum); } @@ -2459,7 +2873,7 @@ void QueuedTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedGuarded_handler( portNum, u32, @@ -2498,7 +2912,7 @@ F32 QueuedTestComponentBase :: // Lock guard mutex before calling this->lock(); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnGuarded_handler( portNum, u32, @@ -2536,7 +2950,7 @@ F32 QueuedTestComponentBase :: F32 retVal; - // Down call to pure virtual handler method implemented in Impl class + // Call handler function retVal = this->typedReturnSync_handler( portNum, u32, @@ -2569,7 +2983,7 @@ void QueuedTestComponentBase :: static_cast(portNum) ); - // Down call to pure virtual handler method implemented in Impl class + // Call handler function this->typedSync_handler( portNum, u32, @@ -2582,6 +2996,25 @@ void QueuedTestComponentBase :: ); } +// ---------------------------------------------------------------------- +// Pre-message hooks for special async input ports +// +// Each of these functions is invoked just before processing a message +// on the corresponding port. By default, they do nothing. You can +// override them to provide specific pre-message behavior. +// ---------------------------------------------------------------------- + +void QueuedTestComponentBase :: + productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + // Default: no-op +} + // ---------------------------------------------------------------------- // Pre-message hooks for typed async input ports // @@ -2656,6 +3089,44 @@ void QueuedTestComponentBase :: // Default: no-op } +// ---------------------------------------------------------------------- +// Invocation functions for special output ports +// ---------------------------------------------------------------------- + +void QueuedTestComponentBase :: + productRequestOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + FW_ASSERT( + portNum < this->getNum_productRequestOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productRequestOut_OutputPort[portNum].invoke( + id, + size + ); +} + +void QueuedTestComponentBase :: + productSendOut_out( + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + FW_ASSERT( + portNum < this->getNum_productSendOut_OutputPorts(), + static_cast(portNum) + ); + this->m_productSendOut_OutputPort[portNum].invoke( + id, + buffer + ); +} + // ---------------------------------------------------------------------- // Invocation functions for typed output ports // ---------------------------------------------------------------------- @@ -5168,6 +5639,34 @@ S QueuedTestComponentBase :: return _local; } +// ---------------------------------------------------------------------- +// Functions for managing data products +// ---------------------------------------------------------------------- + +void QueuedTestComponentBase :: + dpSend( + DpContainer& container, + Fw::Time timeTag + ) +{ + // Update the time tag + if (timeTag == Fw::ZERO_TIME) { + // Get the time from the time port + timeTag = this->getTime(); + } + container.setTimeTag(timeTag); + // Serialize the header into the packet + Fw::SerializeStatus status = container.serializeHeader(); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + // Update the size of the buffer according to the data size + const FwSizeType packetSize = container.getPacketSize(); + Fw::Buffer buffer = container.getBuffer(); + FW_ASSERT(packetSize <= buffer.getSize(), packetSize, buffer.getSize()); + buffer.setSize(packetSize); + // Send the buffer + this->productSendOut_out(0, container.getId(), buffer); +} + // ---------------------------------------------------------------------- // Time // ---------------------------------------------------------------------- @@ -5253,6 +5752,42 @@ Fw::QueuedComponentBase::MsgDispatchStatus QueuedTestComponentBase :: ); switch (msgType) { + // Handle async input port productRecvIn + case PRODUCTRECVIN_DPRESPONSE: { + // Deserialize argument id + FwDpIdType id; + deserStatus = msg.deserialize(id); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument buffer + Fw::Buffer buffer; + deserStatus = msg.deserialize(buffer); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + + // Deserialize argument status + Fw::Success status; + deserStatus = msg.deserialize(status); + FW_ASSERT( + deserStatus == Fw::FW_SERIALIZE_OK, + static_cast(deserStatus) + ); + // Call handler function + this->productRecvIn_handler( + portNum, + id, + buffer, + status + ); + + break; + } + // Handle async input port noArgsAsync case NOARGSASYNC_NOARGS: { // Call handler function @@ -6298,6 +6833,25 @@ void QueuedTestComponentBase :: } } +void QueuedTestComponentBase :: + m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(callComp); + QueuedTestComponentBase* compPtr = static_cast(callComp); + compPtr->productRecvIn_handlerBase( + portNum, + id, + buffer, + status + ); +} + // ---------------------------------------------------------------------- // Calls for messages received on typed input ports // ---------------------------------------------------------------------- @@ -6874,3 +7428,68 @@ Fw::CmdResponse QueuedTestComponentBase :: return Fw::CmdResponse::EXECUTION_ERROR; } + +// ---------------------------------------------------------------------- +// Private data product handling functions +// ---------------------------------------------------------------------- + +void QueuedTestComponentBase :: + dpRequest( + ContainerId::T containerId, + FwSizeType size + ) +{ + const FwDpIdType globalId = this->getIdBase() + containerId; + this->productRequestOut_out(0, globalId, size); +} + +void QueuedTestComponentBase :: + productRecvIn_handler( + const NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + DpContainer container(id, buffer, this->getIdBase()); + // Convert global id to local id + const FwDpIdType idBase = this->getIdBase(); + FW_ASSERT(id >= idBase, id, idBase); + const FwDpIdType localId = id - idBase; + // Switch on the local id + switch (localId) { + case ContainerId::Container1: + // Set the priority + container.setPriority(ContainerPriority::Container1); + // Call the handler + this->dpRecv_Container1_handler(container, status.e); + break; + case ContainerId::Container2: + // Set the priority + container.setPriority(ContainerPriority::Container2); + // Call the handler + this->dpRecv_Container2_handler(container, status.e); + break; + case ContainerId::Container3: + // Set the priority + container.setPriority(ContainerPriority::Container3); + // Call the handler + this->dpRecv_Container3_handler(container, status.e); + break; + case ContainerId::Container4: + // Set the priority + container.setPriority(ContainerPriority::Container4); + // Call the handler + this->dpRecv_Container4_handler(container, status.e); + break; + case ContainerId::Container5: + // Set the priority + container.setPriority(ContainerPriority::Container5); + // Call the handler + this->dpRecv_Container5_handler(container, status.e); + break; + default: + FW_ASSERT(0); + break; + } +} diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp index a90588331..ddc6202b0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp @@ -15,6 +15,10 @@ #include "Fw/Cmd/CmdResponsePortAc.hpp" #include "Fw/Cmd/CmdString.hpp" #include "Fw/Comp/ActiveComponentBase.hpp" +#include "Fw/Dp/DpContainer.hpp" +#include "Fw/Dp/DpRequestPortAc.hpp" +#include "Fw/Dp/DpResponsePortAc.hpp" +#include "Fw/Dp/DpSendPortAc.hpp" #include "Fw/Log/LogPortAc.hpp" #include "Fw/Log/LogString.hpp" #if FW_ENABLE_TEXT_LOGGING == 1 @@ -32,6 +36,7 @@ #include "NoArgsPortAc.hpp" #include "NoArgsReturnPortAc.hpp" #include "Os/Mutex.hpp" +#include "QueuedTest_DataSerializableAc.hpp" #include "SSerializableAc.hpp" #include "TypedPortAc.hpp" #include "TypedReturnPortAc.hpp" @@ -60,6 +65,7 @@ class QueuedTestComponentBase : //! Enumerations for numbers of special input ports enum { NUM_CMDIN_INPUT_PORTS = 1, + NUM_PRODUCTRECVIN_INPUT_PORTS = 1, }; //! Enumerations for numbers of typed input ports @@ -86,6 +92,8 @@ class QueuedTestComponentBase : NUM_EVENTOUT_OUTPUT_PORTS = 1, NUM_PRMGETOUT_OUTPUT_PORTS = 1, NUM_PRMSETOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS = 1, + NUM_PRODUCTSENDOUT_OUTPUT_PORTS = 1, NUM_TEXTEVENTOUT_OUTPUT_PORTS = 1, NUM_TIMEGETOUT_OUTPUT_PORTS = 1, NUM_TLMOUT_OUTPUT_PORTS = 1, @@ -176,6 +184,108 @@ class QueuedTestComponentBase : PARAMID_PARAMSTRUCT = 0x32, //!< A parameter with struct data and set/save opcodes }; + PROTECTED: + + // ---------------------------------------------------------------------- + // Types for data products + // ---------------------------------------------------------------------- + + //! The container ids + struct ContainerId { + enum T : FwDpIdType { + Container1 = 100, + Container2 = 200, + Container3 = 300, + Container4 = 400, + Container5 = 500, + }; + }; + + //! The container default priorities + struct ContainerPriority { + enum T : FwDpPriorityType { + Container1 = 10, + Container2 = 20, + Container3 = 0, + Container4 = 0, + Container5 = 0, + }; + }; + + //! The record ids + struct RecordId { + enum T : FwDpIdType { + U32Record = 100, + DataRecord = 200, + U8ArrayRecord = 300, + U32ArrayRecord = 400, + DataArrayRecord = 500, + }; + }; + + //! A data product container + class DpContainer : + public Fw::DpContainer + { + + public: + + //! Constructor with custom initialization + DpContainer( + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The packet buffer + FwDpIdType baseId //!< The component base id + ); + + //! Constructor with default initialization + DpContainer(); + + public: + + //! Serialize a DataArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataArrayRecord( + const QueuedTest_Data* array, //!< An array of QueuedTest_Data elements + FwSizeType size //!< The array size + ); + + //! Serialize a DataRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_DataRecord( + const QueuedTest_Data& elt //!< The element + ); + + //! Serialize a U32ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32ArrayRecord( + const U32* array, //!< An array of U32 elements + FwSizeType size //!< The array size + ); + + //! Serialize a U32Record record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U32Record( + U32 elt //!< The element + ); + + //! Serialize a U8ArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_U8ArrayRecord( + const U8* array, //!< An array of U8 elements + FwSizeType size //!< The array size + ); + + FwDpIdType getBaseId() const { return this->baseId; } + + void setBaseId(FwDpIdType baseId) { this->baseId = baseId; } + + PRIVATE: + + //! The component base id + FwDpIdType baseId; + + }; + public: // ---------------------------------------------------------------------- @@ -201,6 +311,13 @@ class QueuedTestComponentBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Get special input port at index + //! + //! \return productRecvIn[portNum] + Fw::InputDpResponsePort* get_productRecvIn_InputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + public: // ---------------------------------------------------------------------- @@ -334,6 +451,18 @@ class QueuedTestComponentBase : Fw::InputPrmSetPort* port //!< The input port ); + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpRequestPort* port //!< The input port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpSendPort* port //!< The input port + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Connect port to textEventOut[portNum] @@ -418,6 +547,18 @@ class QueuedTestComponentBase : Fw::InputSerializePort* port //!< The port ); + //! Connect port to productRequestOut[portNum] + void set_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + + //! Connect port to productSendOut[portNum] + void set_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputSerializePort* port //!< The port + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Connect port to textEventOut[portNum] @@ -511,6 +652,11 @@ class QueuedTestComponentBase : //! \return The number of cmdIn input ports NATIVE_INT_TYPE getNum_cmdIn_InputPorts() const; + //! Get the number of productRecvIn input ports + //! + //! \return The number of productRecvIn input ports + NATIVE_INT_TYPE getNum_productRecvIn_InputPorts() const; + PROTECTED: // ---------------------------------------------------------------------- @@ -613,6 +759,16 @@ class QueuedTestComponentBase : //! \return The number of prmSetOut output ports NATIVE_INT_TYPE getNum_prmSetOut_OutputPorts() const; + //! Get the number of productRequestOut output ports + //! + //! \return The number of productRequestOut output ports + NATIVE_INT_TYPE getNum_productRequestOut_OutputPorts() const; + + //! Get the number of productSendOut output ports + //! + //! \return The number of productSendOut output ports + NATIVE_INT_TYPE getNum_productSendOut_OutputPorts() const; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get the number of textEventOut output ports @@ -699,6 +855,20 @@ class QueuedTestComponentBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Check whether port productRequestOut is connected + //! + //! \return Whether port productRequestOut is connected + bool isConnected_productRequestOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port productSendOut is connected + //! + //! \return Whether port productSendOut is connected + bool isConnected_productSendOut_OutputPort( + NATIVE_INT_TYPE portNum //!< The port number + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Check whether port textEventOut is connected @@ -758,6 +928,22 @@ class QueuedTestComponentBase : NATIVE_INT_TYPE portNum //!< The port number ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Port handler base-class functions for special input ports + // + // Call these functions directly to bypass the corresponding ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for input port productRecvIn + void productRecvIn_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1014,6 +1200,24 @@ class QueuedTestComponentBase : const S& s //!< A struct ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Pre-message hooks for special async input ports + // + // Each of these functions is invoked just before processing a message + // on the corresponding port. By default, they do nothing. You can + // override them to provide specific pre-message behavior. + // ---------------------------------------------------------------------- + + //! Pre-message hook for async input port productRecvIn + virtual void productRecvIn_preMsgHook( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1077,6 +1281,26 @@ class QueuedTestComponentBase : const S& s //!< A struct ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Invocation functions for special output ports + // ---------------------------------------------------------------------- + + //! Invoke output port productRequestOut + void productRequestOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Invoke output port productSendOut + void productSendOut_out( + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + PROTECTED: // ---------------------------------------------------------------------- @@ -1811,6 +2035,89 @@ class QueuedTestComponentBase : Fw::ParamValid& valid //!< Whether the parameter is valid ); + PROTECTED: + + // ---------------------------------------------------------------------- + // Functions for managing data products + // ---------------------------------------------------------------------- + + //! Request a Container1 container + void dpRequest_Container1( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container1, size); + } + + //! Request a Container2 container + void dpRequest_Container2( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container2, size); + } + + //! Request a Container3 container + void dpRequest_Container3( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container3, size); + } + + //! Request a Container4 container + void dpRequest_Container4( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container4, size); + } + + //! Request a Container5 container + void dpRequest_Container5( + FwSizeType size //!< The buffer size (input) + ) { + return this->dpRequest(ContainerId::Container5, size); + } + + //! Send a data product + void dpSend( + DpContainer& container, //!< The data product container + Fw::Time timeTag = Fw::ZERO_TIME //!< The time tag + ); + + PROTECTED: + + // ---------------------------------------------------------------------- + // Handlers to implement for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + virtual void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container2 + virtual void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container3 + virtual void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container4 + virtual void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + + //! Receive a container of type Container5 + virtual void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) = 0; + PROTECTED: // ---------------------------------------------------------------------- @@ -1861,6 +2168,15 @@ class QueuedTestComponentBase : Fw::CmdArgBuffer& args //!< Buffer containing arguments ); + //! Callback for port productRecvIn + static void m_p_productRecvIn_in( + Fw::PassiveComponentBase* callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + PRIVATE: // ---------------------------------------------------------------------- @@ -2085,6 +2401,26 @@ class QueuedTestComponentBase : //! \return The command response Fw::CmdResponse paramSave_ParamStruct(); + PRIVATE: + + // ---------------------------------------------------------------------- + // Private data product handling functions + // ---------------------------------------------------------------------- + + //! Request a data product container + void dpRequest( + ContainerId::T containerId, //!< The component-local container id + FwSizeType size //!< The buffer size + ); + + //! Handler implementation for productRecvIn + void productRecvIn_handler( + const NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container id + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The buffer status + ); + PRIVATE: // ---------------------------------------------------------------------- @@ -2094,6 +2430,9 @@ class QueuedTestComponentBase : //! Input port cmdIn Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS]; + //! Input port productRecvIn + Fw::InputDpResponsePort m_productRecvIn_InputPort[NUM_PRODUCTRECVIN_INPUT_PORTS]; + PRIVATE: // ---------------------------------------------------------------------- @@ -2160,6 +2499,12 @@ class QueuedTestComponentBase : //! Output port prmSetOut Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS]; + //! Output port productRequestOut + Fw::OutputDpRequestPort m_productRequestOut_OutputPort[NUM_PRODUCTREQUESTOUT_OUTPUT_PORTS]; + + //! Output port productSendOut + Fw::OutputDpSendPort m_productSendOut_OutputPort[NUM_PRODUCTSENDOUT_OUTPUT_PORTS]; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Output port textEventOut diff --git a/compiler/tools/fpp-to-cpp/test/component/base/run.sh b/compiler/tools/fpp-to-cpp/test/component/base/run.sh index 9d08b8c11..f42382ad8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/run.sh +++ b/compiler/tools/fpp-to-cpp/test/component/base/run.sh @@ -22,32 +22,47 @@ empty() passive() { run_test "-i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive && \ - diff_cpp PassiveTestComponent && \ - diff_cpp PassiveSerialComponent && \ diff_cpp PassiveCommandsComponent && \ diff_cpp PassiveEventsComponent && \ + diff_cpp PassiveGetProductPortsOnlyComponent && \ + diff_cpp PassiveGetProductsComponent && \ + diff_cpp PassiveGuardedProductsComponent && \ + diff_cpp PassiveParamsComponent &&\ + diff_cpp PassiveSerialComponent && \ + diff_cpp PassiveSyncProductPortsOnlyComponent && \ + diff_cpp PassiveSyncProductsComponent && \ diff_cpp PassiveTelemetryComponent && \ - diff_cpp PassiveParamsComponent + diff_cpp PassiveTestComponent } active() { run_test "-i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active && \ - diff_cpp ActiveTestComponent && \ - diff_cpp ActiveSerialComponent && \ + diff_cpp ActiveAsyncProductPortsOnlyComponent && \ + diff_cpp ActiveAsyncProductsComponent && \ diff_cpp ActiveCommandsComponent && \ diff_cpp ActiveEventsComponent && \ + diff_cpp ActiveGetProductsComponent && \ + diff_cpp ActiveGuardedProductsComponent && \ + diff_cpp ActiveParamsComponent && \ + diff_cpp ActiveSerialComponent && \ + diff_cpp ActiveSyncProductsComponent && \ diff_cpp ActiveTelemetryComponent && \ - diff_cpp ActiveParamsComponent + diff_cpp ActiveTestComponent } queued() { run_test "-i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued && \ - diff_cpp QueuedTestComponent && \ - diff_cpp QueuedSerialComponent && \ + diff_cpp QueuedAsyncProductPortsOnlyComponent && \ + diff_cpp QueuedAsyncProductsComponent && \ diff_cpp QueuedCommandsComponent && \ diff_cpp QueuedEventsComponent && \ + diff_cpp QueuedGetProductsComponent && \ + diff_cpp QueuedGuardedProductsComponent && \ + diff_cpp QueuedParamsComponent && \ + diff_cpp QueuedSerialComponent && \ + diff_cpp QueuedSyncProductsComponent && \ diff_cpp QueuedTelemetryComponent && \ - diff_cpp QueuedParamsComponent + diff_cpp QueuedTestComponent } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/update-ref.sh b/compiler/tools/fpp-to-cpp/test/component/base/update-ref.sh index e775f273a..824f5d385 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/update-ref.sh +++ b/compiler/tools/fpp-to-cpp/test/component/base/update-ref.sh @@ -22,32 +22,47 @@ empty() passive() { update "-i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive - move_cpp PassiveTestComponent - move_cpp PassiveSerialComponent move_cpp PassiveCommandsComponent move_cpp PassiveEventsComponent - move_cpp PassiveTelemetryComponent + move_cpp PassiveGetProductPortsOnlyComponent + move_cpp PassiveGetProductsComponent + move_cpp PassiveGuardedProductsComponent move_cpp PassiveParamsComponent + move_cpp PassiveSerialComponent + move_cpp PassiveSyncProductPortsOnlyComponent + move_cpp PassiveSyncProductsComponent + move_cpp PassiveTelemetryComponent + move_cpp PassiveTestComponent } active() { update "-i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active - move_cpp ActiveTestComponent - move_cpp ActiveSerialComponent + move_cpp ActiveAsyncProductPortsOnlyComponent + move_cpp ActiveAsyncProductsComponent move_cpp ActiveCommandsComponent move_cpp ActiveEventsComponent - move_cpp ActiveTelemetryComponent + move_cpp ActiveGetProductsComponent + move_cpp ActiveGuardedProductsComponent move_cpp ActiveParamsComponent + move_cpp ActiveSerialComponent + move_cpp ActiveSyncProductsComponent + move_cpp ActiveTelemetryComponent + move_cpp ActiveTestComponent } queued() { update "-i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued - move_cpp QueuedTestComponent - move_cpp QueuedSerialComponent + move_cpp QueuedAsyncProductPortsOnlyComponent + move_cpp QueuedAsyncProductsComponent move_cpp QueuedCommandsComponent move_cpp QueuedEventsComponent - move_cpp QueuedTelemetryComponent + move_cpp QueuedGetProductsComponent + move_cpp QueuedGuardedProductsComponent move_cpp QueuedParamsComponent + move_cpp QueuedSerialComponent + move_cpp QueuedSyncProductsComponent + move_cpp QueuedTelemetryComponent + move_cpp QueuedTestComponent } diff --git a/compiler/tools/fpp-to-cpp/test/component/deps-comma.txt b/compiler/tools/fpp-to-cpp/test/component/deps-comma.txt index 510ec2067..fe9af5a03 100644 --- a/compiler/tools/fpp-to-cpp/test/component/deps-comma.txt +++ b/compiler/tools/fpp-to-cpp/test/component/deps-comma.txt @@ -1 +1 @@ -../../fprime/Fw/Cmd/Cmd.fpp,../../fprime/Fw/Log/Log.fpp,../../fprime/Fw/Prm/Prm.fpp,../../fprime/Fw/Time/Time.fpp,../../fprime/Fw/Tlm/Tlm.fpp,../../fprime/config/FpConfig.fpp,../types.fpp +../../fprime/Fw/Buffer/Buffer.fpp,../../fprime/Fw/Cmd/Cmd.fpp,../../fprime/Fw/Dp/Dp.fpp,../../fprime/Fw/Log/Log.fpp,../../fprime/Fw/Prm/Prm.fpp,../../fprime/Fw/Time/Time.fpp,../../fprime/Fw/Tlm/Tlm.fpp,../../fprime/Fw/Types/Types.fpp,../../fprime/config/DpCfg.fpp,../../fprime/config/FpConfig.fpp,../types.fpp diff --git a/compiler/tools/fpp-to-cpp/test/component/deps.txt b/compiler/tools/fpp-to-cpp/test/component/deps.txt index f83ae1c7d..795ed52ef 100644 --- a/compiler/tools/fpp-to-cpp/test/component/deps.txt +++ b/compiler/tools/fpp-to-cpp/test/component/deps.txt @@ -1,6 +1,11 @@ +../../fprime/Fw/Buffer/Buffer.fpp ../../fprime/Fw/Cmd/Cmd.fpp +../../fprime/Fw/Dp/Dp.fpp ../../fprime/Fw/Log/Log.fpp ../../fprime/Fw/Prm/Prm.fpp ../../fprime/Fw/Time/Time.fpp ../../fprime/Fw/Tlm/Tlm.fpp +../../fprime/Fw/Types/Types.fpp +../../fprime/config/DpCfg.fpp ../../fprime/config/FpConfig.fpp +../types.fpp diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProductPortsOnly.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProductPortsOnly.template.ref.cpp new file mode 100644 index 000000000..ce80e7be5 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProductPortsOnly.template.ref.cpp @@ -0,0 +1,25 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnly.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/ActiveAsyncProductPortsOnly.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductPortsOnly :: + ActiveAsyncProductPortsOnly(const char* const compName) : + ActiveAsyncProductPortsOnlyComponentBase(compName) +{ + +} + +ActiveAsyncProductPortsOnly :: + ~ActiveAsyncProductPortsOnly() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProductPortsOnly.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProductPortsOnly.template.ref.hpp new file mode 100644 index 000000000..99160d067 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProductPortsOnly.template.ref.hpp @@ -0,0 +1,32 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnly.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProductPortsOnly component implementation class +// ====================================================================== + +#ifndef ActiveAsyncProductPortsOnly_HPP +#define ActiveAsyncProductPortsOnly_HPP + +#include "ActiveAsyncProductPortsOnlyComponentAc.hpp" + +class ActiveAsyncProductPortsOnly : + public ActiveAsyncProductPortsOnlyComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveAsyncProductPortsOnly object + ActiveAsyncProductPortsOnly( + const char* const compName //!< The component name + ); + + //! Destroy ActiveAsyncProductPortsOnly object + ~ActiveAsyncProductPortsOnly(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProducts.template.ref.cpp new file mode 100644 index 000000000..2d3f3f313 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title ActiveAsyncProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/ActiveAsyncProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProducts :: + ActiveAsyncProducts(const char* const compName) : + ActiveAsyncProductsComponentBase(compName) +{ + +} + +ActiveAsyncProducts :: + ~ActiveAsyncProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveAsyncProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveAsyncProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 ActiveAsyncProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveAsyncProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveAsyncProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveAsyncProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 ActiveAsyncProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void ActiveAsyncProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void ActiveAsyncProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveAsyncProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProducts.template.ref.hpp new file mode 100644 index 000000000..90deddefa --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveAsyncProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title ActiveAsyncProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProducts component implementation class +// ====================================================================== + +#ifndef ActiveAsyncProducts_HPP +#define ActiveAsyncProducts_HPP + +#include "ActiveAsyncProductsComponentAc.hpp" + +class ActiveAsyncProducts : + public ActiveAsyncProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveAsyncProducts object + ActiveAsyncProducts( + const char* const compName //!< The component name + ); + + //! Destroy ActiveAsyncProducts object + ~ActiveAsyncProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveCommands.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveCommands.template.ref.hpp index 212088c82..66a3a79d4 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveCommands.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveCommands.template.ref.hpp @@ -38,35 +38,35 @@ class ActiveCommands : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class ActiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -192,7 +192,7 @@ class ActiveCommands : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -203,7 +203,7 @@ class ActiveCommands : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -213,7 +213,7 @@ class ActiveCommands : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -222,7 +222,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -231,7 +231,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -240,7 +240,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -248,7 +248,7 @@ class ActiveCommands : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -259,7 +259,7 @@ class ActiveCommands : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -269,7 +269,7 @@ class ActiveCommands : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -278,7 +278,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -287,7 +287,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -296,7 +296,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_ASYNC //! @@ -304,7 +304,7 @@ class ActiveCommands : void CMD_ASYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PRIORITY //! @@ -312,7 +312,7 @@ class ActiveCommands : void CMD_PRIORITY_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY //! @@ -321,7 +321,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; //! Handler implementation for command CMD_DROP //! @@ -329,7 +329,7 @@ class ActiveCommands : void CMD_DROP_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY_DROP //! @@ -338,7 +338,7 @@ class ActiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveEvents.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveEvents.template.ref.hpp index 41e2cb5db..b6ea5b451 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveEvents.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveEvents.template.ref.hpp @@ -38,35 +38,35 @@ class ActiveEvents : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class ActiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGetProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGetProducts.template.ref.cpp new file mode 100644 index 000000000..f8a1371ae --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGetProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title ActiveGetProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/ActiveGetProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveGetProducts :: + ActiveGetProducts(const char* const compName) : + ActiveGetProductsComponentBase(compName) +{ + +} + +ActiveGetProducts :: + ~ActiveGetProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void ActiveGetProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveGetProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveGetProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 ActiveGetProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveGetProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveGetProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGetProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGetProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGetProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGetProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveGetProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 ActiveGetProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void ActiveGetProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void ActiveGetProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGetProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGetProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGetProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGetProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGetProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGetProducts.template.ref.hpp new file mode 100644 index 000000000..2f5762071 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGetProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title ActiveGetProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGetProducts component implementation class +// ====================================================================== + +#ifndef ActiveGetProducts_HPP +#define ActiveGetProducts_HPP + +#include "ActiveGetProductsComponentAc.hpp" + +class ActiveGetProducts : + public ActiveGetProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveGetProducts object + ActiveGetProducts( + const char* const compName //!< The component name + ); + + //! Destroy ActiveGetProducts object + ~ActiveGetProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGuardedProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGuardedProducts.template.ref.cpp new file mode 100644 index 000000000..f6191a25a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGuardedProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title ActiveGuardedProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/ActiveGuardedProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveGuardedProducts :: + ActiveGuardedProducts(const char* const compName) : + ActiveGuardedProductsComponentBase(compName) +{ + +} + +ActiveGuardedProducts :: + ~ActiveGuardedProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveGuardedProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveGuardedProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 ActiveGuardedProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveGuardedProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveGuardedProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveGuardedProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 ActiveGuardedProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void ActiveGuardedProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void ActiveGuardedProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveGuardedProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGuardedProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGuardedProducts.template.ref.hpp new file mode 100644 index 000000000..9b35daae8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveGuardedProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title ActiveGuardedProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGuardedProducts component implementation class +// ====================================================================== + +#ifndef ActiveGuardedProducts_HPP +#define ActiveGuardedProducts_HPP + +#include "ActiveGuardedProductsComponentAc.hpp" + +class ActiveGuardedProducts : + public ActiveGuardedProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveGuardedProducts object + ActiveGuardedProducts( + const char* const compName //!< The component name + ); + + //! Destroy ActiveGuardedProducts object + ~ActiveGuardedProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveParams.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveParams.template.ref.hpp index 900dffa7e..f5ebaffa8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveParams.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveParams.template.ref.hpp @@ -38,35 +38,35 @@ class ActiveParams : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class ActiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSerial.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSerial.template.ref.hpp index 43429096c..748bdcfd2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSerial.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSerial.template.ref.hpp @@ -38,35 +38,35 @@ class ActiveSerial : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class ActiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -192,7 +192,7 @@ class ActiveSerial : void serialAsync_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialAsyncAssert //! @@ -200,7 +200,7 @@ class ActiveSerial : void serialAsyncAssert_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialAsyncBlockPriority //! @@ -208,7 +208,7 @@ class ActiveSerial : void serialAsyncBlockPriority_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialAsyncDropPriority //! @@ -216,7 +216,7 @@ class ActiveSerial : void serialAsyncDropPriority_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialGuarded //! @@ -224,7 +224,7 @@ class ActiveSerial : void serialGuarded_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialSync //! @@ -232,7 +232,7 @@ class ActiveSerial : void serialSync_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; PRIVATE: @@ -246,7 +246,7 @@ class ActiveSerial : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -257,7 +257,7 @@ class ActiveSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -267,7 +267,7 @@ class ActiveSerial : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -276,7 +276,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -285,7 +285,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -294,7 +294,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -302,7 +302,7 @@ class ActiveSerial : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -313,7 +313,7 @@ class ActiveSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -323,7 +323,7 @@ class ActiveSerial : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -332,7 +332,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -341,7 +341,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -350,7 +350,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_ASYNC //! @@ -358,7 +358,7 @@ class ActiveSerial : void CMD_ASYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PRIORITY //! @@ -366,7 +366,7 @@ class ActiveSerial : void CMD_PRIORITY_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY //! @@ -375,7 +375,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; //! Handler implementation for command CMD_DROP //! @@ -383,7 +383,7 @@ class ActiveSerial : void CMD_DROP_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY_DROP //! @@ -392,7 +392,7 @@ class ActiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; PRIVATE: @@ -405,14 +405,14 @@ class ActiveSerial : //! An internal port with array params void internalArray_internalInterfaceHandler( const A& a //!< An array - ); + ) override; //! Handler implementation for internalEnum //! //! An internal port with enum params void internalEnum_internalInterfaceHandler( const E& e //!< An enum - ); + ) override; //! Handler implementation for internalPrimitive //! @@ -421,12 +421,12 @@ class ActiveSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for internalPriorityDrop //! //! An internal port with priority and queue full behavior - void internalPriorityDrop_internalInterfaceHandler(); + void internalPriorityDrop_internalInterfaceHandler() override; //! Handler implementation for internalString //! @@ -434,14 +434,14 @@ class ActiveSerial : void internalString_internalInterfaceHandler( const Fw::InternalInterfaceString& str1, //!< A string const Fw::InternalInterfaceString& str2 //!< Another string - ); + ) override; //! Handler implementation for internalStruct //! //! An internal port with struct params with priority and queue full behavior void internalStruct_internalInterfaceHandler( const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSyncProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSyncProducts.template.ref.cpp new file mode 100644 index 000000000..8e0d07ed1 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSyncProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title ActiveSyncProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/ActiveSyncProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveSyncProducts :: + ActiveSyncProducts(const char* const compName) : + ActiveSyncProductsComponentBase(compName) +{ + +} + +ActiveSyncProducts :: + ~ActiveSyncProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void ActiveSyncProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveSyncProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveSyncProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 ActiveSyncProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveSyncProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void ActiveSyncProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveSyncProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveSyncProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveSyncProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void ActiveSyncProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveSyncProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 ActiveSyncProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void ActiveSyncProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void ActiveSyncProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveSyncProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveSyncProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveSyncProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void ActiveSyncProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSyncProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSyncProducts.template.ref.hpp new file mode 100644 index 000000000..da2422f05 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveSyncProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title ActiveSyncProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveSyncProducts component implementation class +// ====================================================================== + +#ifndef ActiveSyncProducts_HPP +#define ActiveSyncProducts_HPP + +#include "ActiveSyncProductsComponentAc.hpp" + +class ActiveSyncProducts : + public ActiveSyncProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ActiveSyncProducts object + ActiveSyncProducts( + const char* const compName //!< The component name + ); + + //! Destroy ActiveSyncProducts object + ~ActiveSyncProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTelemetry.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTelemetry.template.ref.hpp index db38ba4ce..8ee561558 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTelemetry.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTelemetry.template.ref.hpp @@ -38,35 +38,35 @@ class ActiveTelemetry : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class ActiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.cpp index 70cd29890..ab7ea0604 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.cpp @@ -419,4 +419,53 @@ namespace M { // TODO } + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + void ActiveTest :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) + { + // TODO + } + + void ActiveTest :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) + { + // TODO + } + + void ActiveTest :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) + { + // TODO + } + + void ActiveTest :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) + { + // TODO + } + + void ActiveTest :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) + { + // TODO + } + } diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.hpp index 4a4807419..0a6ecc7e3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/ActiveTest.template.ref.hpp @@ -40,35 +40,35 @@ namespace M { //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -82,7 +82,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -96,7 +96,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -110,7 +110,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -124,7 +124,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -138,7 +138,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -152,7 +152,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -166,7 +166,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -180,7 +180,7 @@ namespace M { const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -194,7 +194,7 @@ namespace M { void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -205,7 +205,7 @@ namespace M { U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -215,7 +215,7 @@ namespace M { U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -224,7 +224,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -233,7 +233,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -242,7 +242,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -250,7 +250,7 @@ namespace M { void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -261,7 +261,7 @@ namespace M { U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -271,7 +271,7 @@ namespace M { U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -280,7 +280,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -289,7 +289,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -298,7 +298,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_ASYNC //! @@ -306,7 +306,7 @@ namespace M { void CMD_ASYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PRIORITY //! @@ -314,7 +314,7 @@ namespace M { void CMD_PRIORITY_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY //! @@ -323,7 +323,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; //! Handler implementation for command CMD_DROP //! @@ -331,7 +331,7 @@ namespace M { void CMD_DROP_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY_DROP //! @@ -340,7 +340,7 @@ namespace M { FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; PRIVATE: @@ -353,14 +353,14 @@ namespace M { //! An internal port with array params void internalArray_internalInterfaceHandler( const A& a //!< An array - ); + ) override; //! Handler implementation for internalEnum //! //! An internal port with enum params void internalEnum_internalInterfaceHandler( const E& e //!< An enum - ); + ) override; //! Handler implementation for internalPrimitive //! @@ -369,12 +369,12 @@ namespace M { U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for internalPriorityDrop //! //! An internal port with priority and queue full behavior - void internalPriorityDrop_internalInterfaceHandler(); + void internalPriorityDrop_internalInterfaceHandler() override; //! Handler implementation for internalString //! @@ -382,14 +382,50 @@ namespace M { void internalString_internalInterfaceHandler( const Fw::InternalInterfaceString& str1, //!< A string const Fw::InternalInterfaceString& str2 //!< Another string - ); + ) override; //! Handler implementation for internalStruct //! //! An internal port with struct params with priority and queue full behavior void internalStruct_internalInterfaceHandler( const S& s //!< A struct - ); + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveCommands.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveCommands.template.ref.hpp index f694a9ec2..66161b387 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveCommands.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveCommands.template.ref.hpp @@ -38,28 +38,28 @@ class PassiveCommands : //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedGuarded //! @@ -73,7 +73,7 @@ class PassiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -87,7 +87,7 @@ class PassiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -101,7 +101,7 @@ class PassiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -115,7 +115,7 @@ class PassiveCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -129,7 +129,7 @@ class PassiveCommands : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -140,7 +140,7 @@ class PassiveCommands : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -150,7 +150,7 @@ class PassiveCommands : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -159,7 +159,7 @@ class PassiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -168,7 +168,7 @@ class PassiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -177,7 +177,7 @@ class PassiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -185,7 +185,7 @@ class PassiveCommands : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -196,7 +196,7 @@ class PassiveCommands : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -206,7 +206,7 @@ class PassiveCommands : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -215,7 +215,7 @@ class PassiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -224,7 +224,7 @@ class PassiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -233,7 +233,7 @@ class PassiveCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveEvents.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveEvents.template.ref.hpp index 9a4cd5c4f..92ebb8173 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveEvents.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveEvents.template.ref.hpp @@ -38,28 +38,28 @@ class PassiveEvents : //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedGuarded //! @@ -73,7 +73,7 @@ class PassiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -87,7 +87,7 @@ class PassiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -101,7 +101,7 @@ class PassiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -115,7 +115,7 @@ class PassiveEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProductPortsOnly.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProductPortsOnly.template.ref.cpp new file mode 100644 index 000000000..3b9b431f8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProductPortsOnly.template.ref.cpp @@ -0,0 +1,25 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnly.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/PassiveGetProductPortsOnly.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductPortsOnly :: + PassiveGetProductPortsOnly(const char* const compName) : + PassiveGetProductPortsOnlyComponentBase(compName) +{ + +} + +PassiveGetProductPortsOnly :: + ~PassiveGetProductPortsOnly() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProductPortsOnly.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProductPortsOnly.template.ref.hpp new file mode 100644 index 000000000..c2514c684 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProductPortsOnly.template.ref.hpp @@ -0,0 +1,32 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnly.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProductPortsOnly component implementation class +// ====================================================================== + +#ifndef PassiveGetProductPortsOnly_HPP +#define PassiveGetProductPortsOnly_HPP + +#include "PassiveGetProductPortsOnlyComponentAc.hpp" + +class PassiveGetProductPortsOnly : + public PassiveGetProductPortsOnlyComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveGetProductPortsOnly object + PassiveGetProductPortsOnly( + const char* const compName //!< The component name + ); + + //! Destroy PassiveGetProductPortsOnly object + ~PassiveGetProductPortsOnly(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProducts.template.ref.cpp new file mode 100644 index 000000000..37c40a645 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProducts.template.ref.cpp @@ -0,0 +1,162 @@ +// ====================================================================== +// \title PassiveGetProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/PassiveGetProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProducts :: + PassiveGetProducts(const char* const compName) : + PassiveGetProductsComponentBase(compName) +{ + +} + +PassiveGetProducts :: + ~PassiveGetProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void PassiveGetProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 PassiveGetProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 PassiveGetProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void PassiveGetProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void PassiveGetProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 PassiveGetProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 PassiveGetProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void PassiveGetProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void PassiveGetProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGetProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGetProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGetProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGetProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProducts.template.ref.hpp new file mode 100644 index 000000000..eb084d04a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGetProducts.template.ref.hpp @@ -0,0 +1,158 @@ +// ====================================================================== +// \title PassiveGetProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProducts component implementation class +// ====================================================================== + +#ifndef PassiveGetProducts_HPP +#define PassiveGetProducts_HPP + +#include "PassiveGetProductsComponentAc.hpp" + +class PassiveGetProducts : + public PassiveGetProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveGetProducts object + PassiveGetProducts( + const char* const compName //!< The component name + ); + + //! Destroy PassiveGetProducts object + ~PassiveGetProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGuardedProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGuardedProducts.template.ref.cpp new file mode 100644 index 000000000..b7c046bbe --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGuardedProducts.template.ref.cpp @@ -0,0 +1,162 @@ +// ====================================================================== +// \title PassiveGuardedProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/PassiveGuardedProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGuardedProducts :: + PassiveGuardedProducts(const char* const compName) : + PassiveGuardedProductsComponentBase(compName) +{ + +} + +PassiveGuardedProducts :: + ~PassiveGuardedProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 PassiveGuardedProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 PassiveGuardedProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void PassiveGuardedProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void PassiveGuardedProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 PassiveGuardedProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 PassiveGuardedProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void PassiveGuardedProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void PassiveGuardedProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGuardedProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGuardedProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGuardedProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveGuardedProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGuardedProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGuardedProducts.template.ref.hpp new file mode 100644 index 000000000..a2df73cca --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveGuardedProducts.template.ref.hpp @@ -0,0 +1,158 @@ +// ====================================================================== +// \title PassiveGuardedProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGuardedProducts component implementation class +// ====================================================================== + +#ifndef PassiveGuardedProducts_HPP +#define PassiveGuardedProducts_HPP + +#include "PassiveGuardedProductsComponentAc.hpp" + +class PassiveGuardedProducts : + public PassiveGuardedProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveGuardedProducts object + PassiveGuardedProducts( + const char* const compName //!< The component name + ); + + //! Destroy PassiveGuardedProducts object + ~PassiveGuardedProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveParams.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveParams.template.ref.hpp index 2b9a8ab15..49db7cfb8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveParams.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveParams.template.ref.hpp @@ -38,28 +38,28 @@ class PassiveParams : //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedGuarded //! @@ -73,7 +73,7 @@ class PassiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -87,7 +87,7 @@ class PassiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -101,7 +101,7 @@ class PassiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -115,7 +115,7 @@ class PassiveParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSerial.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSerial.template.ref.hpp index 133b59bc8..4e581830b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSerial.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSerial.template.ref.hpp @@ -38,28 +38,28 @@ class PassiveSerial : //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedGuarded //! @@ -73,7 +73,7 @@ class PassiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -87,7 +87,7 @@ class PassiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -101,7 +101,7 @@ class PassiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -115,7 +115,7 @@ class PassiveSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -129,7 +129,7 @@ class PassiveSerial : void serialGuarded_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialSync //! @@ -137,7 +137,7 @@ class PassiveSerial : void serialSync_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; PRIVATE: @@ -151,7 +151,7 @@ class PassiveSerial : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -162,7 +162,7 @@ class PassiveSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -172,7 +172,7 @@ class PassiveSerial : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -181,7 +181,7 @@ class PassiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -190,7 +190,7 @@ class PassiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -199,7 +199,7 @@ class PassiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -207,7 +207,7 @@ class PassiveSerial : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -218,7 +218,7 @@ class PassiveSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -228,7 +228,7 @@ class PassiveSerial : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -237,7 +237,7 @@ class PassiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -246,7 +246,7 @@ class PassiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -255,7 +255,7 @@ class PassiveSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProductPortsOnly.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProductPortsOnly.template.ref.cpp new file mode 100644 index 000000000..8503eea73 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProductPortsOnly.template.ref.cpp @@ -0,0 +1,25 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnly.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/PassiveSyncProductPortsOnly.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductPortsOnly :: + PassiveSyncProductPortsOnly(const char* const compName) : + PassiveSyncProductPortsOnlyComponentBase(compName) +{ + +} + +PassiveSyncProductPortsOnly :: + ~PassiveSyncProductPortsOnly() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProductPortsOnly.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProductPortsOnly.template.ref.hpp new file mode 100644 index 000000000..8ae9d6607 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProductPortsOnly.template.ref.hpp @@ -0,0 +1,32 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnly.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProductPortsOnly component implementation class +// ====================================================================== + +#ifndef PassiveSyncProductPortsOnly_HPP +#define PassiveSyncProductPortsOnly_HPP + +#include "PassiveSyncProductPortsOnlyComponentAc.hpp" + +class PassiveSyncProductPortsOnly : + public PassiveSyncProductPortsOnlyComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveSyncProductPortsOnly object + PassiveSyncProductPortsOnly( + const char* const compName //!< The component name + ); + + //! Destroy PassiveSyncProductPortsOnly object + ~PassiveSyncProductPortsOnly(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProducts.template.ref.cpp new file mode 100644 index 000000000..1228bcc0e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProducts.template.ref.cpp @@ -0,0 +1,162 @@ +// ====================================================================== +// \title PassiveSyncProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/PassiveSyncProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProducts :: + PassiveSyncProducts(const char* const compName) : + PassiveSyncProductsComponentBase(compName) +{ + +} + +PassiveSyncProducts :: + ~PassiveSyncProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void PassiveSyncProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 PassiveSyncProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 PassiveSyncProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void PassiveSyncProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void PassiveSyncProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 PassiveSyncProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 PassiveSyncProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void PassiveSyncProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void PassiveSyncProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveSyncProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveSyncProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveSyncProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveSyncProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProducts.template.ref.hpp new file mode 100644 index 000000000..cd6fb3f1e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveSyncProducts.template.ref.hpp @@ -0,0 +1,158 @@ +// ====================================================================== +// \title PassiveSyncProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProducts component implementation class +// ====================================================================== + +#ifndef PassiveSyncProducts_HPP +#define PassiveSyncProducts_HPP + +#include "PassiveSyncProductsComponentAc.hpp" + +class PassiveSyncProducts : + public PassiveSyncProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct PassiveSyncProducts object + PassiveSyncProducts( + const char* const compName //!< The component name + ); + + //! Destroy PassiveSyncProducts object + ~PassiveSyncProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTelemetry.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTelemetry.template.ref.hpp index 038d1ad70..61657e76a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTelemetry.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTelemetry.template.ref.hpp @@ -38,28 +38,28 @@ class PassiveTelemetry : //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedGuarded //! @@ -73,7 +73,7 @@ class PassiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -87,7 +87,7 @@ class PassiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -101,7 +101,7 @@ class PassiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -115,7 +115,7 @@ class PassiveTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.cpp index 3e112f761..d8babd1c7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.cpp @@ -251,3 +251,52 @@ void PassiveTest :: // TODO this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void PassiveTest :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveTest :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveTest :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveTest :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void PassiveTest :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.hpp index c770636d6..7cd4b5312 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/PassiveTest.template.ref.hpp @@ -38,28 +38,28 @@ class PassiveTest : //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedGuarded //! @@ -73,7 +73,7 @@ class PassiveTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -87,7 +87,7 @@ class PassiveTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -101,7 +101,7 @@ class PassiveTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -115,7 +115,7 @@ class PassiveTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -129,7 +129,7 @@ class PassiveTest : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -140,7 +140,7 @@ class PassiveTest : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -150,7 +150,7 @@ class PassiveTest : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -159,7 +159,7 @@ class PassiveTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -168,7 +168,7 @@ class PassiveTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -177,7 +177,7 @@ class PassiveTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -185,7 +185,7 @@ class PassiveTest : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -196,7 +196,7 @@ class PassiveTest : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -206,7 +206,7 @@ class PassiveTest : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -215,7 +215,7 @@ class PassiveTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -224,7 +224,7 @@ class PassiveTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -233,7 +233,43 @@ class PassiveTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProductPortsOnly.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProductPortsOnly.template.ref.cpp new file mode 100644 index 000000000..56d6d18c0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProductPortsOnly.template.ref.cpp @@ -0,0 +1,25 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnly.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProductPortsOnly component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/QueuedAsyncProductPortsOnly.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductPortsOnly :: + QueuedAsyncProductPortsOnly(const char* const compName) : + QueuedAsyncProductPortsOnlyComponentBase(compName) +{ + +} + +QueuedAsyncProductPortsOnly :: + ~QueuedAsyncProductPortsOnly() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProductPortsOnly.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProductPortsOnly.template.ref.hpp new file mode 100644 index 000000000..742ee86c8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProductPortsOnly.template.ref.hpp @@ -0,0 +1,32 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnly.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProductPortsOnly component implementation class +// ====================================================================== + +#ifndef QueuedAsyncProductPortsOnly_HPP +#define QueuedAsyncProductPortsOnly_HPP + +#include "QueuedAsyncProductPortsOnlyComponentAc.hpp" + +class QueuedAsyncProductPortsOnly : + public QueuedAsyncProductPortsOnlyComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedAsyncProductPortsOnly object + QueuedAsyncProductPortsOnly( + const char* const compName //!< The component name + ); + + //! Destroy QueuedAsyncProductPortsOnly object + ~QueuedAsyncProductPortsOnly(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProducts.template.ref.cpp new file mode 100644 index 000000000..88779da9a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title QueuedAsyncProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/QueuedAsyncProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProducts :: + QueuedAsyncProducts(const char* const compName) : + QueuedAsyncProductsComponentBase(compName) +{ + +} + +QueuedAsyncProducts :: + ~QueuedAsyncProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedAsyncProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedAsyncProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 QueuedAsyncProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedAsyncProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedAsyncProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedAsyncProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 QueuedAsyncProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void QueuedAsyncProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void QueuedAsyncProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedAsyncProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProducts.template.ref.hpp new file mode 100644 index 000000000..77819c4d7 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedAsyncProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title QueuedAsyncProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProducts component implementation class +// ====================================================================== + +#ifndef QueuedAsyncProducts_HPP +#define QueuedAsyncProducts_HPP + +#include "QueuedAsyncProductsComponentAc.hpp" + +class QueuedAsyncProducts : + public QueuedAsyncProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedAsyncProducts object + QueuedAsyncProducts( + const char* const compName //!< The component name + ); + + //! Destroy QueuedAsyncProducts object + ~QueuedAsyncProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedCommands.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedCommands.template.ref.hpp index 2b913f99b..379619b84 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedCommands.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedCommands.template.ref.hpp @@ -38,35 +38,35 @@ class QueuedCommands : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class QueuedCommands : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -192,7 +192,7 @@ class QueuedCommands : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -203,7 +203,7 @@ class QueuedCommands : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -213,7 +213,7 @@ class QueuedCommands : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -222,7 +222,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -231,7 +231,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -240,7 +240,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -248,7 +248,7 @@ class QueuedCommands : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -259,7 +259,7 @@ class QueuedCommands : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -269,7 +269,7 @@ class QueuedCommands : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -278,7 +278,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -287,7 +287,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -296,7 +296,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_ASYNC //! @@ -304,7 +304,7 @@ class QueuedCommands : void CMD_ASYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PRIORITY //! @@ -312,7 +312,7 @@ class QueuedCommands : void CMD_PRIORITY_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY //! @@ -321,7 +321,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; //! Handler implementation for command CMD_DROP //! @@ -329,7 +329,7 @@ class QueuedCommands : void CMD_DROP_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY_DROP //! @@ -338,7 +338,7 @@ class QueuedCommands : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedEvents.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedEvents.template.ref.hpp index eae614b18..8e2e752e3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedEvents.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedEvents.template.ref.hpp @@ -38,35 +38,35 @@ class QueuedEvents : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class QueuedEvents : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGetProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGetProducts.template.ref.cpp new file mode 100644 index 000000000..b7143ac52 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGetProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title QueuedGetProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/QueuedGetProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedGetProducts :: + QueuedGetProducts(const char* const compName) : + QueuedGetProductsComponentBase(compName) +{ + +} + +QueuedGetProducts :: + ~QueuedGetProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void QueuedGetProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedGetProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedGetProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 QueuedGetProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedGetProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedGetProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGetProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGetProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGetProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGetProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedGetProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 QueuedGetProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void QueuedGetProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void QueuedGetProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGetProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGetProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGetProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGetProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGetProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGetProducts.template.ref.hpp new file mode 100644 index 000000000..83ed764d9 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGetProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title QueuedGetProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGetProducts component implementation class +// ====================================================================== + +#ifndef QueuedGetProducts_HPP +#define QueuedGetProducts_HPP + +#include "QueuedGetProductsComponentAc.hpp" + +class QueuedGetProducts : + public QueuedGetProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedGetProducts object + QueuedGetProducts( + const char* const compName //!< The component name + ); + + //! Destroy QueuedGetProducts object + ~QueuedGetProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGuardedProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGuardedProducts.template.ref.cpp new file mode 100644 index 000000000..63efcdc0d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGuardedProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title QueuedGuardedProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/QueuedGuardedProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedGuardedProducts :: + QueuedGuardedProducts(const char* const compName) : + QueuedGuardedProductsComponentBase(compName) +{ + +} + +QueuedGuardedProducts :: + ~QueuedGuardedProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedGuardedProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedGuardedProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 QueuedGuardedProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedGuardedProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedGuardedProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedGuardedProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 QueuedGuardedProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void QueuedGuardedProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void QueuedGuardedProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedGuardedProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGuardedProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGuardedProducts.template.ref.hpp new file mode 100644 index 000000000..66caee042 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedGuardedProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title QueuedGuardedProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGuardedProducts component implementation class +// ====================================================================== + +#ifndef QueuedGuardedProducts_HPP +#define QueuedGuardedProducts_HPP + +#include "QueuedGuardedProductsComponentAc.hpp" + +class QueuedGuardedProducts : + public QueuedGuardedProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedGuardedProducts object + QueuedGuardedProducts( + const char* const compName //!< The component name + ); + + //! Destroy QueuedGuardedProducts object + ~QueuedGuardedProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedParams.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedParams.template.ref.hpp index 2005ce0c9..fa5f34929 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedParams.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedParams.template.ref.hpp @@ -38,35 +38,35 @@ class QueuedParams : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class QueuedParams : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSerial.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSerial.template.ref.hpp index 23f554942..638dc09d8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSerial.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSerial.template.ref.hpp @@ -38,35 +38,35 @@ class QueuedSerial : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class QueuedSerial : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -192,7 +192,7 @@ class QueuedSerial : void serialAsync_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialAsyncAssert //! @@ -200,7 +200,7 @@ class QueuedSerial : void serialAsyncAssert_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialAsyncBlockPriority //! @@ -208,7 +208,7 @@ class QueuedSerial : void serialAsyncBlockPriority_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialAsyncDropPriority //! @@ -216,7 +216,7 @@ class QueuedSerial : void serialAsyncDropPriority_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialGuarded //! @@ -224,7 +224,7 @@ class QueuedSerial : void serialGuarded_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; //! Handler implementation for serialSync //! @@ -232,7 +232,7 @@ class QueuedSerial : void serialSync_handler( NATIVE_INT_TYPE portNum, //!< The port number Fw::SerializeBufferBase& buffer //!< The serialization buffer - ); + ) override; PRIVATE: @@ -246,7 +246,7 @@ class QueuedSerial : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -257,7 +257,7 @@ class QueuedSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -267,7 +267,7 @@ class QueuedSerial : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -276,7 +276,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -285,7 +285,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -294,7 +294,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -302,7 +302,7 @@ class QueuedSerial : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -313,7 +313,7 @@ class QueuedSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -323,7 +323,7 @@ class QueuedSerial : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -332,7 +332,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -341,7 +341,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -350,7 +350,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_ASYNC //! @@ -358,7 +358,7 @@ class QueuedSerial : void CMD_ASYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PRIORITY //! @@ -366,7 +366,7 @@ class QueuedSerial : void CMD_PRIORITY_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY //! @@ -375,7 +375,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; //! Handler implementation for command CMD_DROP //! @@ -383,7 +383,7 @@ class QueuedSerial : void CMD_DROP_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY_DROP //! @@ -392,7 +392,7 @@ class QueuedSerial : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; PRIVATE: @@ -405,14 +405,14 @@ class QueuedSerial : //! An internal port with array params void internalArray_internalInterfaceHandler( const A& a //!< An array - ); + ) override; //! Handler implementation for internalEnum //! //! An internal port with enum params void internalEnum_internalInterfaceHandler( const E& e //!< An enum - ); + ) override; //! Handler implementation for internalPrimitive //! @@ -421,12 +421,12 @@ class QueuedSerial : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for internalPriorityDrop //! //! An internal port with priority and queue full behavior - void internalPriorityDrop_internalInterfaceHandler(); + void internalPriorityDrop_internalInterfaceHandler() override; //! Handler implementation for internalString //! @@ -434,14 +434,14 @@ class QueuedSerial : void internalString_internalInterfaceHandler( const Fw::InternalInterfaceString& str1, //!< A string const Fw::InternalInterfaceString& str2 //!< Another string - ); + ) override; //! Handler implementation for internalStruct //! //! An internal port with struct params with priority and queue full behavior void internalStruct_internalInterfaceHandler( const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSyncProducts.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSyncProducts.template.ref.cpp new file mode 100644 index 000000000..50c81b4f2 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSyncProducts.template.ref.cpp @@ -0,0 +1,228 @@ +// ====================================================================== +// \title QueuedSyncProducts.template.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component implementation class +// ====================================================================== + +#include "FpConfig.hpp" +#include "impl/QueuedSyncProducts.hpp" + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedSyncProducts :: + QueuedSyncProducts(const char* const compName) : + QueuedSyncProductsComponentBase(compName) +{ + +} + +QueuedSyncProducts :: + ~QueuedSyncProducts() +{ + +} + +// ---------------------------------------------------------------------- +// Handler implementations for user-defined typed input ports +// ---------------------------------------------------------------------- + +void QueuedSyncProducts :: + noArgsAsync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedSyncProducts :: + noArgsGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedSyncProducts :: + noArgsReturnGuarded_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +U32 QueuedSyncProducts :: + noArgsReturnSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedSyncProducts :: + noArgsSync_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +void QueuedSyncProducts :: + typedAsync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedSyncProducts :: + typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedSyncProducts :: + typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedSyncProducts :: + typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +void QueuedSyncProducts :: + typedGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedSyncProducts :: + typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +F32 QueuedSyncProducts :: + typedReturnSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} + +void QueuedSyncProducts :: + typedSync_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void QueuedSyncProducts :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedSyncProducts :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedSyncProducts :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedSyncProducts :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedSyncProducts :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSyncProducts.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSyncProducts.template.ref.hpp new file mode 100644 index 000000000..90d2157af --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedSyncProducts.template.ref.hpp @@ -0,0 +1,221 @@ +// ====================================================================== +// \title QueuedSyncProducts.template.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedSyncProducts component implementation class +// ====================================================================== + +#ifndef QueuedSyncProducts_HPP +#define QueuedSyncProducts_HPP + +#include "QueuedSyncProductsComponentAc.hpp" + +class QueuedSyncProducts : + public QueuedSyncProductsComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct QueuedSyncProducts object + QueuedSyncProducts( + const char* const compName //!< The component name + ); + + //! Destroy QueuedSyncProducts object + ~QueuedSyncProducts(); + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsAsync + //! + //! A typed async input port + void noArgsAsync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsGuarded + //! + //! A typed guarded input + void noArgsGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnGuarded + //! + //! A typed guarded input + U32 noArgsReturnGuarded_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsReturnSync + //! + //! A typed sync input port + U32 noArgsReturnSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for noArgsSync + //! + //! A typed sync input port + void noArgsSync_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) override; + + //! Handler implementation for typedAsync + //! + //! A typed async input port + void typedAsync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncAssert + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncAssert_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncBlockPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncBlockPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedAsyncDropPriority + //! + //! A typed async input port with queue full behavior and priority + void typedAsyncDropPriority_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedGuarded + //! + //! A typed guarded input + void typedGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnGuarded + //! + //! A typed guarded input with a return type + F32 typedReturnGuarded_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedReturnSync + //! + //! A typed sync input port with a return type + F32 typedReturnSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + //! Handler implementation for typedSync + //! + //! A typed sync input port + void typedSync_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTelemetry.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTelemetry.template.ref.hpp index ca748bb14..06e6f1408 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTelemetry.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTelemetry.template.ref.hpp @@ -38,35 +38,35 @@ class QueuedTelemetry : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class QueuedTelemetry : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.cpp index 283f60321..330890200 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.cpp @@ -416,3 +416,52 @@ void QueuedTest :: { // TODO } + +// ---------------------------------------------------------------------- +// Handler implementations for data products +// ---------------------------------------------------------------------- + +void QueuedTest :: + dpRecv_Container1_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedTest :: + dpRecv_Container2_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedTest :: + dpRecv_Container3_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedTest :: + dpRecv_Container4_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} + +void QueuedTest :: + dpRecv_Container5_handler( + DpContainer& container, + Fw::Success::T status + ) +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.hpp index 9576a2b44..29bc8d760 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/impl/QueuedTest.template.ref.hpp @@ -38,35 +38,35 @@ class QueuedTest : //! A typed async input port void noArgsAsync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsGuarded //! //! A typed guarded input void noArgsGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnGuarded //! //! A typed guarded input U32 noArgsReturnGuarded_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsReturnSync //! //! A typed sync input port U32 noArgsReturnSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for noArgsSync //! //! A typed sync input port void noArgsSync_handler( NATIVE_INT_TYPE portNum //!< The port number - ); + ) override; //! Handler implementation for typedAsync //! @@ -80,7 +80,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncAssert //! @@ -94,7 +94,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncBlockPriority //! @@ -108,7 +108,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedAsyncDropPriority //! @@ -122,7 +122,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedGuarded //! @@ -136,7 +136,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnGuarded //! @@ -150,7 +150,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedReturnSync //! @@ -164,7 +164,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; //! Handler implementation for typedSync //! @@ -178,7 +178,7 @@ class QueuedTest : const E& e, //!< An enum const A& a, //!< An array const S& s //!< A struct - ); + ) override; PRIVATE: @@ -192,7 +192,7 @@ class QueuedTest : void CMD_SYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_SYNC_PRIMITIVE //! @@ -203,7 +203,7 @@ class QueuedTest : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_SYNC_STRING //! @@ -213,7 +213,7 @@ class QueuedTest : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_SYNC_ENUM //! @@ -222,7 +222,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_SYNC_ARRAY //! @@ -231,7 +231,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_SYNC_STRUCT //! @@ -240,7 +240,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_GUARDED //! @@ -248,7 +248,7 @@ class QueuedTest : void CMD_GUARDED_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_GUARDED_PRIMITIVE //! @@ -259,7 +259,7 @@ class QueuedTest : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRING //! @@ -269,7 +269,7 @@ class QueuedTest : U32 cmdSeq, //!< The command sequence number const Fw::CmdStringArg& str1, //!< A string const Fw::CmdStringArg& str2 //!< Another string - ); + ) override; //! Handler implementation for command CMD_GUARDED_ENUM //! @@ -278,7 +278,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number E e //!< An enum - ); + ) override; //! Handler implementation for command CMD_GUARDED_ARRAY //! @@ -287,7 +287,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number A a //!< An array - ); + ) override; //! Handler implementation for command CMD_GUARDED_STRUCT //! @@ -296,7 +296,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number S s //!< A struct - ); + ) override; //! Handler implementation for command CMD_ASYNC //! @@ -304,7 +304,7 @@ class QueuedTest : void CMD_ASYNC_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PRIORITY //! @@ -312,7 +312,7 @@ class QueuedTest : void CMD_PRIORITY_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY //! @@ -321,7 +321,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; //! Handler implementation for command CMD_DROP //! @@ -329,7 +329,7 @@ class QueuedTest : void CMD_DROP_cmdHandler( FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number - ); + ) override; //! Handler implementation for command CMD_PARAMS_PRIORITY_DROP //! @@ -338,7 +338,7 @@ class QueuedTest : FwOpcodeType opCode, //!< The opcode U32 cmdSeq, //!< The command sequence number U32 u32 - ); + ) override; PRIVATE: @@ -351,14 +351,14 @@ class QueuedTest : //! An internal port with array params void internalArray_internalInterfaceHandler( const A& a //!< An array - ); + ) override; //! Handler implementation for internalEnum //! //! An internal port with enum params void internalEnum_internalInterfaceHandler( const E& e //!< An enum - ); + ) override; //! Handler implementation for internalPrimitive //! @@ -367,12 +367,12 @@ class QueuedTest : U32 u32, //!< A U32 F32 f32, //!< An F32 bool b //!< A boolean - ); + ) override; //! Handler implementation for internalPriorityDrop //! //! An internal port with priority and queue full behavior - void internalPriorityDrop_internalInterfaceHandler(); + void internalPriorityDrop_internalInterfaceHandler() override; //! Handler implementation for internalString //! @@ -380,14 +380,50 @@ class QueuedTest : void internalString_internalInterfaceHandler( const Fw::InternalInterfaceString& str1, //!< A string const Fw::InternalInterfaceString& str2 //!< Another string - ); + ) override; //! Handler implementation for internalStruct //! //! An internal port with struct params with priority and queue full behavior void internalStruct_internalInterfaceHandler( const S& s //!< A struct - ); + ) override; + + PRIVATE: + + // ---------------------------------------------------------------------- + // Handler implementations for data products + // ---------------------------------------------------------------------- + + //! Receive a container of type Container1 + void dpRecv_Container1_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container2 + void dpRecv_Container2_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container3 + void dpRecv_Container3_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container4 + void dpRecv_Container4_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; + + //! Receive a container of type Container5 + void dpRecv_Container5_handler( + DpContainer& container, //!< The container + Fw::Success::T status //!< The container status + ) override; }; diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/run.sh b/compiler/tools/fpp-to-cpp/test/component/impl/run.sh index 50f55e77c..63da15b1c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/run.sh +++ b/compiler/tools/fpp-to-cpp/test/component/impl/run.sh @@ -10,32 +10,47 @@ empty() passive() { run_test "-t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive && \ - diff_template PassiveTest && \ - diff_template PassiveSerial && \ diff_template PassiveCommands && \ diff_template PassiveEvents && \ + diff_template PassiveGetProductPortsOnly && \ + diff_template PassiveGetProducts && \ + diff_template PassiveGuardedProducts && \ + diff_template PassiveParams && \ + diff_template PassiveSerial && \ + diff_template PassiveSyncProductPortsOnly && \ + diff_template PassiveSyncProducts && \ diff_template PassiveTelemetry && \ - diff_template PassiveParams + diff_template PassiveTest } active() { run_test "-t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active && \ - diff_template ActiveTest && \ - diff_template ActiveSerial && \ + diff_template ActiveAsyncProductPortsOnly && \ + diff_template ActiveAsyncProducts && \ diff_template ActiveCommands && \ diff_template ActiveEvents && \ + diff_template ActiveGetProducts && \ + diff_template ActiveGuardedProducts && \ + diff_template ActiveParams && \ + diff_template ActiveSerial && \ + diff_template ActiveSyncProducts && \ diff_template ActiveTelemetry && \ - diff_template ActiveParams + diff_template ActiveTest } queued() { run_test "-t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued && \ - diff_template QueuedTest && \ - diff_template QueuedSerial && \ + diff_template QueuedAsyncProductPortsOnly && \ + diff_template QueuedAsyncProducts && \ diff_template QueuedCommands && \ diff_template QueuedEvents && \ + diff_template QueuedGetProducts && \ + diff_template QueuedGuardedProducts && \ + diff_template QueuedParams && \ + diff_template QueuedSerial && \ + diff_template QueuedSyncProducts && \ diff_template QueuedTelemetry && \ - diff_template QueuedParams + diff_template QueuedTest } diff --git a/compiler/tools/fpp-to-cpp/test/component/impl/update-ref.sh b/compiler/tools/fpp-to-cpp/test/component/impl/update-ref.sh index c838812b9..5e2f3b868 100644 --- a/compiler/tools/fpp-to-cpp/test/component/impl/update-ref.sh +++ b/compiler/tools/fpp-to-cpp/test/component/impl/update-ref.sh @@ -10,32 +10,47 @@ empty() passive() { update "-t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive - move_template PassiveTest - move_template PassiveSerial move_template PassiveCommands move_template PassiveEvents - move_template PassiveTelemetry + move_template PassiveGetProductPortsOnly + move_template PassiveGetProducts + move_template PassiveGuardedProducts move_template PassiveParams + move_template PassiveSerial + move_template PassiveSyncProductPortsOnly + move_template PassiveSyncProducts + move_template PassiveTelemetry + move_template PassiveTest } active() { update "-t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active - move_template ActiveTest - move_template ActiveSerial + move_template ActiveAsyncProductPortsOnly + move_template ActiveAsyncProducts move_template ActiveCommands move_template ActiveEvents - move_template ActiveTelemetry + move_template ActiveGetProducts + move_template ActiveGuardedProducts move_template ActiveParams + move_template ActiveSerial + move_template ActiveSyncProducts + move_template ActiveTelemetry + move_template ActiveTest } queued() { update "-t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued - move_template QueuedTest - move_template QueuedSerial + move_template QueuedAsyncProductPortsOnly + move_template QueuedAsyncProducts move_template QueuedCommands move_template QueuedEvents - move_template QueuedTelemetry + move_template QueuedGetProducts + move_template QueuedGuardedProducts move_template QueuedParams + move_template QueuedSerial + move_template QueuedSyncProducts + move_template QueuedTelemetry + move_template QueuedTest } diff --git a/compiler/tools/fpp-to-cpp/test/component/include/product_containers.fppi b/compiler/tools/fpp-to-cpp/test/component/include/product_containers.fppi new file mode 100644 index 000000000..951aa1a52 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/product_containers.fppi @@ -0,0 +1,2 @@ +@ Container 1 +product container Container1 id 100 default priority 10 diff --git a/compiler/tools/fpp-to-cpp/test/component/include/product_ports_async.fppi b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_async.fppi new file mode 100644 index 000000000..c4a98dc93 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_async.fppi @@ -0,0 +1,12 @@ +# ---------------------------------------------------------------------- +# Data product ports (async receive) +# ---------------------------------------------------------------------- + +@ Data product request port +product request port productRequestOut + +@ Data product receive port +async product recv port productRecvIn + +@ Data product send port +product send port productSendOut diff --git a/compiler/tools/fpp-to-cpp/test/component/include/product_ports_get.fppi b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_get.fppi new file mode 100644 index 000000000..d3e81827e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_get.fppi @@ -0,0 +1,9 @@ +# ---------------------------------------------------------------------- +# Data product ports (get) +# ---------------------------------------------------------------------- + +@ Data product get port +product get port productGetOut + +@ Data product send port +product send port productSendOut diff --git a/compiler/tools/fpp-to-cpp/test/component/include/product_ports_guarded.fppi b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_guarded.fppi new file mode 100644 index 000000000..6d548c2e6 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_guarded.fppi @@ -0,0 +1,12 @@ +# ---------------------------------------------------------------------- +# Data product ports (sync receive) +# ---------------------------------------------------------------------- + +@ Data product request port +product request port productRequestOut + +@ Data product receive port +guarded product recv port productRecvIn + +@ Data product send port +product send port productSendOut diff --git a/compiler/tools/fpp-to-cpp/test/component/include/product_ports_sync.fppi b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_sync.fppi new file mode 100644 index 000000000..d4f416217 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/product_ports_sync.fppi @@ -0,0 +1,12 @@ +# ---------------------------------------------------------------------- +# Data product ports (sync receive) +# ---------------------------------------------------------------------- + +@ Data product request port +product request port productRequestOut + +@ Data product receive port +sync product recv port productRecvIn + +@ Data product send port +product send port productSendOut diff --git a/compiler/tools/fpp-to-cpp/test/component/include/product_records.fppi b/compiler/tools/fpp-to-cpp/test/component/include/product_records.fppi new file mode 100644 index 000000000..285491feb --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/product_records.fppi @@ -0,0 +1,6 @@ +# ---------------------------------------------------------------------- +# Records +# ---------------------------------------------------------------------- + +@ Record 1 +product record U32Record: U32 id 100 diff --git a/compiler/tools/fpp-to-cpp/test/component/include/products.fppi b/compiler/tools/fpp-to-cpp/test/component/include/products.fppi new file mode 100644 index 000000000..5dcb43819 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/products.fppi @@ -0,0 +1,47 @@ +# ---------------------------------------------------------------------- +# Constants and types +# ---------------------------------------------------------------------- + +@ Data for a DataRecord +struct Data { + @ A U16 field + u16Field: U16 +} + +# ---------------------------------------------------------------------- +# Records +# ---------------------------------------------------------------------- + +@ Record 1 +product record U32Record: U32 id 100 + +@ Record 2 +product record DataRecord: Data id 200 + +@ Record 3 +product record U8ArrayRecord: U8 array id 300 + +@ Record 4 +product record U32ArrayRecord: U32 array id 400 + +@ Record 5 +product record DataArrayRecord: Data array id 500 + +# ---------------------------------------------------------------------- +# Containers +# ---------------------------------------------------------------------- + +@ Container 1 +product container Container1 id 100 default priority 10 + +@ Container 2 +product container Container2 id 200 default priority 20 + +@ Container 3 +product container Container3 id 300 + +@ Container 4 +product container Container4 id 400 + +@ Container 5 +product container Container5 id 500 diff --git a/compiler/tools/fpp-to-cpp/test/component/include/time_ports.fppi b/compiler/tools/fpp-to-cpp/test/component/include/time_ports.fppi new file mode 100644 index 000000000..0bae36a99 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/include/time_ports.fppi @@ -0,0 +1,6 @@ +# ---------------------------------------------------------------------- +# Time ports +# ---------------------------------------------------------------------- + +@ A port for getting the time +time get port timeGetOut diff --git a/compiler/tools/fpp-to-cpp/test/component/passive.fpp b/compiler/tools/fpp-to-cpp/test/component/passive.fpp index 4c5a15c9c..a3f305cd1 100644 --- a/compiler/tools/fpp-to-cpp/test/component/passive.fpp +++ b/compiler/tools/fpp-to-cpp/test/component/passive.fpp @@ -1,13 +1,15 @@ @ A passive component passive component PassiveTest { + include "include/product_ports_sync.fppi" include "include/typed_ports.fppi" include "include/special_ports.fppi" include "include/commands.fppi" include "include/events.fppi" - include "include/telemetry.fppi" include "include/params.fppi" + include "include/products.fppi" + include "include/telemetry.fppi" } @@ -25,7 +27,7 @@ passive component PassiveSerial { } -@ An passive component with commands +@ A passive component with commands passive component PassiveCommands { include "include/typed_ports.fppi" @@ -35,7 +37,7 @@ passive component PassiveCommands { } -@ An passive component with events +@ A passive component with events passive component PassiveEvents { include "include/typed_ports.fppi" @@ -45,7 +47,7 @@ passive component PassiveEvents { } -@ An passive component with telemetry +@ A passive component with telemetry passive component PassiveTelemetry { include "include/typed_ports.fppi" @@ -55,7 +57,7 @@ passive component PassiveTelemetry { } -@ An passive component with params +@ A passive component with params passive component PassiveParams { include "include/typed_ports.fppi" @@ -64,3 +66,50 @@ passive component PassiveParams { include "include/params.fppi" } + +@ A passive component with sync data products +passive component PassiveSyncProducts { + + include "include/product_ports_sync.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + + include "include/products.fppi" + +} + +@ A passive component with guarded data products +passive component PassiveGuardedProducts { + + include "include/product_ports_guarded.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + + include "include/products.fppi" + +} + +@ A passive component with data product get +passive component PassiveGetProducts { + + include "include/product_ports_get.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + + include "include/products.fppi" + +} + +@ A passive component with product get and ports only +passive component PassiveGetProductPortsOnly { + + include "include/product_ports_get.fppi" + +} + +@ A passive component with sync product request and ports only +passive component PassiveSyncProductPortsOnly { + + include "include/product_ports_sync.fppi" + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/queued.fpp b/compiler/tools/fpp-to-cpp/test/component/queued.fpp index 589da9f38..8076b26d6 100644 --- a/compiler/tools/fpp-to-cpp/test/component/queued.fpp +++ b/compiler/tools/fpp-to-cpp/test/component/queued.fpp @@ -1,6 +1,7 @@ @ A queued component queued component QueuedTest { + include "include/product_ports_async.fppi" include "include/typed_ports.fppi" include "include/typed_ports_async.fppi" include "include/special_ports.fppi" @@ -9,6 +10,7 @@ queued component QueuedTest { include "include/commands.fppi" include "include/commands_async.fppi" include "include/events.fppi" + include "include/products.fppi" include "include/telemetry.fppi" include "include/params.fppi" @@ -76,3 +78,58 @@ queued component QueuedParams { include "include/params.fppi" } + +@ A queued component with async data products +active component QueuedAsyncProducts { + + include "include/product_ports_async.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ A queued component with sync data products +active component QueuedSyncProducts { + + include "include/product_ports_sync.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ A queued component with guarded data products +active component QueuedGuardedProducts { + + include "include/product_ports_guarded.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ A queued component with data product get +active component QueuedGetProducts { + + include "include/product_ports_get.fppi" + include "include/special_ports.fppi" + include "include/typed_ports.fppi" + include "include/typed_ports_async.fppi" + + include "include/products.fppi" + +} + +@ An queued component with async product request and ports only +queued component QueuedAsyncProductPortsOnly { + + include "include/product_ports_async.fppi" + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyGTestBase.ref.cpp new file mode 100644 index 000000000..eefe8c10f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyGTestBase.ref.cpp @@ -0,0 +1,27 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component Google Test harness base class +// ====================================================================== + +#include "test-base/ActiveAsyncProductPortsOnlyGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductPortsOnlyGTestBase :: + ActiveAsyncProductPortsOnlyGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + ActiveAsyncProductPortsOnlyTesterBase(compName, maxHistorySize) +{ + +} + +ActiveAsyncProductPortsOnlyGTestBase :: + ~ActiveAsyncProductPortsOnlyGTestBase() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyGTestBase.ref.hpp new file mode 100644 index 000000000..80ac287b8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyGTestBase.ref.hpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProductPortsOnly component Google Test harness base class +// ====================================================================== + +#ifndef ActiveAsyncProductPortsOnlyGTestBase_HPP +#define ActiveAsyncProductPortsOnlyGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/ActiveAsyncProductPortsOnlyTesterBase.hpp" + +//! \class ActiveAsyncProductPortsOnlyGTestBase +//! \brief Auto-generated base for ActiveAsyncProductPortsOnly component Google Test harness +class ActiveAsyncProductPortsOnlyGTestBase : + public ActiveAsyncProductPortsOnlyTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveAsyncProductPortsOnlyGTestBase + ActiveAsyncProductPortsOnlyGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveAsyncProductPortsOnlyGTestBase + ~ActiveAsyncProductPortsOnlyGTestBase(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyTesterBase.ref.cpp new file mode 100644 index 000000000..fe7254c6f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyTesterBase.ref.cpp @@ -0,0 +1,122 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/ActiveAsyncProductPortsOnlyTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputDpRequestPort* ActiveAsyncProductPortsOnlyTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* ActiveAsyncProductPortsOnlyTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductPortsOnlyTesterBase :: + ActiveAsyncProductPortsOnlyTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + +} + +ActiveAsyncProductPortsOnlyTesterBase :: + ~ActiveAsyncProductPortsOnlyTesterBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductPortsOnlyTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE ActiveAsyncProductPortsOnlyTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductPortsOnlyTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool ActiveAsyncProductPortsOnlyTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyTesterBase.ref.hpp new file mode 100644 index 000000000..9771df3c5 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductPortsOnlyTesterBase.ref.hpp @@ -0,0 +1,138 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProductPortsOnly component test harness base class +// ====================================================================== + +#ifndef ActiveAsyncProductPortsOnlyTesterBase_HPP +#define ActiveAsyncProductPortsOnlyTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/ActiveAsyncProductPortsOnlyComponentAc.hpp" + +//! \class ActiveAsyncProductPortsOnlyTesterBase +//! \brief Auto-generated base for ActiveAsyncProductPortsOnly component test harness +class ActiveAsyncProductPortsOnlyTesterBase : + public Fw::PassiveComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object ActiveAsyncProductPortsOnlyTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveAsyncProductPortsOnlyTesterBase + ActiveAsyncProductPortsOnlyTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveAsyncProductPortsOnlyTesterBase + virtual ~ActiveAsyncProductPortsOnlyTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsGTestBase.ref.cpp new file mode 100644 index 000000000..ea69dc71a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title ActiveAsyncProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/ActiveAsyncProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductsGTestBase :: + ActiveAsyncProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + ActiveAsyncProductsTesterBase(compName, maxHistorySize) +{ + +} + +ActiveAsyncProductsGTestBase :: + ~ActiveAsyncProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void ActiveAsyncProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void ActiveAsyncProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void ActiveAsyncProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void ActiveAsyncProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void ActiveAsyncProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void ActiveAsyncProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsGTestBase.ref.hpp new file mode 100644 index 000000000..a2a89a64c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title ActiveAsyncProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProducts component Google Test harness base class +// ====================================================================== + +#ifndef ActiveAsyncProductsGTestBase_HPP +#define ActiveAsyncProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/ActiveAsyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class ActiveAsyncProductsGTestBase +//! \brief Auto-generated base for ActiveAsyncProducts component Google Test harness +class ActiveAsyncProductsGTestBase : + public ActiveAsyncProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveAsyncProductsGTestBase + ActiveAsyncProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveAsyncProductsGTestBase + ~ActiveAsyncProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsTesterBase.ref.cpp new file mode 100644 index 000000000..d32bf463a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsTesterBase.ref.cpp @@ -0,0 +1,1890 @@ +// ====================================================================== +// \title ActiveAsyncProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/ActiveAsyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void ActiveAsyncProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* ActiveAsyncProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* ActiveAsyncProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* ActiveAsyncProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* ActiveAsyncProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* ActiveAsyncProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* ActiveAsyncProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* ActiveAsyncProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* ActiveAsyncProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* ActiveAsyncProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* ActiveAsyncProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* ActiveAsyncProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveAsyncProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* ActiveAsyncProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* ActiveAsyncProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductsTesterBase :: + ActiveAsyncProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +ActiveAsyncProductsTesterBase :: + ~ActiveAsyncProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 ActiveAsyncProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void ActiveAsyncProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 ActiveAsyncProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 ActiveAsyncProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveAsyncProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE ActiveAsyncProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool ActiveAsyncProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void ActiveAsyncProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void ActiveAsyncProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void ActiveAsyncProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void ActiveAsyncProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void ActiveAsyncProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void ActiveAsyncProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void ActiveAsyncProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void ActiveAsyncProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void ActiveAsyncProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void ActiveAsyncProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void ActiveAsyncProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void ActiveAsyncProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 ActiveAsyncProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void ActiveAsyncProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveAsyncProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveAsyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsTesterBase.ref.hpp new file mode 100644 index 000000000..295893e2f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveAsyncProductsTesterBase.ref.hpp @@ -0,0 +1,1149 @@ +// ====================================================================== +// \title ActiveAsyncProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProducts component test harness base class +// ====================================================================== + +#ifndef ActiveAsyncProductsTesterBase_HPP +#define ActiveAsyncProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/ActiveAsyncProductsComponentAc.hpp" + +//! \class ActiveAsyncProductsTesterBase +//! \brief Auto-generated base for ActiveAsyncProducts component test harness +class ActiveAsyncProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object ActiveAsyncProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveAsyncProductsTesterBase + ActiveAsyncProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveAsyncProductsTesterBase + virtual ~ActiveAsyncProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsGTestBase.ref.cpp new file mode 100644 index 000000000..b97bbb851 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title ActiveGetProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/ActiveGetProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveGetProductsGTestBase :: + ActiveGetProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + ActiveGetProductsTesterBase(compName, maxHistorySize) +{ + +} + +ActiveGetProductsGTestBase :: + ~ActiveGetProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void ActiveGetProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void ActiveGetProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void ActiveGetProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void ActiveGetProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Get +// ---------------------------------------------------------------------- + +void ActiveGetProductsGTestBase :: + assertProductGet_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productGetHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product get history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productGetHistory->size() << "\n"; +} + +void ActiveGetProductsGTestBase :: + assertProductGet( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productGetHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product get history\n" + << " Expected: Less than size of product get history (" + << this->productGetHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpGet& e = this->productGetHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product get history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product get history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void ActiveGetProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void ActiveGetProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsGTestBase.ref.hpp new file mode 100644 index 000000000..271e942ce --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title ActiveGetProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGetProducts component Google Test harness base class +// ====================================================================== + +#ifndef ActiveGetProductsGTestBase_HPP +#define ActiveGetProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/ActiveGetProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product get assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_GET_SIZE(size) \ + this->assertProductGet_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_GET(index, id, size) \ + this->assertProductGet(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class ActiveGetProductsGTestBase +//! \brief Auto-generated base for ActiveGetProducts component Google Test harness +class ActiveGetProductsGTestBase : + public ActiveGetProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveGetProductsGTestBase + ActiveGetProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveGetProductsGTestBase + ~ActiveGetProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Get + // ---------------------------------------------------------------------- + + //! Assert size of product get history + void assertProductGet_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product get history at index + void assertProductGet( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsTesterBase.ref.cpp new file mode 100644 index 000000000..7ecf6271f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsTesterBase.ref.cpp @@ -0,0 +1,1828 @@ +// ====================================================================== +// \title ActiveGetProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/ActiveGetProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productGetOut()); + port++ + ) { + this->m_from_productGetOut[port].init(); + this->m_from_productGetOut[port].addCallComp( + this, + from_productGetOut_static + ); + this->m_from_productGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productGetOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void ActiveGetProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* ActiveGetProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* ActiveGetProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* ActiveGetProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* ActiveGetProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* ActiveGetProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpGetPort* ActiveGetProductsTesterBase :: + get_from_productGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productGetOut(), + static_cast(portNum) + ); + + return &this->m_from_productGetOut[portNum]; +} + +Fw::InputDpSendPort* ActiveGetProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* ActiveGetProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* ActiveGetProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* ActiveGetProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* ActiveGetProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveGetProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* ActiveGetProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* ActiveGetProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveGetProductsTesterBase :: + ActiveGetProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productGetHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +ActiveGetProductsTesterBase :: + ~ActiveGetProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 ActiveGetProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void ActiveGetProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGetProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void ActiveGetProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 ActiveGetProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 ActiveGetProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void ActiveGetProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void ActiveGetProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGetProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGetProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveGetProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveGetProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_productGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productGetOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE ActiveGetProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool ActiveGetProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool ActiveGetProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + pushProductGetEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpGet e = { id, size }; + this->productGetHistory->push_back(e); +} + +Fw::Success::T ActiveGetProductsTesterBase :: + productGet_handler( + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + (void) buffer; + this->pushProductGetEntry(id, size); + return Fw::Success::FAILURE; +} + +void ActiveGetProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void ActiveGetProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void ActiveGetProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productGetHistory->clear(); + this->productSendHistory->clear(); +} + +void ActiveGetProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void ActiveGetProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void ActiveGetProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void ActiveGetProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void ActiveGetProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +Fw::Success ActiveGetProductsTesterBase :: + from_productGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->productGet_handler(id, size, buffer); +} + +void ActiveGetProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void ActiveGetProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void ActiveGetProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 ActiveGetProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void ActiveGetProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGetProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsTesterBase.ref.hpp new file mode 100644 index 000000000..a7289591f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGetProductsTesterBase.ref.hpp @@ -0,0 +1,1124 @@ +// ====================================================================== +// \title ActiveGetProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGetProducts component test harness base class +// ====================================================================== + +#ifndef ActiveGetProductsTesterBase_HPP +#define ActiveGetProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/ActiveGetProductsComponentAc.hpp" + +//! \class ActiveGetProductsTesterBase +//! \brief Auto-generated base for ActiveGetProducts component test harness +class ActiveGetProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product get + struct DpGet { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object ActiveGetProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productGetOut[portNum] + Fw::InputDpGetPort* get_from_productGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveGetProductsTesterBase + ActiveGetProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveGetProductsTesterBase + virtual ~ActiveGetProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productGetOut ports + //! + //! \return The number of from_productGetOut ports + NATIVE_INT_TYPE getNum_from_productGetOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product get history + void pushProductGetEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product get from the component under test + //! + //! By default, (1) call pushProductGetEntry; (2) do not allocate a buffer + //! and return FAILURE. You can override this behavior, e.g., to call + //! pushProductGetEntry, allocate a buffer and return SUCCESS. + virtual Fw::Success::T productGet_handler( + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productGetOut + static Fw::Success from_productGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product get history + History* productGetHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productGetOut + Fw::InputDpGetPort m_from_productGetOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsGTestBase.ref.cpp new file mode 100644 index 000000000..e682561b4 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title ActiveGuardedProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/ActiveGuardedProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveGuardedProductsGTestBase :: + ActiveGuardedProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + ActiveGuardedProductsTesterBase(compName, maxHistorySize) +{ + +} + +ActiveGuardedProductsGTestBase :: + ~ActiveGuardedProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void ActiveGuardedProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void ActiveGuardedProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void ActiveGuardedProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void ActiveGuardedProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void ActiveGuardedProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void ActiveGuardedProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsGTestBase.ref.hpp new file mode 100644 index 000000000..dc2c40d60 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title ActiveGuardedProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGuardedProducts component Google Test harness base class +// ====================================================================== + +#ifndef ActiveGuardedProductsGTestBase_HPP +#define ActiveGuardedProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/ActiveGuardedProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class ActiveGuardedProductsGTestBase +//! \brief Auto-generated base for ActiveGuardedProducts component Google Test harness +class ActiveGuardedProductsGTestBase : + public ActiveGuardedProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveGuardedProductsGTestBase + ActiveGuardedProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveGuardedProductsGTestBase + ~ActiveGuardedProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsTesterBase.ref.cpp new file mode 100644 index 000000000..96447d497 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsTesterBase.ref.cpp @@ -0,0 +1,1890 @@ +// ====================================================================== +// \title ActiveGuardedProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/ActiveGuardedProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void ActiveGuardedProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* ActiveGuardedProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* ActiveGuardedProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* ActiveGuardedProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* ActiveGuardedProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* ActiveGuardedProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* ActiveGuardedProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* ActiveGuardedProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* ActiveGuardedProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* ActiveGuardedProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* ActiveGuardedProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* ActiveGuardedProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveGuardedProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* ActiveGuardedProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* ActiveGuardedProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveGuardedProductsTesterBase :: + ActiveGuardedProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +ActiveGuardedProductsTesterBase :: + ~ActiveGuardedProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 ActiveGuardedProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void ActiveGuardedProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 ActiveGuardedProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 ActiveGuardedProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveGuardedProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE ActiveGuardedProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool ActiveGuardedProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void ActiveGuardedProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void ActiveGuardedProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void ActiveGuardedProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void ActiveGuardedProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void ActiveGuardedProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void ActiveGuardedProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void ActiveGuardedProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void ActiveGuardedProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void ActiveGuardedProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void ActiveGuardedProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void ActiveGuardedProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void ActiveGuardedProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 ActiveGuardedProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void ActiveGuardedProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveGuardedProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsTesterBase.ref.hpp new file mode 100644 index 000000000..45dac5078 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveGuardedProductsTesterBase.ref.hpp @@ -0,0 +1,1149 @@ +// ====================================================================== +// \title ActiveGuardedProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGuardedProducts component test harness base class +// ====================================================================== + +#ifndef ActiveGuardedProductsTesterBase_HPP +#define ActiveGuardedProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/ActiveGuardedProductsComponentAc.hpp" + +//! \class ActiveGuardedProductsTesterBase +//! \brief Auto-generated base for ActiveGuardedProducts component test harness +class ActiveGuardedProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object ActiveGuardedProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveGuardedProductsTesterBase + ActiveGuardedProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveGuardedProductsTesterBase + virtual ~ActiveGuardedProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsGTestBase.ref.cpp new file mode 100644 index 000000000..badb232c8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title ActiveSyncProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/ActiveSyncProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveSyncProductsGTestBase :: + ActiveSyncProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + ActiveSyncProductsTesterBase(compName, maxHistorySize) +{ + +} + +ActiveSyncProductsGTestBase :: + ~ActiveSyncProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void ActiveSyncProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void ActiveSyncProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void ActiveSyncProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void ActiveSyncProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void ActiveSyncProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void ActiveSyncProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void ActiveSyncProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void ActiveSyncProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsGTestBase.ref.hpp new file mode 100644 index 000000000..0b2f1c17c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title ActiveSyncProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveSyncProducts component Google Test harness base class +// ====================================================================== + +#ifndef ActiveSyncProductsGTestBase_HPP +#define ActiveSyncProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/ActiveSyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class ActiveSyncProductsGTestBase +//! \brief Auto-generated base for ActiveSyncProducts component Google Test harness +class ActiveSyncProductsGTestBase : + public ActiveSyncProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveSyncProductsGTestBase + ActiveSyncProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveSyncProductsGTestBase + ~ActiveSyncProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsTesterBase.ref.cpp new file mode 100644 index 000000000..4fc566993 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsTesterBase.ref.cpp @@ -0,0 +1,1890 @@ +// ====================================================================== +// \title ActiveSyncProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/ActiveSyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void ActiveSyncProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* ActiveSyncProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* ActiveSyncProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* ActiveSyncProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* ActiveSyncProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* ActiveSyncProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* ActiveSyncProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* ActiveSyncProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* ActiveSyncProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* ActiveSyncProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* ActiveSyncProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* ActiveSyncProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* ActiveSyncProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* ActiveSyncProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* ActiveSyncProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ActiveSyncProductsTesterBase :: + ActiveSyncProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +ActiveSyncProductsTesterBase :: + ~ActiveSyncProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 ActiveSyncProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void ActiveSyncProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveSyncProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 ActiveSyncProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 ActiveSyncProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveSyncProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 ActiveSyncProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void ActiveSyncProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE ActiveSyncProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool ActiveSyncProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool ActiveSyncProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void ActiveSyncProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void ActiveSyncProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void ActiveSyncProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void ActiveSyncProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void ActiveSyncProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void ActiveSyncProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void ActiveSyncProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void ActiveSyncProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void ActiveSyncProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void ActiveSyncProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void ActiveSyncProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void ActiveSyncProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 ActiveSyncProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void ActiveSyncProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 ActiveSyncProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + ActiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsTesterBase.ref.hpp new file mode 100644 index 000000000..b4ece2925 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveSyncProductsTesterBase.ref.hpp @@ -0,0 +1,1149 @@ +// ====================================================================== +// \title ActiveSyncProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveSyncProducts component test harness base class +// ====================================================================== + +#ifndef ActiveSyncProductsTesterBase_HPP +#define ActiveSyncProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/ActiveSyncProductsComponentAc.hpp" + +//! \class ActiveSyncProductsTesterBase +//! \brief Auto-generated base for ActiveSyncProducts component test harness +class ActiveSyncProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object ActiveSyncProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveSyncProductsTesterBase + ActiveSyncProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object ActiveSyncProductsTesterBase + virtual ~ActiveSyncProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.cpp index 9911e97ab..1d6c95409 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.cpp @@ -937,4 +937,124 @@ namespace M { << " Actual: " << _e.arg << "\n"; } + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + void ActiveTestGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const + { + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; + } + + void ActiveTestGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const + { + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; + } + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + void ActiveTestGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const + { + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; + } + + void ActiveTestGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const + { + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); + } + } diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.hpp index a3d7690d6..a43e3ccdf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestGTestBase.ref.hpp @@ -319,6 +319,26 @@ #define ASSERT_TLM_ChannelEnumOnChange(index, value) \ this->assertTlm_ChannelEnumOnChange(__FILE__, __LINE__, index, value) +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + namespace M { //! \class ActiveTestGTestBase @@ -689,6 +709,59 @@ namespace M { const E& val //!< The channel value ) const; + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + }; } diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.cpp index 956d848d4..dc4ed624e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.cpp @@ -151,6 +151,58 @@ namespace M { #endif } + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + #if FW_ENABLE_TEXT_LOGGING == 1 // Connect input port textEventOut for ( @@ -356,6 +408,27 @@ namespace M { #endif } + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + // Connect output port noArgsAsync for ( PlatformIntType port = 0; @@ -648,6 +721,20 @@ namespace M { this->m_to_cmdIn[portNum].addCallPort(port); } + void ActiveTestTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) + { + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); + } + void ActiveTestTesterBase :: connect_to_noArgsAsync( NATIVE_INT_TYPE portNum, @@ -889,6 +976,28 @@ namespace M { return &this->m_from_prmSetOut[portNum]; } + Fw::InputDpRequestPort* ActiveTestTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) + { + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; + } + + Fw::InputDpSendPort* ActiveTestTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) + { + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; + } + #if FW_ENABLE_TEXT_LOGGING == 1 Fw::InputLogTextPort* ActiveTestTesterBase :: @@ -1017,6 +1126,10 @@ namespace M { this->tlmHistory_ChannelU32OnChange = new History(maxHistorySize); this->tlmHistory_ChannelEnumOnChange = new History(maxHistorySize); + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + // Clear history this->clearHistory(); } @@ -1053,6 +1166,11 @@ namespace M { delete this->tlmHistory_ChannelF64; delete this->tlmHistory_ChannelU32OnChange; delete this->tlmHistory_ChannelEnumOnChange; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; } // ---------------------------------------------------------------------- @@ -1432,6 +1550,12 @@ namespace M { return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); } + NATIVE_INT_TYPE ActiveTestTesterBase :: + getNum_to_productRecvIn() const + { + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); + } + NATIVE_INT_TYPE ActiveTestTesterBase :: getNum_to_noArgsAsync() const { @@ -1540,6 +1664,18 @@ namespace M { return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); } + NATIVE_INT_TYPE ActiveTestTesterBase :: + getNum_from_productRequestOut() const + { + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); + } + + NATIVE_INT_TYPE ActiveTestTesterBase :: + getNum_from_productSendOut() const + { + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); + } + #if FW_ENABLE_TEXT_LOGGING == 1 NATIVE_INT_TYPE ActiveTestTesterBase :: @@ -1601,6 +1737,17 @@ namespace M { return this->m_to_cmdIn[portNum].isConnected(); } + bool ActiveTestTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) + { + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); + } + bool ActiveTestTesterBase :: isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) { @@ -3415,6 +3562,60 @@ namespace M { this->m_testTime = timeTag; } + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + void ActiveTestTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) + { + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); + } + + void ActiveTestTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) + { + this->pushProductRequestEntry(id, size); + } + + void ActiveTestTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) + { + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); + } + + void ActiveTestTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) + { + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); + } + + void ActiveTestTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) + { + this->pushProductSendEntry(id, buffer); + } + // ---------------------------------------------------------------------- // History functions // ---------------------------------------------------------------------- @@ -3429,6 +3630,8 @@ namespace M { #endif this->clearEvents(); this->clearTlm(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); } void ActiveTestTesterBase :: @@ -3829,6 +4032,30 @@ namespace M { } } + void ActiveTestTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) + { + ActiveTestTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); + } + + void ActiveTestTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) + { + ActiveTestTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); + } + #if FW_ENABLE_TEXT_LOGGING == 1 void ActiveTestTesterBase :: diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.hpp index 84eb2dc5d..c7b93f3cb 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/ActiveTestTesterBase.ref.hpp @@ -10,6 +10,7 @@ #include #include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" #include "Fw/Port/InputSerializePort.hpp" #include "Fw/Types/Assert.hpp" #include "test-base/ActiveTestComponentAc.hpp" @@ -243,6 +244,18 @@ namespace M { E arg; }; + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + public: // ---------------------------------------------------------------------- @@ -266,6 +279,12 @@ namespace M { Fw::InputCmdPort* port //!< The input port ); + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + //! Connect port to noArgsAsync[portNum] void connect_to_noArgsAsync( NATIVE_INT_TYPE portNum, //!< The port number @@ -385,6 +404,20 @@ namespace M { NATIVE_INT_TYPE portNum //!< The port number ); + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get from port at index @@ -671,6 +704,11 @@ namespace M { //! \return The number of to_cmdIn ports NATIVE_INT_TYPE getNum_to_cmdIn() const; + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + //! Get the number of to_noArgsAsync ports //! //! \return The number of to_noArgsAsync ports @@ -761,6 +799,16 @@ namespace M { //! \return The number of from_prmSetOut ports NATIVE_INT_TYPE getNum_from_prmSetOut() const; + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get the number of from_textEventOut ports @@ -813,6 +861,13 @@ namespace M { NATIVE_INT_TYPE portNum //!< The port number ); + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + //! Check whether port to_noArgsAsync is connected //! //! \return Whether port to_noArgsAsync is connected @@ -1308,6 +1363,49 @@ namespace M { const Fw::Time& timeTag //!< The time ); + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + protected: // ---------------------------------------------------------------------- @@ -1415,6 +1513,22 @@ namespace M { Fw::ParamBuffer& val //!< Buffer containing serialized parameter value ); + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Static function for port from_textEventOut @@ -1574,6 +1688,12 @@ namespace M { //! The history of ChannelEnumOnChange values History* tlmHistory_ChannelEnumOnChange; + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + private: // ---------------------------------------------------------------------- @@ -1583,6 +1703,9 @@ namespace M { //! To port connected to cmdIn Fw::OutputCmdPort m_to_cmdIn[1]; + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + //! To port connected to noArgsAsync Ports::OutputNoArgsPort m_to_noArgsAsync[1]; @@ -1643,6 +1766,12 @@ namespace M { //! From port connected to prmSetOut Fw::InputPrmSetPort m_from_prmSetOut[1]; + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + #if FW_ENABLE_TEXT_LOGGING == 1 //! From port connected to textEventOut diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyGTestBase.ref.cpp new file mode 100644 index 000000000..555a4d5f7 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyGTestBase.ref.cpp @@ -0,0 +1,27 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component Google Test harness base class +// ====================================================================== + +#include "test-base/PassiveGetProductPortsOnlyGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductPortsOnlyGTestBase :: + PassiveGetProductPortsOnlyGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + PassiveGetProductPortsOnlyTesterBase(compName, maxHistorySize) +{ + +} + +PassiveGetProductPortsOnlyGTestBase :: + ~PassiveGetProductPortsOnlyGTestBase() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyGTestBase.ref.hpp new file mode 100644 index 000000000..08d21736c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyGTestBase.ref.hpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProductPortsOnly component Google Test harness base class +// ====================================================================== + +#ifndef PassiveGetProductPortsOnlyGTestBase_HPP +#define PassiveGetProductPortsOnlyGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/PassiveGetProductPortsOnlyTesterBase.hpp" + +//! \class PassiveGetProductPortsOnlyGTestBase +//! \brief Auto-generated base for PassiveGetProductPortsOnly component Google Test harness +class PassiveGetProductPortsOnlyGTestBase : + public PassiveGetProductPortsOnlyTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGetProductPortsOnlyGTestBase + PassiveGetProductPortsOnlyGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveGetProductPortsOnlyGTestBase + ~PassiveGetProductPortsOnlyGTestBase(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyTesterBase.ref.cpp new file mode 100644 index 000000000..e3d9734d7 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyTesterBase.ref.cpp @@ -0,0 +1,83 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/PassiveGetProductPortsOnlyTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveGetProductPortsOnlyTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputDpGetPort* PassiveGetProductPortsOnlyTesterBase :: + get_from_productGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productGetOut(), + static_cast(portNum) + ); + + return &this->m_from_productGetOut[portNum]; +} + +Fw::InputDpSendPort* PassiveGetProductPortsOnlyTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductPortsOnlyTesterBase :: + PassiveGetProductPortsOnlyTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveGetProductPortsOnlyTesterBase :: + ~PassiveGetProductPortsOnlyTesterBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductPortsOnlyTesterBase :: + getNum_from_productGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productGetOut)); +} + +NATIVE_INT_TYPE PassiveGetProductPortsOnlyTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyTesterBase.ref.hpp new file mode 100644 index 000000000..99af56596 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductPortsOnlyTesterBase.ref.hpp @@ -0,0 +1,99 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProductPortsOnly component test harness base class +// ====================================================================== + +#ifndef PassiveGetProductPortsOnlyTesterBase_HPP +#define PassiveGetProductPortsOnlyTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/PassiveGetProductPortsOnlyComponentAc.hpp" + +//! \class PassiveGetProductPortsOnlyTesterBase +//! \brief Auto-generated base for PassiveGetProductPortsOnly component test harness +class PassiveGetProductPortsOnlyTesterBase : + public Fw::PassiveComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object PassiveGetProductPortsOnlyTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_productGetOut[portNum] + Fw::InputDpGetPort* get_from_productGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGetProductPortsOnlyTesterBase + PassiveGetProductPortsOnlyTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveGetProductPortsOnlyTesterBase + virtual ~PassiveGetProductPortsOnlyTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of from_productGetOut ports + //! + //! \return The number of from_productGetOut ports + NATIVE_INT_TYPE getNum_from_productGetOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to productGetOut + Fw::InputDpGetPort m_from_productGetOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsGTestBase.ref.cpp new file mode 100644 index 000000000..ae3cc1771 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title PassiveGetProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/PassiveGetProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductsGTestBase :: + PassiveGetProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + PassiveGetProductsTesterBase(compName, maxHistorySize) +{ + +} + +PassiveGetProductsGTestBase :: + ~PassiveGetProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void PassiveGetProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void PassiveGetProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void PassiveGetProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void PassiveGetProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Get +// ---------------------------------------------------------------------- + +void PassiveGetProductsGTestBase :: + assertProductGet_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productGetHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product get history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productGetHistory->size() << "\n"; +} + +void PassiveGetProductsGTestBase :: + assertProductGet( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productGetHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product get history\n" + << " Expected: Less than size of product get history (" + << this->productGetHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpGet& e = this->productGetHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product get history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product get history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void PassiveGetProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void PassiveGetProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsGTestBase.ref.hpp new file mode 100644 index 000000000..d41902ef3 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title PassiveGetProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProducts component Google Test harness base class +// ====================================================================== + +#ifndef PassiveGetProductsGTestBase_HPP +#define PassiveGetProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/PassiveGetProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product get assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_GET_SIZE(size) \ + this->assertProductGet_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_GET(index, id, size) \ + this->assertProductGet(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class PassiveGetProductsGTestBase +//! \brief Auto-generated base for PassiveGetProducts component Google Test harness +class PassiveGetProductsGTestBase : + public PassiveGetProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGetProductsGTestBase + PassiveGetProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveGetProductsGTestBase + ~PassiveGetProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Get + // ---------------------------------------------------------------------- + + //! Assert size of product get history + void assertProductGet_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product get history at index + void assertProductGet( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsTesterBase.ref.cpp new file mode 100644 index 000000000..f3e302572 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsTesterBase.ref.cpp @@ -0,0 +1,1445 @@ +// ====================================================================== +// \title PassiveGetProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/PassiveGetProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productGetOut()); + port++ + ) { + this->m_from_productGetOut[port].init(); + this->m_from_productGetOut[port].addCallComp( + this, + from_productGetOut_static + ); + this->m_from_productGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productGetOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void PassiveGetProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* PassiveGetProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* PassiveGetProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* PassiveGetProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* PassiveGetProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* PassiveGetProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpGetPort* PassiveGetProductsTesterBase :: + get_from_productGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productGetOut(), + static_cast(portNum) + ); + + return &this->m_from_productGetOut[portNum]; +} + +Fw::InputDpSendPort* PassiveGetProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* PassiveGetProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* PassiveGetProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* PassiveGetProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* PassiveGetProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveGetProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* PassiveGetProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* PassiveGetProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductsTesterBase :: + PassiveGetProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productGetHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +PassiveGetProductsTesterBase :: + ~PassiveGetProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 PassiveGetProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void PassiveGetProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGetProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 PassiveGetProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 PassiveGetProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void PassiveGetProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void PassiveGetProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGetProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 PassiveGetProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void PassiveGetProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_productGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productGetOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE PassiveGetProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool PassiveGetProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool PassiveGetProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + pushProductGetEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpGet e = { id, size }; + this->productGetHistory->push_back(e); +} + +Fw::Success::T PassiveGetProductsTesterBase :: + productGet_handler( + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + (void) buffer; + this->pushProductGetEntry(id, size); + return Fw::Success::FAILURE; +} + +void PassiveGetProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void PassiveGetProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void PassiveGetProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productGetHistory->clear(); + this->productSendHistory->clear(); +} + +void PassiveGetProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void PassiveGetProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void PassiveGetProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void PassiveGetProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void PassiveGetProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +Fw::Success PassiveGetProductsTesterBase :: + from_productGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->productGet_handler(id, size, buffer); +} + +void PassiveGetProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void PassiveGetProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void PassiveGetProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 PassiveGetProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void PassiveGetProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGetProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsTesterBase.ref.hpp new file mode 100644 index 000000000..01d49b464 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGetProductsTesterBase.ref.hpp @@ -0,0 +1,966 @@ +// ====================================================================== +// \title PassiveGetProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProducts component test harness base class +// ====================================================================== + +#ifndef PassiveGetProductsTesterBase_HPP +#define PassiveGetProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/PassiveGetProductsComponentAc.hpp" + +//! \class PassiveGetProductsTesterBase +//! \brief Auto-generated base for PassiveGetProducts component test harness +class PassiveGetProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product get + struct DpGet { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object PassiveGetProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productGetOut[portNum] + Fw::InputDpGetPort* get_from_productGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGetProductsTesterBase + PassiveGetProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveGetProductsTesterBase + virtual ~PassiveGetProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productGetOut ports + //! + //! \return The number of from_productGetOut ports + NATIVE_INT_TYPE getNum_from_productGetOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product get history + void pushProductGetEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product get from the component under test + //! + //! By default, (1) call pushProductGetEntry; (2) do not allocate a buffer + //! and return FAILURE. You can override this behavior, e.g., to call + //! pushProductGetEntry, allocate a buffer and return SUCCESS. + virtual Fw::Success::T productGet_handler( + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productGetOut + static Fw::Success from_productGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product get history + History* productGetHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productGetOut + Fw::InputDpGetPort m_from_productGetOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsGTestBase.ref.cpp new file mode 100644 index 000000000..cc99791e0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title PassiveGuardedProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/PassiveGuardedProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveGuardedProductsGTestBase :: + PassiveGuardedProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + PassiveGuardedProductsTesterBase(compName, maxHistorySize) +{ + +} + +PassiveGuardedProductsGTestBase :: + ~PassiveGuardedProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void PassiveGuardedProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void PassiveGuardedProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void PassiveGuardedProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void PassiveGuardedProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void PassiveGuardedProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void PassiveGuardedProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsGTestBase.ref.hpp new file mode 100644 index 000000000..7e1778b15 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title PassiveGuardedProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGuardedProducts component Google Test harness base class +// ====================================================================== + +#ifndef PassiveGuardedProductsGTestBase_HPP +#define PassiveGuardedProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/PassiveGuardedProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class PassiveGuardedProductsGTestBase +//! \brief Auto-generated base for PassiveGuardedProducts component Google Test harness +class PassiveGuardedProductsGTestBase : + public PassiveGuardedProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGuardedProductsGTestBase + PassiveGuardedProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveGuardedProductsGTestBase + ~PassiveGuardedProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsTesterBase.ref.cpp new file mode 100644 index 000000000..1b0f460fb --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsTesterBase.ref.cpp @@ -0,0 +1,1507 @@ +// ====================================================================== +// \title PassiveGuardedProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/PassiveGuardedProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void PassiveGuardedProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* PassiveGuardedProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* PassiveGuardedProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* PassiveGuardedProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* PassiveGuardedProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* PassiveGuardedProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* PassiveGuardedProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* PassiveGuardedProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* PassiveGuardedProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* PassiveGuardedProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* PassiveGuardedProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* PassiveGuardedProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveGuardedProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* PassiveGuardedProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* PassiveGuardedProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveGuardedProductsTesterBase :: + PassiveGuardedProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +PassiveGuardedProductsTesterBase :: + ~PassiveGuardedProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 PassiveGuardedProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void PassiveGuardedProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 PassiveGuardedProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 PassiveGuardedProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void PassiveGuardedProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void PassiveGuardedProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void PassiveGuardedProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE PassiveGuardedProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool PassiveGuardedProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void PassiveGuardedProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void PassiveGuardedProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void PassiveGuardedProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void PassiveGuardedProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void PassiveGuardedProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void PassiveGuardedProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void PassiveGuardedProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void PassiveGuardedProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void PassiveGuardedProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void PassiveGuardedProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void PassiveGuardedProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void PassiveGuardedProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 PassiveGuardedProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void PassiveGuardedProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveGuardedProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveGuardedProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsTesterBase.ref.hpp new file mode 100644 index 000000000..197ee18d5 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveGuardedProductsTesterBase.ref.hpp @@ -0,0 +1,991 @@ +// ====================================================================== +// \title PassiveGuardedProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGuardedProducts component test harness base class +// ====================================================================== + +#ifndef PassiveGuardedProductsTesterBase_HPP +#define PassiveGuardedProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/PassiveGuardedProductsComponentAc.hpp" + +//! \class PassiveGuardedProductsTesterBase +//! \brief Auto-generated base for PassiveGuardedProducts component test harness +class PassiveGuardedProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object PassiveGuardedProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGuardedProductsTesterBase + PassiveGuardedProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveGuardedProductsTesterBase + virtual ~PassiveGuardedProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyGTestBase.ref.cpp new file mode 100644 index 000000000..1405fbabc --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyGTestBase.ref.cpp @@ -0,0 +1,27 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component Google Test harness base class +// ====================================================================== + +#include "test-base/PassiveSyncProductPortsOnlyGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductPortsOnlyGTestBase :: + PassiveSyncProductPortsOnlyGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + PassiveSyncProductPortsOnlyTesterBase(compName, maxHistorySize) +{ + +} + +PassiveSyncProductPortsOnlyGTestBase :: + ~PassiveSyncProductPortsOnlyGTestBase() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyGTestBase.ref.hpp new file mode 100644 index 000000000..46dc61dc1 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyGTestBase.ref.hpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProductPortsOnly component Google Test harness base class +// ====================================================================== + +#ifndef PassiveSyncProductPortsOnlyGTestBase_HPP +#define PassiveSyncProductPortsOnlyGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/PassiveSyncProductPortsOnlyTesterBase.hpp" + +//! \class PassiveSyncProductPortsOnlyGTestBase +//! \brief Auto-generated base for PassiveSyncProductPortsOnly component Google Test harness +class PassiveSyncProductPortsOnlyGTestBase : + public PassiveSyncProductPortsOnlyTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveSyncProductPortsOnlyGTestBase + PassiveSyncProductPortsOnlyGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveSyncProductPortsOnlyGTestBase + ~PassiveSyncProductPortsOnlyGTestBase(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyTesterBase.ref.cpp new file mode 100644 index 000000000..244ca2492 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyTesterBase.ref.cpp @@ -0,0 +1,122 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/PassiveSyncProductPortsOnlyTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputDpRequestPort* PassiveSyncProductPortsOnlyTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* PassiveSyncProductPortsOnlyTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductPortsOnlyTesterBase :: + PassiveSyncProductPortsOnlyTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + +} + +PassiveSyncProductPortsOnlyTesterBase :: + ~PassiveSyncProductPortsOnlyTesterBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductPortsOnlyTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE PassiveSyncProductPortsOnlyTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductPortsOnlyTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool PassiveSyncProductPortsOnlyTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyTesterBase.ref.hpp new file mode 100644 index 000000000..068704384 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductPortsOnlyTesterBase.ref.hpp @@ -0,0 +1,138 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProductPortsOnly component test harness base class +// ====================================================================== + +#ifndef PassiveSyncProductPortsOnlyTesterBase_HPP +#define PassiveSyncProductPortsOnlyTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/PassiveSyncProductPortsOnlyComponentAc.hpp" + +//! \class PassiveSyncProductPortsOnlyTesterBase +//! \brief Auto-generated base for PassiveSyncProductPortsOnly component test harness +class PassiveSyncProductPortsOnlyTesterBase : + public Fw::PassiveComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object PassiveSyncProductPortsOnlyTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveSyncProductPortsOnlyTesterBase + PassiveSyncProductPortsOnlyTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveSyncProductPortsOnlyTesterBase + virtual ~PassiveSyncProductPortsOnlyTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsGTestBase.ref.cpp new file mode 100644 index 000000000..1b960fa8f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title PassiveSyncProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/PassiveSyncProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductsGTestBase :: + PassiveSyncProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + PassiveSyncProductsTesterBase(compName, maxHistorySize) +{ + +} + +PassiveSyncProductsGTestBase :: + ~PassiveSyncProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void PassiveSyncProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void PassiveSyncProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void PassiveSyncProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void PassiveSyncProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void PassiveSyncProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void PassiveSyncProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void PassiveSyncProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void PassiveSyncProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsGTestBase.ref.hpp new file mode 100644 index 000000000..946f19fa2 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title PassiveSyncProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProducts component Google Test harness base class +// ====================================================================== + +#ifndef PassiveSyncProductsGTestBase_HPP +#define PassiveSyncProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/PassiveSyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class PassiveSyncProductsGTestBase +//! \brief Auto-generated base for PassiveSyncProducts component Google Test harness +class PassiveSyncProductsGTestBase : + public PassiveSyncProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveSyncProductsGTestBase + PassiveSyncProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveSyncProductsGTestBase + ~PassiveSyncProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsTesterBase.ref.cpp new file mode 100644 index 000000000..4460fd9cc --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsTesterBase.ref.cpp @@ -0,0 +1,1507 @@ +// ====================================================================== +// \title PassiveSyncProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/PassiveSyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void PassiveSyncProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* PassiveSyncProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* PassiveSyncProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* PassiveSyncProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* PassiveSyncProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* PassiveSyncProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* PassiveSyncProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* PassiveSyncProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* PassiveSyncProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* PassiveSyncProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* PassiveSyncProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* PassiveSyncProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* PassiveSyncProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* PassiveSyncProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* PassiveSyncProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductsTesterBase :: + PassiveSyncProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +PassiveSyncProductsTesterBase :: + ~PassiveSyncProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 PassiveSyncProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void PassiveSyncProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveSyncProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 PassiveSyncProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 PassiveSyncProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void PassiveSyncProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void PassiveSyncProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveSyncProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 PassiveSyncProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void PassiveSyncProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE PassiveSyncProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool PassiveSyncProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool PassiveSyncProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void PassiveSyncProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void PassiveSyncProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void PassiveSyncProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void PassiveSyncProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void PassiveSyncProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void PassiveSyncProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void PassiveSyncProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void PassiveSyncProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void PassiveSyncProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void PassiveSyncProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void PassiveSyncProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void PassiveSyncProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 PassiveSyncProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void PassiveSyncProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 PassiveSyncProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + PassiveSyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsTesterBase.ref.hpp new file mode 100644 index 000000000..ef3818955 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveSyncProductsTesterBase.ref.hpp @@ -0,0 +1,991 @@ +// ====================================================================== +// \title PassiveSyncProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProducts component test harness base class +// ====================================================================== + +#ifndef PassiveSyncProductsTesterBase_HPP +#define PassiveSyncProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/PassiveSyncProductsComponentAc.hpp" + +//! \class PassiveSyncProductsTesterBase +//! \brief Auto-generated base for PassiveSyncProducts component test harness +class PassiveSyncProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object PassiveSyncProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveSyncProductsTesterBase + PassiveSyncProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object PassiveSyncProductsTesterBase + virtual ~PassiveSyncProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.cpp index 214616a21..bbca1d795 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.cpp @@ -934,3 +934,123 @@ void PassiveTestGTestBase :: << " Expected: " << val << "\n" << " Actual: " << _e.arg << "\n"; } + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void PassiveTestGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void PassiveTestGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void PassiveTestGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void PassiveTestGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.hpp index e8c403f1c..eda9db33f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestGTestBase.ref.hpp @@ -319,6 +319,26 @@ #define ASSERT_TLM_ChannelEnumOnChange(index, value) \ this->assertTlm_ChannelEnumOnChange(__FILE__, __LINE__, index, value) +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + //! \class PassiveTestGTestBase //! \brief Auto-generated base for PassiveTest component Google Test harness class PassiveTestGTestBase : @@ -687,6 +707,59 @@ class PassiveTestGTestBase : const E& val //!< The channel value ) const; + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + }; #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.cpp index 1638e0c43..ad6b2db92 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.cpp @@ -149,6 +149,58 @@ void PassiveTestTesterBase :: #endif } + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + #if FW_ENABLE_TEXT_LOGGING == 1 // Connect input port textEventOut for ( @@ -354,6 +406,27 @@ void PassiveTestTesterBase :: #endif } + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + // Connect output port noArgsGuarded for ( PlatformIntType port = 0; @@ -541,6 +614,20 @@ void PassiveTestTesterBase :: this->m_to_cmdIn[portNum].addCallPort(port); } +void PassiveTestTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + void PassiveTestTesterBase :: connect_to_noArgsGuarded( NATIVE_INT_TYPE portNum, @@ -712,6 +799,28 @@ Fw::InputPrmSetPort* PassiveTestTesterBase :: return &this->m_from_prmSetOut[portNum]; } +Fw::InputDpRequestPort* PassiveTestTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* PassiveTestTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + #if FW_ENABLE_TEXT_LOGGING == 1 Fw::InputLogTextPort* PassiveTestTesterBase :: @@ -840,6 +949,10 @@ PassiveTestTesterBase :: this->tlmHistory_ChannelU32OnChange = new History(maxHistorySize); this->tlmHistory_ChannelEnumOnChange = new History(maxHistorySize); + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + // Clear history this->clearHistory(); } @@ -876,6 +989,11 @@ PassiveTestTesterBase :: delete this->tlmHistory_ChannelF64; delete this->tlmHistory_ChannelU32OnChange; delete this->tlmHistory_ChannelEnumOnChange; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; } // ---------------------------------------------------------------------- @@ -1132,6 +1250,12 @@ NATIVE_INT_TYPE PassiveTestTesterBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); } +NATIVE_INT_TYPE PassiveTestTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + NATIVE_INT_TYPE PassiveTestTesterBase :: getNum_to_noArgsGuarded() const { @@ -1210,6 +1334,18 @@ NATIVE_INT_TYPE PassiveTestTesterBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); } +NATIVE_INT_TYPE PassiveTestTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE PassiveTestTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + #if FW_ENABLE_TEXT_LOGGING == 1 NATIVE_INT_TYPE PassiveTestTesterBase :: @@ -1271,6 +1407,17 @@ bool PassiveTestTesterBase :: return this->m_to_cmdIn[portNum].isConnected(); } +bool PassiveTestTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + bool PassiveTestTesterBase :: isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) { @@ -2887,6 +3034,60 @@ void PassiveTestTesterBase :: this->m_testTime = timeTag; } +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void PassiveTestTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void PassiveTestTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void PassiveTestTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void PassiveTestTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void PassiveTestTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + // ---------------------------------------------------------------------- // History functions // ---------------------------------------------------------------------- @@ -2901,6 +3102,8 @@ void PassiveTestTesterBase :: #endif this->clearEvents(); this->clearTlm(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); } void PassiveTestTesterBase :: @@ -3301,6 +3504,30 @@ void PassiveTestTesterBase :: } } +void PassiveTestTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + PassiveTestTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void PassiveTestTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + PassiveTestTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + #if FW_ENABLE_TEXT_LOGGING == 1 void PassiveTestTesterBase :: diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.hpp index ecef498e3..359fd29e9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/PassiveTestTesterBase.ref.hpp @@ -10,6 +10,7 @@ #include #include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" #include "Fw/Port/InputSerializePort.hpp" #include "Fw/Types/Assert.hpp" #include "test-base/PassiveTestComponentAc.hpp" @@ -241,6 +242,18 @@ class PassiveTestTesterBase : E arg; }; + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + public: // ---------------------------------------------------------------------- @@ -264,6 +277,12 @@ class PassiveTestTesterBase : Fw::InputCmdPort* port //!< The input port ); + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + //! Connect port to noArgsGuarded[portNum] void connect_to_noArgsGuarded( NATIVE_INT_TYPE portNum, //!< The port number @@ -353,6 +372,20 @@ class PassiveTestTesterBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get from port at index @@ -586,6 +619,11 @@ class PassiveTestTesterBase : //! \return The number of to_cmdIn ports NATIVE_INT_TYPE getNum_to_cmdIn() const; + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + //! Get the number of to_noArgsGuarded ports //! //! \return The number of to_noArgsGuarded ports @@ -651,6 +689,16 @@ class PassiveTestTesterBase : //! \return The number of from_prmSetOut ports NATIVE_INT_TYPE getNum_from_prmSetOut() const; + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get the number of from_textEventOut ports @@ -703,6 +751,13 @@ class PassiveTestTesterBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + //! Check whether port to_noArgsGuarded is connected //! //! \return Whether port to_noArgsGuarded is connected @@ -1131,6 +1186,49 @@ class PassiveTestTesterBase : const Fw::Time& timeTag //!< The time ); + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + protected: // ---------------------------------------------------------------------- @@ -1238,6 +1336,22 @@ class PassiveTestTesterBase : Fw::ParamBuffer& val //!< Buffer containing serialized parameter value ); + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Static function for port from_textEventOut @@ -1397,6 +1511,12 @@ class PassiveTestTesterBase : //! The history of ChannelEnumOnChange values History* tlmHistory_ChannelEnumOnChange; + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + private: // ---------------------------------------------------------------------- @@ -1406,6 +1526,9 @@ class PassiveTestTesterBase : //! To port connected to cmdIn Fw::OutputCmdPort m_to_cmdIn[1]; + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + //! To port connected to noArgsGuarded Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; @@ -1451,6 +1574,12 @@ class PassiveTestTesterBase : //! From port connected to prmSetOut Fw::InputPrmSetPort m_from_prmSetOut[1]; + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + #if FW_ENABLE_TEXT_LOGGING == 1 //! From port connected to textEventOut diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyGTestBase.ref.cpp new file mode 100644 index 000000000..06e363d2d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyGTestBase.ref.cpp @@ -0,0 +1,27 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnlyGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProductPortsOnly component Google Test harness base class +// ====================================================================== + +#include "test-base/QueuedAsyncProductPortsOnlyGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductPortsOnlyGTestBase :: + QueuedAsyncProductPortsOnlyGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + QueuedAsyncProductPortsOnlyTesterBase(compName, maxHistorySize) +{ + +} + +QueuedAsyncProductPortsOnlyGTestBase :: + ~QueuedAsyncProductPortsOnlyGTestBase() +{ + +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyGTestBase.ref.hpp new file mode 100644 index 000000000..b240e7746 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyGTestBase.ref.hpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnlyGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProductPortsOnly component Google Test harness base class +// ====================================================================== + +#ifndef QueuedAsyncProductPortsOnlyGTestBase_HPP +#define QueuedAsyncProductPortsOnlyGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/QueuedAsyncProductPortsOnlyTesterBase.hpp" + +//! \class QueuedAsyncProductPortsOnlyGTestBase +//! \brief Auto-generated base for QueuedAsyncProductPortsOnly component Google Test harness +class QueuedAsyncProductPortsOnlyGTestBase : + public QueuedAsyncProductPortsOnlyTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedAsyncProductPortsOnlyGTestBase + QueuedAsyncProductPortsOnlyGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedAsyncProductPortsOnlyGTestBase + ~QueuedAsyncProductPortsOnlyGTestBase(); + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyTesterBase.ref.cpp new file mode 100644 index 000000000..4bb12a230 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyTesterBase.ref.cpp @@ -0,0 +1,122 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnlyTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProductPortsOnly component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/QueuedAsyncProductPortsOnlyTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductPortsOnlyTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputDpRequestPort* QueuedAsyncProductPortsOnlyTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* QueuedAsyncProductPortsOnlyTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductPortsOnlyTesterBase :: + QueuedAsyncProductPortsOnlyTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + +} + +QueuedAsyncProductPortsOnlyTesterBase :: + ~QueuedAsyncProductPortsOnlyTesterBase() +{ + +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductPortsOnlyTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE QueuedAsyncProductPortsOnlyTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductPortsOnlyTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool QueuedAsyncProductPortsOnlyTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyTesterBase.ref.hpp new file mode 100644 index 000000000..41c22de6c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductPortsOnlyTesterBase.ref.hpp @@ -0,0 +1,138 @@ +// ====================================================================== +// \title QueuedAsyncProductPortsOnlyTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProductPortsOnly component test harness base class +// ====================================================================== + +#ifndef QueuedAsyncProductPortsOnlyTesterBase_HPP +#define QueuedAsyncProductPortsOnlyTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/QueuedAsyncProductPortsOnlyComponentAc.hpp" + +//! \class QueuedAsyncProductPortsOnlyTesterBase +//! \brief Auto-generated base for QueuedAsyncProductPortsOnly component test harness +class QueuedAsyncProductPortsOnlyTesterBase : + public Fw::PassiveComponentBase +{ + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object QueuedAsyncProductPortsOnlyTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedAsyncProductPortsOnlyTesterBase + QueuedAsyncProductPortsOnlyTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedAsyncProductPortsOnlyTesterBase + virtual ~QueuedAsyncProductPortsOnlyTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsGTestBase.ref.cpp new file mode 100644 index 000000000..8e47a55c0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title QueuedAsyncProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/QueuedAsyncProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductsGTestBase :: + QueuedAsyncProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + QueuedAsyncProductsTesterBase(compName, maxHistorySize) +{ + +} + +QueuedAsyncProductsGTestBase :: + ~QueuedAsyncProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void QueuedAsyncProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void QueuedAsyncProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void QueuedAsyncProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void QueuedAsyncProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void QueuedAsyncProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void QueuedAsyncProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsGTestBase.ref.hpp new file mode 100644 index 000000000..3150ff35b --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title QueuedAsyncProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProducts component Google Test harness base class +// ====================================================================== + +#ifndef QueuedAsyncProductsGTestBase_HPP +#define QueuedAsyncProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/QueuedAsyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class QueuedAsyncProductsGTestBase +//! \brief Auto-generated base for QueuedAsyncProducts component Google Test harness +class QueuedAsyncProductsGTestBase : + public QueuedAsyncProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedAsyncProductsGTestBase + QueuedAsyncProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedAsyncProductsGTestBase + ~QueuedAsyncProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsTesterBase.ref.cpp new file mode 100644 index 000000000..b54d08764 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsTesterBase.ref.cpp @@ -0,0 +1,1890 @@ +// ====================================================================== +// \title QueuedAsyncProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedAsyncProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/QueuedAsyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void QueuedAsyncProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* QueuedAsyncProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* QueuedAsyncProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* QueuedAsyncProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* QueuedAsyncProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* QueuedAsyncProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* QueuedAsyncProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* QueuedAsyncProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* QueuedAsyncProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* QueuedAsyncProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* QueuedAsyncProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* QueuedAsyncProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedAsyncProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* QueuedAsyncProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* QueuedAsyncProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedAsyncProductsTesterBase :: + QueuedAsyncProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +QueuedAsyncProductsTesterBase :: + ~QueuedAsyncProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 QueuedAsyncProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void QueuedAsyncProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 QueuedAsyncProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 QueuedAsyncProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedAsyncProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE QueuedAsyncProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool QueuedAsyncProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void QueuedAsyncProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void QueuedAsyncProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void QueuedAsyncProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void QueuedAsyncProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void QueuedAsyncProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void QueuedAsyncProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void QueuedAsyncProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void QueuedAsyncProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void QueuedAsyncProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void QueuedAsyncProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void QueuedAsyncProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void QueuedAsyncProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void QueuedAsyncProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 QueuedAsyncProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void QueuedAsyncProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedAsyncProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedAsyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsTesterBase.ref.hpp new file mode 100644 index 000000000..904dc4a22 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedAsyncProductsTesterBase.ref.hpp @@ -0,0 +1,1149 @@ +// ====================================================================== +// \title QueuedAsyncProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedAsyncProducts component test harness base class +// ====================================================================== + +#ifndef QueuedAsyncProductsTesterBase_HPP +#define QueuedAsyncProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/QueuedAsyncProductsComponentAc.hpp" + +//! \class QueuedAsyncProductsTesterBase +//! \brief Auto-generated base for QueuedAsyncProducts component test harness +class QueuedAsyncProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object QueuedAsyncProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedAsyncProductsTesterBase + QueuedAsyncProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedAsyncProductsTesterBase + virtual ~QueuedAsyncProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsGTestBase.ref.cpp new file mode 100644 index 000000000..a82652684 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title QueuedGetProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/QueuedGetProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedGetProductsGTestBase :: + QueuedGetProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + QueuedGetProductsTesterBase(compName, maxHistorySize) +{ + +} + +QueuedGetProductsGTestBase :: + ~QueuedGetProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void QueuedGetProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void QueuedGetProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void QueuedGetProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void QueuedGetProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Get +// ---------------------------------------------------------------------- + +void QueuedGetProductsGTestBase :: + assertProductGet_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productGetHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product get history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productGetHistory->size() << "\n"; +} + +void QueuedGetProductsGTestBase :: + assertProductGet( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productGetHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product get history\n" + << " Expected: Less than size of product get history (" + << this->productGetHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpGet& e = this->productGetHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product get history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product get history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void QueuedGetProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void QueuedGetProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsGTestBase.ref.hpp new file mode 100644 index 000000000..75ea3145f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title QueuedGetProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGetProducts component Google Test harness base class +// ====================================================================== + +#ifndef QueuedGetProductsGTestBase_HPP +#define QueuedGetProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/QueuedGetProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product get assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_GET_SIZE(size) \ + this->assertProductGet_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_GET(index, id, size) \ + this->assertProductGet(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class QueuedGetProductsGTestBase +//! \brief Auto-generated base for QueuedGetProducts component Google Test harness +class QueuedGetProductsGTestBase : + public QueuedGetProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedGetProductsGTestBase + QueuedGetProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedGetProductsGTestBase + ~QueuedGetProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Get + // ---------------------------------------------------------------------- + + //! Assert size of product get history + void assertProductGet_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product get history at index + void assertProductGet( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsTesterBase.ref.cpp new file mode 100644 index 000000000..358b07840 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsTesterBase.ref.cpp @@ -0,0 +1,1828 @@ +// ====================================================================== +// \title QueuedGetProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/QueuedGetProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productGetOut()); + port++ + ) { + this->m_from_productGetOut[port].init(); + this->m_from_productGetOut[port].addCallComp( + this, + from_productGetOut_static + ); + this->m_from_productGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productGetOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void QueuedGetProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* QueuedGetProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* QueuedGetProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* QueuedGetProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* QueuedGetProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* QueuedGetProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpGetPort* QueuedGetProductsTesterBase :: + get_from_productGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productGetOut(), + static_cast(portNum) + ); + + return &this->m_from_productGetOut[portNum]; +} + +Fw::InputDpSendPort* QueuedGetProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* QueuedGetProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* QueuedGetProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* QueuedGetProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* QueuedGetProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedGetProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* QueuedGetProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* QueuedGetProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedGetProductsTesterBase :: + QueuedGetProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productGetHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +QueuedGetProductsTesterBase :: + ~QueuedGetProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 QueuedGetProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void QueuedGetProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGetProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void QueuedGetProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 QueuedGetProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 QueuedGetProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void QueuedGetProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void QueuedGetProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGetProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGetProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedGetProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedGetProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_productGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productGetOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE QueuedGetProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool QueuedGetProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool QueuedGetProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + pushProductGetEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpGet e = { id, size }; + this->productGetHistory->push_back(e); +} + +Fw::Success::T QueuedGetProductsTesterBase :: + productGet_handler( + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + (void) buffer; + this->pushProductGetEntry(id, size); + return Fw::Success::FAILURE; +} + +void QueuedGetProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void QueuedGetProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void QueuedGetProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productGetHistory->clear(); + this->productSendHistory->clear(); +} + +void QueuedGetProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void QueuedGetProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void QueuedGetProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void QueuedGetProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void QueuedGetProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +Fw::Success QueuedGetProductsTesterBase :: + from_productGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size, + Fw::Buffer& buffer + ) +{ + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->productGet_handler(id, size, buffer); +} + +void QueuedGetProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void QueuedGetProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void QueuedGetProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 QueuedGetProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void QueuedGetProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGetProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGetProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsTesterBase.ref.hpp new file mode 100644 index 000000000..f83529e13 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGetProductsTesterBase.ref.hpp @@ -0,0 +1,1124 @@ +// ====================================================================== +// \title QueuedGetProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGetProducts component test harness base class +// ====================================================================== + +#ifndef QueuedGetProductsTesterBase_HPP +#define QueuedGetProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/QueuedGetProductsComponentAc.hpp" + +//! \class QueuedGetProductsTesterBase +//! \brief Auto-generated base for QueuedGetProducts component test harness +class QueuedGetProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product get + struct DpGet { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object QueuedGetProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productGetOut[portNum] + Fw::InputDpGetPort* get_from_productGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedGetProductsTesterBase + QueuedGetProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedGetProductsTesterBase + virtual ~QueuedGetProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productGetOut ports + //! + //! \return The number of from_productGetOut ports + NATIVE_INT_TYPE getNum_from_productGetOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product get history + void pushProductGetEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product get from the component under test + //! + //! By default, (1) call pushProductGetEntry; (2) do not allocate a buffer + //! and return FAILURE. You can override this behavior, e.g., to call + //! pushProductGetEntry, allocate a buffer and return SUCCESS. + virtual Fw::Success::T productGet_handler( + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productGetOut + static Fw::Success from_productGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size, //!< The size of the requested buffer + Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product get history + History* productGetHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productGetOut + Fw::InputDpGetPort m_from_productGetOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsGTestBase.ref.cpp new file mode 100644 index 000000000..5cdbea27c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title QueuedGuardedProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/QueuedGuardedProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedGuardedProductsGTestBase :: + QueuedGuardedProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + QueuedGuardedProductsTesterBase(compName, maxHistorySize) +{ + +} + +QueuedGuardedProductsGTestBase :: + ~QueuedGuardedProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void QueuedGuardedProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void QueuedGuardedProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void QueuedGuardedProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void QueuedGuardedProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void QueuedGuardedProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void QueuedGuardedProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsGTestBase.ref.hpp new file mode 100644 index 000000000..bfac9faeb --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title QueuedGuardedProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGuardedProducts component Google Test harness base class +// ====================================================================== + +#ifndef QueuedGuardedProductsGTestBase_HPP +#define QueuedGuardedProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/QueuedGuardedProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class QueuedGuardedProductsGTestBase +//! \brief Auto-generated base for QueuedGuardedProducts component Google Test harness +class QueuedGuardedProductsGTestBase : + public QueuedGuardedProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedGuardedProductsGTestBase + QueuedGuardedProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedGuardedProductsGTestBase + ~QueuedGuardedProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsTesterBase.ref.cpp new file mode 100644 index 000000000..817f1767f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsTesterBase.ref.cpp @@ -0,0 +1,1890 @@ +// ====================================================================== +// \title QueuedGuardedProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/QueuedGuardedProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void QueuedGuardedProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* QueuedGuardedProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* QueuedGuardedProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* QueuedGuardedProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* QueuedGuardedProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* QueuedGuardedProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* QueuedGuardedProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* QueuedGuardedProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* QueuedGuardedProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* QueuedGuardedProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* QueuedGuardedProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* QueuedGuardedProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedGuardedProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* QueuedGuardedProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* QueuedGuardedProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedGuardedProductsTesterBase :: + QueuedGuardedProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +QueuedGuardedProductsTesterBase :: + ~QueuedGuardedProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 QueuedGuardedProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void QueuedGuardedProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 QueuedGuardedProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 QueuedGuardedProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedGuardedProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE QueuedGuardedProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool QueuedGuardedProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void QueuedGuardedProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void QueuedGuardedProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void QueuedGuardedProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void QueuedGuardedProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void QueuedGuardedProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void QueuedGuardedProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void QueuedGuardedProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void QueuedGuardedProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void QueuedGuardedProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void QueuedGuardedProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void QueuedGuardedProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void QueuedGuardedProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 QueuedGuardedProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void QueuedGuardedProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedGuardedProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedGuardedProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsTesterBase.ref.hpp new file mode 100644 index 000000000..211c237ea --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedGuardedProductsTesterBase.ref.hpp @@ -0,0 +1,1149 @@ +// ====================================================================== +// \title QueuedGuardedProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGuardedProducts component test harness base class +// ====================================================================== + +#ifndef QueuedGuardedProductsTesterBase_HPP +#define QueuedGuardedProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/QueuedGuardedProductsComponentAc.hpp" + +//! \class QueuedGuardedProductsTesterBase +//! \brief Auto-generated base for QueuedGuardedProducts component test harness +class QueuedGuardedProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object QueuedGuardedProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedGuardedProductsTesterBase + QueuedGuardedProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedGuardedProductsTesterBase + virtual ~QueuedGuardedProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsGTestBase.ref.cpp new file mode 100644 index 000000000..dd7a51103 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsGTestBase.ref.cpp @@ -0,0 +1,226 @@ +// ====================================================================== +// \title QueuedSyncProductsGTestBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component Google Test harness base class +// ====================================================================== + +#include "test-base/QueuedSyncProductsGTestBase.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedSyncProductsGTestBase :: + QueuedSyncProductsGTestBase( + const char* const compName, + const U32 maxHistorySize + ) : + QueuedSyncProductsTesterBase(compName, maxHistorySize) +{ + +} + +QueuedSyncProductsGTestBase :: + ~QueuedSyncProductsGTestBase() +{ + +} + +// ---------------------------------------------------------------------- +// From ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsGTestBase :: + assertFromPortHistory_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Total size of all from port histories\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize << "\n"; +} + +void QueuedSyncProductsGTestBase :: + assert_from_noArgsOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsOut << "\n"; +} + +void QueuedSyncProductsGTestBase :: + assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistorySize_noArgsReturnOut) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for noArgsReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistorySize_noArgsReturnOut << "\n"; +} + +void QueuedSyncProductsGTestBase :: + assert_from_typedOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedOut->size() << "\n"; +} + +void QueuedSyncProductsGTestBase :: + assert_from_typedReturnOut_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->fromPortHistory_typedReturnOut->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of history for typedReturnOut\n" + << " Expected: " << size << "\n" + << " Actual: " << this->fromPortHistory_typedReturnOut->size() << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void QueuedSyncProductsGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void QueuedSyncProductsGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void QueuedSyncProductsGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void QueuedSyncProductsGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsGTestBase.ref.hpp new file mode 100644 index 000000000..feccb50fe --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsGTestBase.ref.hpp @@ -0,0 +1,333 @@ +// ====================================================================== +// \title QueuedSyncProductsGTestBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedSyncProducts component Google Test harness base class +// ====================================================================== + +#ifndef QueuedSyncProductsGTestBase_HPP +#define QueuedSyncProductsGTestBase_HPP + +#include "gtest/gtest.h" +#include "test-base/QueuedSyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Macros for typed user from port history assertions +// ---------------------------------------------------------------------- + +#define ASSERT_FROM_PORT_HISTORY_SIZE(size) \ + this->assertFromPortHistory_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut_SIZE(size) \ + this->assert_from_noArgsOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsOut& _e = \ + this->fromPortHistory_noArgsOut->at(index); \ + } + +#define ASSERT_from_noArgsReturnOut_SIZE(size) \ + this->assert_from_noArgsReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_noArgsReturnOut(index) \ + { \ + ASSERT_GT(this->fromPortHistory_noArgsReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of noArgsReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_noArgsReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_noArgsReturnOut& _e = \ + this->fromPortHistory_noArgsReturnOut->at(index); \ + } + +#define ASSERT_from_typedOut_SIZE(size) \ + this->assert_from_typedOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedOut(index, _u32, _f32, _b, _str1, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedOut& _e = \ + this->fromPortHistory_typedOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str1, _e.str1) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str1 at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _str1 << "\n" \ + << " Actual: " << _e.str1 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +#define ASSERT_from_typedReturnOut_SIZE(size) \ + this->assert_from_typedReturnOut_size(__FILE__, __LINE__, size) + +#define ASSERT_from_typedReturnOut(index, _u32, _f32, _b, _str2, _e, _a, _s) \ + { \ + ASSERT_GT(this->fromPortHistory_typedReturnOut->size(), static_cast(index)) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Index into history of typedReturnOut\n" \ + << " Expected: Less than size of history (" \ + << this->fromPortHistory_typedReturnOut->size() << ")\n" \ + << " Actual: " << index << "\n"; \ + const FromPortEntry_typedReturnOut& _e = \ + this->fromPortHistory_typedReturnOut->at(index); \ + ASSERT_EQ(_u32, _e.u32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument u32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _u32 << "\n" \ + << " Actual: " << _e.u32 << "\n"; \ + ASSERT_EQ(_f32, _e.f32) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument f32 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _f32 << "\n" \ + << " Actual: " << _e.f32 << "\n"; \ + ASSERT_EQ(_b, _e.b) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument b at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _b << "\n" \ + << " Actual: " << _e.b << "\n"; \ + ASSERT_EQ(_str2, _e.str2) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument str2 at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _str2 << "\n" \ + << " Actual: " << _e.str2 << "\n"; \ + ASSERT_EQ(_e, _e.e) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument e at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _e << "\n" \ + << " Actual: " << _e.e << "\n"; \ + ASSERT_EQ(_a, _e.a) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument a at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _a << "\n" \ + << " Actual: " << _e.a << "\n"; \ + ASSERT_EQ(_s, _e.s) \ + << "\n" \ + << __FILE__ << ":" << __LINE__ << "\n" \ + << " Value: Value of argument s at index " \ + << index \ + << " in history of typedReturnOut\n" \ + << " Expected: " << _s << "\n" \ + << " Actual: " << _e.s << "\n"; \ + } + +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + +//! \class QueuedSyncProductsGTestBase +//! \brief Auto-generated base for QueuedSyncProducts component Google Test harness +class QueuedSyncProductsGTestBase : + public QueuedSyncProductsTesterBase +{ + + protected: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedSyncProductsGTestBase + QueuedSyncProductsGTestBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedSyncProductsGTestBase + ~QueuedSyncProductsGTestBase(); + + protected: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From ports + void assertFromPortHistory_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsOut + void assert_from_noArgsOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: noArgsReturnOut + void assert_from_noArgsReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedOut + void assert_from_typedOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! From port: typedReturnOut + void assert_from_typedReturnOut_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsTesterBase.ref.cpp new file mode 100644 index 000000000..c2fb1c366 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsTesterBase.ref.cpp @@ -0,0 +1,1890 @@ +// ====================================================================== +// \title QueuedSyncProductsTesterBase.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component test harness base class +// ====================================================================== + +#include +#include + +#include "test-base/QueuedSyncProductsTesterBase.hpp" + +// ---------------------------------------------------------------------- +// Component initialization +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + init(NATIVE_INT_TYPE instance) +{ + // Initialize base class + Fw::PassiveComponentBase::init(instance); + + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + + // Connect input port timeGetOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_timeGetOut()); + port++ + ) { + this->m_from_timeGetOut[port].init(); + this->m_from_timeGetOut[port].addCallComp( + this, + from_timeGetOut_static + ); + this->m_from_timeGetOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_timeGetOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_timeGetOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsOut()); + port++ + ) { + this->m_from_noArgsOut[port].init(); + this->m_from_noArgsOut[port].addCallComp( + this, + from_noArgsOut_static + ); + this->m_from_noArgsOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsOut[port].setObjName(portName); +#endif + } + + // Connect input port noArgsReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_noArgsReturnOut()); + port++ + ) { + this->m_from_noArgsReturnOut[port].init(); + this->m_from_noArgsReturnOut[port].addCallComp( + this, + from_noArgsReturnOut_static + ); + this->m_from_noArgsReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_noArgsReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_noArgsReturnOut[port].setObjName(portName); +#endif + } + + // Connect input port typedOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedOut()); + port++ + ) { + this->m_from_typedOut[port].init(); + this->m_from_typedOut[port].addCallComp( + this, + from_typedOut_static + ); + this->m_from_typedOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedOut[port].setObjName(portName); +#endif + } + + // Connect input port typedReturnOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_typedReturnOut()); + port++ + ) { + this->m_from_typedReturnOut[port].init(); + this->m_from_typedReturnOut[port].addCallComp( + this, + from_typedReturnOut_static + ); + this->m_from_typedReturnOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_typedReturnOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_typedReturnOut[port].setObjName(portName); +#endif + } + + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + + // Connect output port noArgsAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsAsync()); + port++ + ) { + this->m_to_noArgsAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsAsync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsGuarded()); + port++ + ) { + this->m_to_noArgsGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnGuarded()); + port++ + ) { + this->m_to_noArgsReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port noArgsReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsReturnSync()); + port++ + ) { + this->m_to_noArgsReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port noArgsSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_noArgsSync()); + port++ + ) { + this->m_to_noArgsSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_noArgsSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_noArgsSync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsync()); + port++ + ) { + this->m_to_typedAsync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsync[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncAssert + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncAssert()); + port++ + ) { + this->m_to_typedAsyncAssert[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncAssert[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncAssert[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncBlockPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncBlockPriority()); + port++ + ) { + this->m_to_typedAsyncBlockPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncBlockPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncBlockPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedAsyncDropPriority + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedAsyncDropPriority()); + port++ + ) { + this->m_to_typedAsyncDropPriority[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedAsyncDropPriority[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedAsyncDropPriority[port].setObjName(portName); +#endif + } + + // Connect output port typedGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedGuarded()); + port++ + ) { + this->m_to_typedGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnGuarded + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnGuarded()); + port++ + ) { + this->m_to_typedReturnGuarded[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnGuarded[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnGuarded[port].setObjName(portName); +#endif + } + + // Connect output port typedReturnSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedReturnSync()); + port++ + ) { + this->m_to_typedReturnSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedReturnSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedReturnSync[port].setObjName(portName); +#endif + } + + // Connect output port typedSync + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_typedSync()); + port++ + ) { + this->m_to_typedSync[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_typedSync[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_typedSync[port].setObjName(portName); +#endif + } +} + +// ---------------------------------------------------------------------- +// Connectors for to ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + connect_to_cmdIn( + NATIVE_INT_TYPE portNum, + Fw::InputCmdPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + this->m_to_cmdIn[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + this->m_to_noArgsAsync[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsGuarded[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnGuarded[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + this->m_to_noArgsReturnSync[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, + Ports::InputNoArgsPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + this->m_to_noArgsSync[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedAsync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + this->m_to_typedAsync[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + this->m_to_typedAsyncAssert[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncBlockPriority[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + this->m_to_typedAsyncDropPriority[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + this->m_to_typedGuarded[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + this->m_to_typedReturnGuarded[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedReturnPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + this->m_to_typedReturnSync[portNum].addCallPort(port); +} + +void QueuedSyncProductsTesterBase :: + connect_to_typedSync( + NATIVE_INT_TYPE portNum, + Ports::InputTypedPort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + this->m_to_typedSync[portNum].addCallPort(port); +} + +// ---------------------------------------------------------------------- +// Getters for from ports +// ---------------------------------------------------------------------- + +Fw::InputCmdRegPort* QueuedSyncProductsTesterBase :: + get_from_cmdRegOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdRegOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdRegOut[portNum]; +} + +Fw::InputCmdResponsePort* QueuedSyncProductsTesterBase :: + get_from_cmdResponseOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_cmdResponseOut(), + static_cast(portNum) + ); + + return &this->m_from_cmdResponseOut[portNum]; +} + +Fw::InputLogPort* QueuedSyncProductsTesterBase :: + get_from_eventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_eventOut(), + static_cast(portNum) + ); + + return &this->m_from_eventOut[portNum]; +} + +Fw::InputPrmGetPort* QueuedSyncProductsTesterBase :: + get_from_prmGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmGetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmGetOut[portNum]; +} + +Fw::InputPrmSetPort* QueuedSyncProductsTesterBase :: + get_from_prmSetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_prmSetOut(), + static_cast(portNum) + ); + + return &this->m_from_prmSetOut[portNum]; +} + +Fw::InputDpRequestPort* QueuedSyncProductsTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* QueuedSyncProductsTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +Fw::InputLogTextPort* QueuedSyncProductsTesterBase :: + get_from_textEventOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_textEventOut(), + static_cast(portNum) + ); + + return &this->m_from_textEventOut[portNum]; +} + +#endif + +Fw::InputTimePort* QueuedSyncProductsTesterBase :: + get_from_timeGetOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_timeGetOut(), + static_cast(portNum) + ); + + return &this->m_from_timeGetOut[portNum]; +} + +Fw::InputTlmPort* QueuedSyncProductsTesterBase :: + get_from_tlmOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_tlmOut(), + static_cast(portNum) + ); + + return &this->m_from_tlmOut[portNum]; +} + +Ports::InputNoArgsPort* QueuedSyncProductsTesterBase :: + get_from_noArgsOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsOut[portNum]; +} + +Ports::InputNoArgsReturnPort* QueuedSyncProductsTesterBase :: + get_from_noArgsReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_noArgsReturnOut[portNum]; +} + +Ports::InputTypedPort* QueuedSyncProductsTesterBase :: + get_from_typedOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + + return &this->m_from_typedOut[portNum]; +} + +Ports::InputTypedReturnPort* QueuedSyncProductsTesterBase :: + get_from_typedReturnOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + + return &this->m_from_typedReturnOut[portNum]; +} + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +QueuedSyncProductsTesterBase :: + QueuedSyncProductsTesterBase( + const char* const compName, + const U32 maxHistorySize + ) : + Fw::PassiveComponentBase(compName) +{ + // Initialize port histories + this->fromPortHistory_typedOut = new History(maxHistorySize); + this->fromPortHistory_typedReturnOut = new History(maxHistorySize); + + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + + // Clear history + this->clearHistory(); +} + +QueuedSyncProductsTesterBase :: + ~QueuedSyncProductsTesterBase() +{ + // Destroy port histories + delete this->fromPortHistory_typedOut; + delete this->fromPortHistory_typedReturnOut; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; +} + +// ---------------------------------------------------------------------- +// Handler base-class functions for from ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + from_noArgsOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsOut(), + static_cast(portNum) + ); + this->from_noArgsOut_handler(portNum); +} + +U32 QueuedSyncProductsTesterBase :: + from_noArgsReturnOut_handlerBase(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_noArgsReturnOut(), + static_cast(portNum) + ); + return this->from_noArgsReturnOut_handler(portNum); +} + +void QueuedSyncProductsTesterBase :: + from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedOut(), + static_cast(portNum) + ); + this->from_typedOut_handler( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedSyncProductsTesterBase :: + from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_from_typedReturnOut(), + static_cast(portNum) + ); + return this->from_typedReturnOut_handler( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Invocation functions for to ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + invoke_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + this->m_to_noArgsAsync[portNum].invoke(); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + this->m_to_noArgsGuarded[portNum].invoke(); +} + +U32 QueuedSyncProductsTesterBase :: + invoke_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnGuarded[portNum].invoke(); +} + +U32 QueuedSyncProductsTesterBase :: + invoke_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + return this->m_to_noArgsReturnSync[portNum].invoke(); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + this->m_to_noArgsSync[portNum].invoke(); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + this->m_to_typedAsync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + this->m_to_typedAsyncAssert[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncBlockPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + this->m_to_typedAsyncDropPriority[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + this->m_to_typedGuarded[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedSyncProductsTesterBase :: + invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + return this->m_to_typedReturnGuarded[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +F32 QueuedSyncProductsTesterBase :: + invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + return this->m_to_typedReturnSync[portNum].invoke( + u32, + f32, + b, + str2, + e, + a, + s + ); +} + +void QueuedSyncProductsTesterBase :: + invoke_to_typedSync( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // Make sure port number is valid + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + this->m_to_typedSync[portNum].invoke( + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +// ---------------------------------------------------------------------- +// Getters for port counts +// ---------------------------------------------------------------------- + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_cmdIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_noArgsAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsAsync)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_noArgsGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsGuarded)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_noArgsReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_noArgsReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsReturnSync)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_noArgsSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_noArgsSync)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedAsync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsync)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedAsyncAssert() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncAssert)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedAsyncBlockPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncBlockPriority)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedAsyncDropPriority() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedAsyncDropPriority)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedGuarded)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedReturnGuarded() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnGuarded)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedReturnSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedReturnSync)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_to_typedSync() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_typedSync)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_cmdRegOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdRegOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_cmdResponseOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_cmdResponseOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_eventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_eventOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_prmGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmGetOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_prmSetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + +#if FW_ENABLE_TEXT_LOGGING == 1 + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_textEventOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_textEventOut)); +} + +#endif + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_timeGetOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_timeGetOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_tlmOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_tlmOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_noArgsOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_noArgsReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_noArgsReturnOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_typedOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedOut)); +} + +NATIVE_INT_TYPE QueuedSyncProductsTesterBase :: + getNum_from_typedReturnOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_typedReturnOut)); +} + +// ---------------------------------------------------------------------- +// Connection status queries for to ports +// ---------------------------------------------------------------------- + +bool QueuedSyncProductsTesterBase :: + isConnected_to_cmdIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_cmdIn(), + static_cast(portNum) + ); + + return this->m_to_cmdIn[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsAsync(), + static_cast(portNum) + ); + + return this->m_to_noArgsAsync[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_noArgsGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsGuarded[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_noArgsReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnGuarded[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_noArgsReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsReturnSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsReturnSync[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_noArgsSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_noArgsSync(), + static_cast(portNum) + ); + + return this->m_to_noArgsSync[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedAsync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsync(), + static_cast(portNum) + ); + + return this->m_to_typedAsync[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedAsyncAssert(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncAssert(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncAssert[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedAsyncBlockPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncBlockPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncBlockPriority[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedAsyncDropPriority(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedAsyncDropPriority(), + static_cast(portNum) + ); + + return this->m_to_typedAsyncDropPriority[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedGuarded[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedReturnGuarded(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnGuarded(), + static_cast(portNum) + ); + + return this->m_to_typedReturnGuarded[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedReturnSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedReturnSync(), + static_cast(portNum) + ); + + return this->m_to_typedReturnSync[portNum].isConnected(); +} + +bool QueuedSyncProductsTesterBase :: + isConnected_to_typedSync(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_typedSync(), + static_cast(portNum) + ); + + return this->m_to_typedSync[portNum].isConnected(); +} + +// ---------------------------------------------------------------------- +// Functions to test time +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + setTestTime(const Fw::Time& timeTag) +{ + this->m_testTime = timeTag; +} + +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void QueuedSyncProductsTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void QueuedSyncProductsTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void QueuedSyncProductsTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void QueuedSyncProductsTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + +// ---------------------------------------------------------------------- +// History functions +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + clearHistory() +{ + this->clearFromPortHistory(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); +} + +void QueuedSyncProductsTesterBase :: + clearFromPortHistory() +{ + this->fromPortHistorySize = 0; + this->fromPortHistorySize_noArgsOut = 0; + this->fromPortHistorySize_noArgsReturnOut = 0; + this->fromPortHistory_typedOut->clear(); + this->fromPortHistory_typedReturnOut->clear(); +} + +void QueuedSyncProductsTesterBase :: + pushFromPortEntry_noArgsOut() +{ + this->fromPortHistorySize_noArgsOut++; + this->fromPortHistorySize++; +} + +void QueuedSyncProductsTesterBase :: + pushFromPortEntry_noArgsReturnOut() +{ + this->fromPortHistorySize_noArgsReturnOut++; + this->fromPortHistorySize++; +} + +void QueuedSyncProductsTesterBase :: + pushFromPortEntry_typedOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedOut _e = { + u32, + f32, + b, + str1, + e, + a, + s + }; + this->fromPortHistory_typedOut->push_back(_e); + this->fromPortHistorySize++; +} + +void QueuedSyncProductsTesterBase :: + pushFromPortEntry_typedReturnOut( + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FromPortEntry_typedReturnOut _e = { + u32, + f32, + b, + str2, + e, + a, + s + }; + this->fromPortHistory_typedReturnOut->push_back(_e); + this->fromPortHistorySize++; +} + +// ---------------------------------------------------------------------- +// Static functions for output ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void QueuedSyncProductsTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + +void QueuedSyncProductsTesterBase :: + from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + Fw::Time& time + ) +{ + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + time = _testerBase->m_testTime; +} + +void QueuedSyncProductsTesterBase :: + from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_noArgsOut_handlerBase(portNum); +} + +U32 QueuedSyncProductsTesterBase :: + from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_noArgsReturnOut_handlerBase(portNum); +} + +void QueuedSyncProductsTesterBase :: + from_typedOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + _testerBase->from_typedOut_handlerBase( + portNum, + u32, + f32, + b, + str1, + e, + a, + s + ); +} + +F32 QueuedSyncProductsTesterBase :: + from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + FW_ASSERT(callComp != nullptr); + QueuedSyncProductsTesterBase* _testerBase = static_cast(callComp); + return _testerBase->from_typedReturnOut_handlerBase( + portNum, + u32, + f32, + b, + str2, + e, + a, + s + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsTesterBase.ref.hpp new file mode 100644 index 000000000..84fc5f83f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedSyncProductsTesterBase.ref.hpp @@ -0,0 +1,1149 @@ +// ====================================================================== +// \title QueuedSyncProductsTesterBase.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedSyncProducts component test harness base class +// ====================================================================== + +#ifndef QueuedSyncProductsTesterBase_HPP +#define QueuedSyncProductsTesterBase_HPP + +#include + +#include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" +#include "Fw/Port/InputSerializePort.hpp" +#include "Fw/Types/Assert.hpp" +#include "test-base/QueuedSyncProductsComponentAc.hpp" + +//! \class QueuedSyncProductsTesterBase +//! \brief Auto-generated base for QueuedSyncProducts component test harness +class QueuedSyncProductsTesterBase : + public Fw::PassiveComponentBase +{ + + protected: + + // ---------------------------------------------------------------------- + // History class + // ---------------------------------------------------------------------- + + //! \class History + //! \brief A history of port inputs + //! + template + class History + { + + public: + + //! Create a History + History( + const U32 maxSize //!< The maximum history size + ) : + numEntries(0), + maxSize(maxSize) + { + this->entries = new T[maxSize]; + } + + //! Destroy a History + ~History() + { + delete[] this->entries; + } + + //! Clear the history + //! + void clear() + { + this->numEntries = 0; + } + + //! Push an item onto the history + //! + void push_back( + T entry //!< The item + ) + { + FW_ASSERT(this->numEntries < this->maxSize); + entries[this->numEntries++] = entry; + } + + //! Get an item at an index + //! + //! \return The item at index i + T at( + const U32 i //!< The index + ) const + { + FW_ASSERT(i < this->numEntries); + return entries[i]; + } + + //! Get the number of entries in the history + //! + //! \return The number of entries in the history + U32 size() const + { + return this->numEntries; + } + + private: + + //! The number of entries in the history + U32 numEntries; + + //! The maximum history size + const U32 maxSize; + + //! The entries + T* entries; + + }; + + protected: + + // ---------------------------------------------------------------------- + // History types + // ---------------------------------------------------------------------- + + //! A history entry for port from_typedOut + struct FromPortEntry_typedOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedPortStrings::StringSize80 str1; + E e; + A a; + S s; + }; + + //! A history entry for port from_typedReturnOut + struct FromPortEntry_typedReturnOut { + U32 u32; + F32 f32; + bool b; + Ports::TypedReturnPortStrings::StringSize80 str2; + E e; + A a; + S s; + }; + + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + + public: + + // ---------------------------------------------------------------------- + // Component initialization + // ---------------------------------------------------------------------- + + //! Initialize object QueuedSyncProductsTesterBase + virtual void init( + NATIVE_INT_TYPE instance = 0 //!< The instance number + ); + + public: + + // ---------------------------------------------------------------------- + // Connectors for to ports + // ---------------------------------------------------------------------- + + //! Connect port to cmdIn[portNum] + void connect_to_cmdIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputCmdPort* port //!< The input port + ); + + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + + //! Connect port to noArgsAsync[portNum] + void connect_to_noArgsAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsGuarded[portNum] + void connect_to_noArgsGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to noArgsReturnGuarded[portNum] + void connect_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsReturnSync[portNum] + void connect_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsReturnPort* port //!< The input port + ); + + //! Connect port to noArgsSync[portNum] + void connect_to_noArgsSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputNoArgsPort* port //!< The input port + ); + + //! Connect port to typedAsync[portNum] + void connect_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncAssert[portNum] + void connect_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncBlockPriority[portNum] + void connect_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedAsyncDropPriority[portNum] + void connect_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedGuarded[portNum] + void connect_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + //! Connect port to typedReturnGuarded[portNum] + void connect_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedReturnSync[portNum] + void connect_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedReturnPort* port //!< The input port + ); + + //! Connect port to typedSync[portNum] + void connect_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + Ports::InputTypedPort* port //!< The input port + ); + + public: + + // ---------------------------------------------------------------------- + // Getters for from ports + // ---------------------------------------------------------------------- + + //! Get from port at index + //! + //! \return from_cmdRegOut[portNum] + Fw::InputCmdRegPort* get_from_cmdRegOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_cmdResponseOut[portNum] + Fw::InputCmdResponsePort* get_from_cmdResponseOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_eventOut[portNum] + Fw::InputLogPort* get_from_eventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmGetOut[portNum] + Fw::InputPrmGetPort* get_from_prmGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_prmSetOut[portNum] + Fw::InputPrmSetPort* get_from_prmSetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get from port at index + //! + //! \return from_textEventOut[portNum] + Fw::InputLogTextPort* get_from_textEventOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + +#endif + + //! Get from port at index + //! + //! \return from_timeGetOut[portNum] + Fw::InputTimePort* get_from_timeGetOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_tlmOut[portNum] + Fw::InputTlmPort* get_from_tlmOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsOut[portNum] + Ports::InputNoArgsPort* get_from_noArgsOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_noArgsReturnOut[portNum] + Ports::InputNoArgsReturnPort* get_from_noArgsReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedOut[portNum] + Ports::InputTypedPort* get_from_typedOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_typedReturnOut[portNum] + Ports::InputTypedReturnPort* get_from_typedReturnOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedSyncProductsTesterBase + QueuedSyncProductsTesterBase( + const char* const compName, //!< The component name + const U32 maxHistorySize //!< The maximum size of each history + ); + + //! Destroy object QueuedSyncProductsTesterBase + virtual ~QueuedSyncProductsTesterBase(); + + protected: + + // ---------------------------------------------------------------------- + // Handlers to implement for from ports + // ---------------------------------------------------------------------- + + //! Handler for input port from_noArgsOut + virtual void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_noArgsReturnOut + virtual U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ) = 0; + + //! Handler for input port from_typedOut + virtual void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + //! Handler for input port from_typedReturnOut + virtual F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ) = 0; + + protected: + + // ---------------------------------------------------------------------- + // Handler base-class functions for from ports + // ---------------------------------------------------------------------- + + //! Handler base-class function for from_noArgsOut + void from_noArgsOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_noArgsReturnOut + U32 from_noArgsReturnOut_handlerBase( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler base-class function for from_typedOut + void from_typedOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler base-class function for from_typedReturnOut + F32 from_typedReturnOut_handlerBase( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Invocation functions for to ports + // ---------------------------------------------------------------------- + + //! Invoke the to port connected to noArgsAsync + void invoke_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsGuarded + void invoke_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnGuarded + U32 invoke_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsReturnSync + U32 invoke_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to noArgsSync + void invoke_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Invoke the to port connected to typedAsync + void invoke_to_typedAsync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncAssert + void invoke_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncBlockPriority + void invoke_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedAsyncDropPriority + void invoke_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedGuarded + void invoke_to_typedGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnGuarded + F32 invoke_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedReturnSync + F32 invoke_to_typedReturnSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Invoke the to port connected to typedSync + void invoke_to_typedSync( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // Getters for port counts + // ---------------------------------------------------------------------- + + //! Get the number of to_cmdIn ports + //! + //! \return The number of to_cmdIn ports + NATIVE_INT_TYPE getNum_to_cmdIn() const; + + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + + //! Get the number of to_noArgsAsync ports + //! + //! \return The number of to_noArgsAsync ports + NATIVE_INT_TYPE getNum_to_noArgsAsync() const; + + //! Get the number of to_noArgsGuarded ports + //! + //! \return The number of to_noArgsGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsGuarded() const; + + //! Get the number of to_noArgsReturnGuarded ports + //! + //! \return The number of to_noArgsReturnGuarded ports + NATIVE_INT_TYPE getNum_to_noArgsReturnGuarded() const; + + //! Get the number of to_noArgsReturnSync ports + //! + //! \return The number of to_noArgsReturnSync ports + NATIVE_INT_TYPE getNum_to_noArgsReturnSync() const; + + //! Get the number of to_noArgsSync ports + //! + //! \return The number of to_noArgsSync ports + NATIVE_INT_TYPE getNum_to_noArgsSync() const; + + //! Get the number of to_typedAsync ports + //! + //! \return The number of to_typedAsync ports + NATIVE_INT_TYPE getNum_to_typedAsync() const; + + //! Get the number of to_typedAsyncAssert ports + //! + //! \return The number of to_typedAsyncAssert ports + NATIVE_INT_TYPE getNum_to_typedAsyncAssert() const; + + //! Get the number of to_typedAsyncBlockPriority ports + //! + //! \return The number of to_typedAsyncBlockPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncBlockPriority() const; + + //! Get the number of to_typedAsyncDropPriority ports + //! + //! \return The number of to_typedAsyncDropPriority ports + NATIVE_INT_TYPE getNum_to_typedAsyncDropPriority() const; + + //! Get the number of to_typedGuarded ports + //! + //! \return The number of to_typedGuarded ports + NATIVE_INT_TYPE getNum_to_typedGuarded() const; + + //! Get the number of to_typedReturnGuarded ports + //! + //! \return The number of to_typedReturnGuarded ports + NATIVE_INT_TYPE getNum_to_typedReturnGuarded() const; + + //! Get the number of to_typedReturnSync ports + //! + //! \return The number of to_typedReturnSync ports + NATIVE_INT_TYPE getNum_to_typedReturnSync() const; + + //! Get the number of to_typedSync ports + //! + //! \return The number of to_typedSync ports + NATIVE_INT_TYPE getNum_to_typedSync() const; + + //! Get the number of from_cmdRegOut ports + //! + //! \return The number of from_cmdRegOut ports + NATIVE_INT_TYPE getNum_from_cmdRegOut() const; + + //! Get the number of from_cmdResponseOut ports + //! + //! \return The number of from_cmdResponseOut ports + NATIVE_INT_TYPE getNum_from_cmdResponseOut() const; + + //! Get the number of from_eventOut ports + //! + //! \return The number of from_eventOut ports + NATIVE_INT_TYPE getNum_from_eventOut() const; + + //! Get the number of from_prmGetOut ports + //! + //! \return The number of from_prmGetOut ports + NATIVE_INT_TYPE getNum_from_prmGetOut() const; + + //! Get the number of from_prmSetOut ports + //! + //! \return The number of from_prmSetOut ports + NATIVE_INT_TYPE getNum_from_prmSetOut() const; + + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! Get the number of from_textEventOut ports + //! + //! \return The number of from_textEventOut ports + NATIVE_INT_TYPE getNum_from_textEventOut() const; + +#endif + + //! Get the number of from_timeGetOut ports + //! + //! \return The number of from_timeGetOut ports + NATIVE_INT_TYPE getNum_from_timeGetOut() const; + + //! Get the number of from_tlmOut ports + //! + //! \return The number of from_tlmOut ports + NATIVE_INT_TYPE getNum_from_tlmOut() const; + + //! Get the number of from_noArgsOut ports + //! + //! \return The number of from_noArgsOut ports + NATIVE_INT_TYPE getNum_from_noArgsOut() const; + + //! Get the number of from_noArgsReturnOut ports + //! + //! \return The number of from_noArgsReturnOut ports + NATIVE_INT_TYPE getNum_from_noArgsReturnOut() const; + + //! Get the number of from_typedOut ports + //! + //! \return The number of from_typedOut ports + NATIVE_INT_TYPE getNum_from_typedOut() const; + + //! Get the number of from_typedReturnOut ports + //! + //! \return The number of from_typedReturnOut ports + NATIVE_INT_TYPE getNum_from_typedReturnOut() const; + + protected: + + // ---------------------------------------------------------------------- + // Connection status queries for to ports + // ---------------------------------------------------------------------- + + //! Check whether port to_cmdIn is connected + //! + //! \return Whether port to_cmdIn is connected + bool isConnected_to_cmdIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsAsync is connected + //! + //! \return Whether port to_noArgsAsync is connected + bool isConnected_to_noArgsAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsGuarded is connected + //! + //! \return Whether port to_noArgsGuarded is connected + bool isConnected_to_noArgsGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnGuarded is connected + //! + //! \return Whether port to_noArgsReturnGuarded is connected + bool isConnected_to_noArgsReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsReturnSync is connected + //! + //! \return Whether port to_noArgsReturnSync is connected + bool isConnected_to_noArgsReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_noArgsSync is connected + //! + //! \return Whether port to_noArgsSync is connected + bool isConnected_to_noArgsSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsync is connected + //! + //! \return Whether port to_typedAsync is connected + bool isConnected_to_typedAsync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncAssert is connected + //! + //! \return Whether port to_typedAsyncAssert is connected + bool isConnected_to_typedAsyncAssert( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncBlockPriority is connected + //! + //! \return Whether port to_typedAsyncBlockPriority is connected + bool isConnected_to_typedAsyncBlockPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedAsyncDropPriority is connected + //! + //! \return Whether port to_typedAsyncDropPriority is connected + bool isConnected_to_typedAsyncDropPriority( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedGuarded is connected + //! + //! \return Whether port to_typedGuarded is connected + bool isConnected_to_typedGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnGuarded is connected + //! + //! \return Whether port to_typedReturnGuarded is connected + bool isConnected_to_typedReturnGuarded( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedReturnSync is connected + //! + //! \return Whether port to_typedReturnSync is connected + bool isConnected_to_typedReturnSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Check whether port to_typedSync is connected + //! + //! \return Whether port to_typedSync is connected + bool isConnected_to_typedSync( + NATIVE_INT_TYPE portNum //!< The port number + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions to test time + // ---------------------------------------------------------------------- + + //! Set the test time for events and telemetry + void setTestTime( + const Fw::Time& timeTag //!< The time + ); + + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + protected: + + // ---------------------------------------------------------------------- + // History functions + // ---------------------------------------------------------------------- + + //! Clear all history + void clearHistory(); + + //! Clear from port history + void clearFromPortHistory(); + + //! Push an entry on the history for from_noArgsOut + void pushFromPortEntry_noArgsOut(); + + //! Push an entry on the history for from_noArgsReturnOut + void pushFromPortEntry_noArgsReturnOut(); + + //! Push an entry on the history for from_typedOut + void pushFromPortEntry_typedOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Push an entry on the history for from_typedReturnOut + void pushFromPortEntry_typedReturnOut( + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Static functions for output ports + // ---------------------------------------------------------------------- + + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Static function for port from_timeGetOut + static void from_timeGetOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + Fw::Time& time //!< The time tag + ); + + //! Static function for port from_noArgsOut + static void from_noArgsOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_noArgsReturnOut + static U32 from_noArgsReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Static function for port from_typedOut + static void from_typedOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Static function for port from_typedReturnOut + static F32 from_typedReturnOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + protected: + + // ---------------------------------------------------------------------- + // History member variables + // ---------------------------------------------------------------------- + + //! The total number of port entries + U32 fromPortHistorySize; + + //! The size of history for from_noArgsOut + U32 fromPortHistorySize_noArgsOut; + + //! The size of history for from_noArgsReturnOut + U32 fromPortHistorySize_noArgsReturnOut; + + //! The history for from_typedOut + History* fromPortHistory_typedOut; + + //! The history for from_typedReturnOut + History* fromPortHistory_typedReturnOut; + + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + + private: + + // ---------------------------------------------------------------------- + // To ports + // ---------------------------------------------------------------------- + + //! To port connected to cmdIn + Fw::OutputCmdPort m_to_cmdIn[1]; + + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + + //! To port connected to noArgsAsync + Ports::OutputNoArgsPort m_to_noArgsAsync[1]; + + //! To port connected to noArgsGuarded + Ports::OutputNoArgsPort m_to_noArgsGuarded[1]; + + //! To port connected to noArgsReturnGuarded + Ports::OutputNoArgsReturnPort m_to_noArgsReturnGuarded[1]; + + //! To port connected to noArgsReturnSync + Ports::OutputNoArgsReturnPort m_to_noArgsReturnSync[3]; + + //! To port connected to noArgsSync + Ports::OutputNoArgsPort m_to_noArgsSync[3]; + + //! To port connected to typedAsync + Ports::OutputTypedPort m_to_typedAsync[1]; + + //! To port connected to typedAsyncAssert + Ports::OutputTypedPort m_to_typedAsyncAssert[1]; + + //! To port connected to typedAsyncBlockPriority + Ports::OutputTypedPort m_to_typedAsyncBlockPriority[1]; + + //! To port connected to typedAsyncDropPriority + Ports::OutputTypedPort m_to_typedAsyncDropPriority[1]; + + //! To port connected to typedGuarded + Ports::OutputTypedPort m_to_typedGuarded[1]; + + //! To port connected to typedReturnGuarded + Ports::OutputTypedReturnPort m_to_typedReturnGuarded[1]; + + //! To port connected to typedReturnSync + Ports::OutputTypedReturnPort m_to_typedReturnSync[3]; + + //! To port connected to typedSync + Ports::OutputTypedPort m_to_typedSync[3]; + + private: + + // ---------------------------------------------------------------------- + // From ports + // ---------------------------------------------------------------------- + + //! From port connected to cmdRegOut + Fw::InputCmdRegPort m_from_cmdRegOut[1]; + + //! From port connected to cmdResponseOut + Fw::InputCmdResponsePort m_from_cmdResponseOut[1]; + + //! From port connected to eventOut + Fw::InputLogPort m_from_eventOut[1]; + + //! From port connected to prmGetOut + Fw::InputPrmGetPort m_from_prmGetOut[1]; + + //! From port connected to prmSetOut + Fw::InputPrmSetPort m_from_prmSetOut[1]; + + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + +#if FW_ENABLE_TEXT_LOGGING == 1 + + //! From port connected to textEventOut + Fw::InputLogTextPort m_from_textEventOut[1]; + +#endif + + //! From port connected to timeGetOut + Fw::InputTimePort m_from_timeGetOut[1]; + + //! From port connected to tlmOut + Fw::InputTlmPort m_from_tlmOut[1]; + + //! From port connected to noArgsOut + Ports::InputNoArgsPort m_from_noArgsOut[1]; + + //! From port connected to noArgsReturnOut + Ports::InputNoArgsReturnPort m_from_noArgsReturnOut[1]; + + //! From port connected to typedOut + Ports::InputTypedPort m_from_typedOut[1]; + + //! From port connected to typedReturnOut + Ports::InputTypedReturnPort m_from_typedReturnOut[1]; + + private: + + // ---------------------------------------------------------------------- + // Time variables + // ---------------------------------------------------------------------- + + //! Test time stamp + Fw::Time m_testTime; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.cpp index de5d3e5ff..8c74c9ecf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.cpp @@ -934,3 +934,123 @@ void QueuedTestGTestBase :: << " Expected: " << val << "\n" << " Actual: " << _e.arg << "\n"; } + +// ---------------------------------------------------------------------- +// Data Product Request +// ---------------------------------------------------------------------- + +void QueuedTestGTestBase :: + assertProductRequest_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productRequestHistory->size() << "\n"; +} + +void QueuedTestGTestBase :: + assertProductRequest( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwSizeType size + ) const +{ + ASSERT_LT(__index, this->productRequestHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product request history\n" + << " Expected: Less than size of product request history (" + << this->productRequestHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpRequest& e = this->productRequestHistory->at(__index); + ASSERT_EQ(id, e.id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Id at index " + << __index + << " in product request history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + ASSERT_EQ(size, e.size) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size at index " + << __index + << " in product request history\n" + << " Expected: " << size << "\n" + << " Actual: " << e.size << "\n"; +} + +// ---------------------------------------------------------------------- +// Data Product Send +// ---------------------------------------------------------------------- + +void QueuedTestGTestBase :: + assertProductSend_size( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 size + ) const +{ + ASSERT_EQ(size, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Size of product send history\n" + << " Expected: " << size << "\n" + << " Actual: " << this->productSendHistory->size() << "\n"; +} + +void QueuedTestGTestBase :: + assertProductSend( + const char* const __callSiteFileName, + const U32 __callSiteLineNumber, + const U32 __index, + FwDpIdType id, + FwDpPriorityType priority, + const Fw::Time& timeTag, + Fw::DpCfg::ProcType procType, + const Fw::DpContainer::Header::UserData& userData, + FwSizeType dataSize, + Fw::Buffer& historyBuffer + ) const +{ + ASSERT_LT(__index, this->productSendHistory->size()) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Index into product send history\n" + << " Expected: Less than size of product send history (" + << this->productSendHistory->size() << ")\n" + << " Actual: " << __index << "\n"; + const DpSend& e = this->productSendHistory->at(__index); + // Set the history buffer output + historyBuffer = e.buffer; + // Check the container id + ASSERT_EQ(e.id, id) + << "\n" + << __callSiteFileName << ":" << __callSiteLineNumber << "\n" + << " Value: Container ID at index " << __index << " in product send history\n" + << " Expected: " << id << "\n" + << " Actual: " << e.id << "\n"; + // Check the header + Fw::TestUtil::DpContainerHeader header; + header.deserialize(__callSiteFileName, __callSiteLineNumber, historyBuffer); + header.check( + __callSiteFileName, + __callSiteLineNumber, + historyBuffer, + id, + priority, + timeTag, + procType, + userData, + dataSize + ); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.hpp index 65ceca068..1d56decf2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestGTestBase.ref.hpp @@ -319,6 +319,26 @@ #define ASSERT_TLM_ChannelEnumOnChange(index, value) \ this->assertTlm_ChannelEnumOnChange(__FILE__, __LINE__, index, value) +// ---------------------------------------------------------------------- +// Macros for product request assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_REQUEST_SIZE(size) \ + this->assertProductRequest_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_REQUEST(index, id, size) \ + this->assertProductRequest(__FILE__, __LINE__, index, id, size) + +// ---------------------------------------------------------------------- +// Macros for product send assertions +// ---------------------------------------------------------------------- + +#define ASSERT_PRODUCT_SEND_SIZE(size) \ + this->assertProductSend_size(__FILE__, __LINE__, size) + +#define ASSERT_PRODUCT_SEND(index, id, priority, timeTag, procType, userData, dataSize, buffer) \ + assertProductSend(__FILE__, __LINE__, index, id, priority, timeTag, procType, userData, dataSize, buffer) + //! \class QueuedTestGTestBase //! \brief Auto-generated base for QueuedTest component Google Test harness class QueuedTestGTestBase : @@ -687,6 +707,59 @@ class QueuedTestGTestBase : const E& val //!< The channel value ) const; + protected: + + // ---------------------------------------------------------------------- + // Data Product Request + // ---------------------------------------------------------------------- + + //! Assert size of product request history + void assertProductRequest_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product request history at index + void assertProductRequest( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ) const; + + protected: + + // ---------------------------------------------------------------------- + // Data Product Send + // ---------------------------------------------------------------------- + + //! Assert size of product send history + void assertProductSend_size( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 size //!< The asserted size + ) const; + + //! Assert the product send history at index + //! + //! This function sets the output buffer, deserializes and checks the + //! data product header, and sets the deserialization pointer to the start + //! of the data payload. User-written code can then check the data payload. + void assertProductSend( + const char* const __callSiteFileName, //!< The name of the file containing the call site + const U32 __callSiteLineNumber, //!< The line number of the call site + const U32 __index, //!< The index + FwDpIdType id, //!< The expected container ID (input) + FwDpPriorityType priority, //!< The expected priority (input) + const Fw::Time& timeTag, //!< The expected time tag (input) + Fw::DpCfg::ProcType procType, //!< The expected processing type (input) + const Fw::DpContainer::Header::UserData& userData, //!< The expected user data (input) + FwSizeType dataSize, //!< The expected data size (input) + Fw::Buffer& historyBuffer //!< The buffer from the history (output) + ) const; + }; #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.cpp index d587bc5f8..aca5150fd 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.cpp @@ -149,6 +149,58 @@ void QueuedTestTesterBase :: #endif } + // Connect input port productRequestOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productRequestOut()); + port++ + ) { + this->m_from_productRequestOut[port].init(); + this->m_from_productRequestOut[port].addCallComp( + this, + from_productRequestOut_static + ); + this->m_from_productRequestOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productRequestOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productRequestOut[port].setObjName(portName); +#endif + } + + // Connect input port productSendOut + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_from_productSendOut()); + port++ + ) { + this->m_from_productSendOut[port].init(); + this->m_from_productSendOut[port].addCallComp( + this, + from_productSendOut_static + ); + this->m_from_productSendOut[port].setPortNum(port); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_from_productSendOut[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_from_productSendOut[port].setObjName(portName); +#endif + } + #if FW_ENABLE_TEXT_LOGGING == 1 // Connect input port textEventOut for ( @@ -354,6 +406,27 @@ void QueuedTestTesterBase :: #endif } + // Connect output port productRecvIn + for ( + PlatformIntType port = 0; + port < static_cast(this->getNum_to_productRecvIn()); + port++ + ) { + this->m_to_productRecvIn[port].init(); + +#if FW_OBJECT_NAMES == 1 + char portName[120]; + (void) snprintf( + portName, + sizeof(portName), + "%s_to_productRecvIn[%" PRI_PlatformIntType "]", + this->m_objName, + port + ); + this->m_to_productRecvIn[port].setObjName(portName); +#endif + } + // Connect output port noArgsAsync for ( PlatformIntType port = 0; @@ -646,6 +719,20 @@ void QueuedTestTesterBase :: this->m_to_cmdIn[portNum].addCallPort(port); } +void QueuedTestTesterBase :: + connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, + Fw::InputDpResponsePort* port + ) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + this->m_to_productRecvIn[portNum].addCallPort(port); +} + void QueuedTestTesterBase :: connect_to_noArgsAsync( NATIVE_INT_TYPE portNum, @@ -887,6 +974,28 @@ Fw::InputPrmSetPort* QueuedTestTesterBase :: return &this->m_from_prmSetOut[portNum]; } +Fw::InputDpRequestPort* QueuedTestTesterBase :: + get_from_productRequestOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productRequestOut(), + static_cast(portNum) + ); + + return &this->m_from_productRequestOut[portNum]; +} + +Fw::InputDpSendPort* QueuedTestTesterBase :: + get_from_productSendOut(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_from_productSendOut(), + static_cast(portNum) + ); + + return &this->m_from_productSendOut[portNum]; +} + #if FW_ENABLE_TEXT_LOGGING == 1 Fw::InputLogTextPort* QueuedTestTesterBase :: @@ -1015,6 +1124,10 @@ QueuedTestTesterBase :: this->tlmHistory_ChannelU32OnChange = new History(maxHistorySize); this->tlmHistory_ChannelEnumOnChange = new History(maxHistorySize); + // Initialize data product histories + this->productRequestHistory = new History(maxHistorySize); + this->productSendHistory = new History(maxHistorySize); + // Clear history this->clearHistory(); } @@ -1051,6 +1164,11 @@ QueuedTestTesterBase :: delete this->tlmHistory_ChannelF64; delete this->tlmHistory_ChannelU32OnChange; delete this->tlmHistory_ChannelEnumOnChange; + + // Destroy product request history + delete this->productRequestHistory; + // Destroy product send history + delete this->productSendHistory; } // ---------------------------------------------------------------------- @@ -1430,6 +1548,12 @@ NATIVE_INT_TYPE QueuedTestTesterBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_cmdIn)); } +NATIVE_INT_TYPE QueuedTestTesterBase :: + getNum_to_productRecvIn() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_to_productRecvIn)); +} + NATIVE_INT_TYPE QueuedTestTesterBase :: getNum_to_noArgsAsync() const { @@ -1538,6 +1662,18 @@ NATIVE_INT_TYPE QueuedTestTesterBase :: return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_prmSetOut)); } +NATIVE_INT_TYPE QueuedTestTesterBase :: + getNum_from_productRequestOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productRequestOut)); +} + +NATIVE_INT_TYPE QueuedTestTesterBase :: + getNum_from_productSendOut() const +{ + return static_cast(FW_NUM_ARRAY_ELEMENTS(this->m_from_productSendOut)); +} + #if FW_ENABLE_TEXT_LOGGING == 1 NATIVE_INT_TYPE QueuedTestTesterBase :: @@ -1599,6 +1735,17 @@ bool QueuedTestTesterBase :: return this->m_to_cmdIn[portNum].isConnected(); } +bool QueuedTestTesterBase :: + isConnected_to_productRecvIn(NATIVE_INT_TYPE portNum) +{ + FW_ASSERT( + portNum < this->getNum_to_productRecvIn(), + static_cast(portNum) + ); + + return this->m_to_productRecvIn[portNum].isConnected(); +} + bool QueuedTestTesterBase :: isConnected_to_noArgsAsync(NATIVE_INT_TYPE portNum) { @@ -3413,6 +3560,60 @@ void QueuedTestTesterBase :: this->m_testTime = timeTag; } +// ---------------------------------------------------------------------- +// Functions for testing data products +// ---------------------------------------------------------------------- + +void QueuedTestTesterBase :: + pushProductRequestEntry( + FwDpIdType id, + FwSizeType size + ) +{ + DpRequest e = { id, size }; + this->productRequestHistory->push_back(e); +} + +void QueuedTestTesterBase :: + productRequest_handler( + FwDpIdType id, + FwSizeType size + ) +{ + this->pushProductRequestEntry(id, size); +} + +void QueuedTestTesterBase :: + sendProductResponse( + FwDpIdType id, + const Fw::Buffer& buffer, + const Fw::Success& status + ) +{ + FW_ASSERT(this->getNum_to_productRecvIn() > 0); + FW_ASSERT(this->m_to_productRecvIn[0].isConnected()); + this->m_to_productRecvIn[0].invoke(id, buffer, status); +} + +void QueuedTestTesterBase :: + pushProductSendEntry( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + DpSend e = { id, buffer }; + this->productSendHistory->push_back(e); +} + +void QueuedTestTesterBase :: + productSend_handler( + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + this->pushProductSendEntry(id, buffer); +} + // ---------------------------------------------------------------------- // History functions // ---------------------------------------------------------------------- @@ -3427,6 +3628,8 @@ void QueuedTestTesterBase :: #endif this->clearEvents(); this->clearTlm(); + this->productRequestHistory->clear(); + this->productSendHistory->clear(); } void QueuedTestTesterBase :: @@ -3827,6 +4030,30 @@ void QueuedTestTesterBase :: } } +void QueuedTestTesterBase :: + from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + FwSizeType size + ) +{ + QueuedTestTesterBase* _testerBase = static_cast(callComp); + _testerBase->productRequest_handler(id, size); +} + +void QueuedTestTesterBase :: + from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, + NATIVE_INT_TYPE portNum, + FwDpIdType id, + const Fw::Buffer& buffer + ) +{ + QueuedTestTesterBase* _testerBase = static_cast(callComp); + _testerBase->productSend_handler(id, buffer); +} + #if FW_ENABLE_TEXT_LOGGING == 1 void QueuedTestTesterBase :: diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.hpp index c12bdaacc..8b2eefbf0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/QueuedTestTesterBase.ref.hpp @@ -10,6 +10,7 @@ #include #include "Fw/Comp/PassiveComponentBase.hpp" +#include "Fw/Dp/test/util/DpContainerHeader.hpp" #include "Fw/Port/InputSerializePort.hpp" #include "Fw/Types/Assert.hpp" #include "test-base/QueuedTestComponentAc.hpp" @@ -241,6 +242,18 @@ class QueuedTestTesterBase : E arg; }; + //! A type representing a data product request + struct DpRequest { + FwDpIdType id; + FwSizeType size; + }; + + // A type representing a data product send + struct DpSend { + FwDpIdType id; + Fw::Buffer buffer; + }; + public: // ---------------------------------------------------------------------- @@ -264,6 +277,12 @@ class QueuedTestTesterBase : Fw::InputCmdPort* port //!< The input port ); + //! Connect port to productRecvIn[portNum] + void connect_to_productRecvIn( + NATIVE_INT_TYPE portNum, //!< The port number + Fw::InputDpResponsePort* port //!< The input port + ); + //! Connect port to noArgsAsync[portNum] void connect_to_noArgsAsync( NATIVE_INT_TYPE portNum, //!< The port number @@ -383,6 +402,20 @@ class QueuedTestTesterBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Get from port at index + //! + //! \return from_productRequestOut[portNum] + Fw::InputDpRequestPort* get_from_productRequestOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Get from port at index + //! + //! \return from_productSendOut[portNum] + Fw::InputDpSendPort* get_from_productSendOut( + NATIVE_INT_TYPE portNum //!< The port number + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get from port at index @@ -669,6 +702,11 @@ class QueuedTestTesterBase : //! \return The number of to_cmdIn ports NATIVE_INT_TYPE getNum_to_cmdIn() const; + //! Get the number of to_productRecvIn ports + //! + //! \return The number of to_productRecvIn ports + NATIVE_INT_TYPE getNum_to_productRecvIn() const; + //! Get the number of to_noArgsAsync ports //! //! \return The number of to_noArgsAsync ports @@ -759,6 +797,16 @@ class QueuedTestTesterBase : //! \return The number of from_prmSetOut ports NATIVE_INT_TYPE getNum_from_prmSetOut() const; + //! Get the number of from_productRequestOut ports + //! + //! \return The number of from_productRequestOut ports + NATIVE_INT_TYPE getNum_from_productRequestOut() const; + + //! Get the number of from_productSendOut ports + //! + //! \return The number of from_productSendOut ports + NATIVE_INT_TYPE getNum_from_productSendOut() const; + #if FW_ENABLE_TEXT_LOGGING == 1 //! Get the number of from_textEventOut ports @@ -811,6 +859,13 @@ class QueuedTestTesterBase : NATIVE_INT_TYPE portNum //!< The port number ); + //! Check whether port to_productRecvIn is connected + //! + //! \return Whether port to_productRecvIn is connected + bool isConnected_to_productRecvIn( + NATIVE_INT_TYPE portNum //!< The port number + ); + //! Check whether port to_noArgsAsync is connected //! //! \return Whether port to_noArgsAsync is connected @@ -1306,6 +1361,49 @@ class QueuedTestTesterBase : const Fw::Time& timeTag //!< The time ); + protected: + + // ---------------------------------------------------------------------- + // Functions for testing data products + // ---------------------------------------------------------------------- + + //! Push an entry on the product request history + void pushProductRequestEntry( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Handle a data product request from the component under test + //! + //! By default, call pushProductRequestEntry. You can override + //! this behavior. + virtual void productRequest_handler( + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Send a data product response to the component under test + void sendProductResponse( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer, //!< The buffer + const Fw::Success& status //!< The status + ); + + //! Push an entry on the product send history + void pushProductSendEntry( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + + //! Handle a data product send from the component under test + //! + //! By default, call pushProductSendEntry. You can override + //! this behavior. + virtual void productSend_handler( + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + protected: // ---------------------------------------------------------------------- @@ -1413,6 +1511,22 @@ class QueuedTestTesterBase : Fw::ParamBuffer& val //!< Buffer containing serialized parameter value ); + //! Static function for port from_productRequestOut + static void from_productRequestOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + FwSizeType size //!< The size of the requested buffer + ); + + //! Static function for port from_productSendOut + static void from_productSendOut_static( + Fw::PassiveComponentBase* const callComp, //!< The component instance + NATIVE_INT_TYPE portNum, //!< The port number + FwDpIdType id, //!< The container ID + const Fw::Buffer& buffer //!< The buffer + ); + #if FW_ENABLE_TEXT_LOGGING == 1 //! Static function for port from_textEventOut @@ -1572,6 +1686,12 @@ class QueuedTestTesterBase : //! The history of ChannelEnumOnChange values History* tlmHistory_ChannelEnumOnChange; + //! The data product request history + History* productRequestHistory; + + //! The data product send history + History* productSendHistory; + private: // ---------------------------------------------------------------------- @@ -1581,6 +1701,9 @@ class QueuedTestTesterBase : //! To port connected to cmdIn Fw::OutputCmdPort m_to_cmdIn[1]; + //! To port connected to productRecvIn + Fw::OutputDpResponsePort m_to_productRecvIn[1]; + //! To port connected to noArgsAsync Ports::OutputNoArgsPort m_to_noArgsAsync[1]; @@ -1641,6 +1764,12 @@ class QueuedTestTesterBase : //! From port connected to prmSetOut Fw::InputPrmSetPort m_from_prmSetOut[1]; + //! From port connected to productRequestOut + Fw::InputDpRequestPort m_from_productRequestOut[1]; + + //! From port connected to productSendOut + Fw::InputDpSendPort m_from_productSendOut[1]; + #if FW_ENABLE_TEXT_LOGGING == 1 //! From port connected to textEventOut diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/run.sh b/compiler/tools/fpp-to-cpp/test/component/test-base/run.sh index 723fdd4c6..ea6422f14 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/run.sh +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/run.sh @@ -12,32 +12,47 @@ empty() passive() { run_test "-u -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive && \ - diff_test PassiveTest && \ - diff_test PassiveSerial && \ diff_test PassiveCommands && \ diff_test PassiveEvents && \ + diff_test PassiveGetProductPortsOnly && \ + diff_test PassiveGetProducts && \ + diff_test PassiveGuardedProducts && \ + diff_test PassiveParams && \ + diff_test PassiveSerial && \ + diff_test PassiveSyncProductPortsOnly && \ + diff_test PassiveSyncProducts && \ diff_test PassiveTelemetry && \ - diff_test PassiveParams + diff_test PassiveTest } active() { run_test "-u -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active && \ - diff_test ActiveTest && \ - diff_test ActiveSerial && \ + diff_test ActiveAsyncProducts && \ + diff_test ActiveAsyncProductPortsOnly && \ diff_test ActiveCommands && \ diff_test ActiveEvents && \ + diff_test ActiveGetProducts && \ + diff_test ActiveGuardedProducts && \ + diff_test ActiveParams &&\ + diff_test ActiveSerial && \ + diff_test ActiveSyncProducts && \ diff_test ActiveTelemetry && \ - diff_test ActiveParams + diff_test ActiveTest } queued() { run_test "-u -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued && \ - diff_test QueuedTest && \ - diff_test QueuedSerial && \ + diff_test QueuedAsyncProducts && \ + diff_test QueuedAsyncProductPortsOnly && \ diff_test QueuedCommands && \ diff_test QueuedEvents && \ + diff_test QueuedGetProducts && \ + diff_test QueuedGuardedProducts && \ + diff_test QueuedParams && \ + diff_test QueuedSerial && \ + diff_test QueuedSyncProducts diff_test QueuedTelemetry && \ - diff_test QueuedParams + diff_test QueuedTest } diff --git a/compiler/tools/fpp-to-cpp/test/component/test-base/update-ref.sh b/compiler/tools/fpp-to-cpp/test/component/test-base/update-ref.sh index ccbc8b38c..c44bff5fe 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-base/update-ref.sh +++ b/compiler/tools/fpp-to-cpp/test/component/test-base/update-ref.sh @@ -12,32 +12,47 @@ empty() passive() { update "-u -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive - move_test PassiveTest - move_test PassiveSerial move_test PassiveCommands move_test PassiveEvents - move_test PassiveTelemetry + move_test PassiveGetProductPortsOnly + move_test PassiveGetProducts + move_test PassiveGuardedProducts move_test PassiveParams + move_test PassiveSerial + move_test PassiveSyncProductPortsOnly + move_test PassiveSyncProducts + move_test PassiveTelemetry + move_test PassiveTest } active() { update "-u -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active - move_test ActiveTest - move_test ActiveSerial + move_test ActiveAsyncProducts + move_test ActiveAsyncProductPortsOnly move_test ActiveCommands move_test ActiveEvents - move_test ActiveTelemetry + move_test ActiveGetProducts + move_test ActiveGuardedProducts move_test ActiveParams + move_test ActiveSerial + move_test ActiveSyncProducts + move_test ActiveTelemetry + move_test ActiveTest } queued() { update "-u -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued - move_test QueuedTest - move_test QueuedSerial + move_test QueuedAsyncProducts + move_test QueuedAsyncProductPortsOnly move_test QueuedCommands move_test QueuedEvents - move_test QueuedTelemetry + move_test QueuedGetProducts + move_test QueuedGuardedProducts move_test QueuedParams + move_test QueuedSerial + move_test QueuedSyncProducts + move_test QueuedTelemetry + move_test QueuedTest } diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTestMain.ref.cpp new file mode 100644 index 000000000..fca681401 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "ActiveAsyncProductPortsOnlyTester.hpp" + +TEST(Nominal, toDo) { + ActiveAsyncProductPortsOnlyTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTester.ref.cpp new file mode 100644 index 000000000..7b2187ac2 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTester.ref.cpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "ActiveAsyncProductPortsOnlyTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductPortsOnlyTester :: + ActiveAsyncProductPortsOnlyTester() : + ActiveAsyncProductPortsOnlyGTestBase("ActiveAsyncProductPortsOnlyTester", ActiveAsyncProductPortsOnlyTester::MAX_HISTORY_SIZE), + component("ActiveAsyncProductPortsOnly") +{ + this->initComponents(); + this->connectPorts(); +} + +ActiveAsyncProductPortsOnlyTester :: + ~ActiveAsyncProductPortsOnlyTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyTester :: + toDo() +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTester.ref.hpp new file mode 100644 index 000000000..db0e29101 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTester.ref.hpp @@ -0,0 +1,76 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#ifndef ActiveAsyncProductPortsOnlyTester_HPP +#define ActiveAsyncProductPortsOnlyTester_HPP + +#include "ActiveAsyncProductPortsOnlyGTestBase.hpp" +#include "ActiveAsyncProductPortsOnly.hpp" + +class ActiveAsyncProductPortsOnlyTester : + public ActiveAsyncProductPortsOnlyGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveAsyncProductPortsOnlyTester + ActiveAsyncProductPortsOnlyTester(); + + //! Destroy object ActiveAsyncProductPortsOnlyTester + ~ActiveAsyncProductPortsOnlyTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + ActiveAsyncProductPortsOnly component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTesterHelpers.ref.cpp new file mode 100644 index 000000000..e47acc18d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductPortsOnlyTesterHelpers.ref.cpp @@ -0,0 +1,24 @@ +// ====================================================================== +// \title ActiveAsyncProductPortsOnlyTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "ActiveAsyncProductPortsOnlyTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void ActiveAsyncProductPortsOnlyTester :: + connectPorts() +{ + +} + +void ActiveAsyncProductPortsOnlyTester :: + initComponents() +{ + this->init(); + this->component.init(ActiveAsyncProductPortsOnlyTester::TEST_INSTANCE_QUEUE_DEPTH, ActiveAsyncProductPortsOnlyTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTestMain.ref.cpp new file mode 100644 index 000000000..c19952640 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title ActiveAsyncProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component test harness implementation class +// ====================================================================== + +#include "ActiveAsyncProductsTester.hpp" + +TEST(Nominal, toDo) { + ActiveAsyncProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTester.ref.cpp new file mode 100644 index 000000000..e06ddedc5 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title ActiveAsyncProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component test harness implementation class +// ====================================================================== + +#include "ActiveAsyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveAsyncProductsTester :: + ActiveAsyncProductsTester() : + ActiveAsyncProductsGTestBase("ActiveAsyncProductsTester", ActiveAsyncProductsTester::MAX_HISTORY_SIZE), + component("ActiveAsyncProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +ActiveAsyncProductsTester :: + ~ActiveAsyncProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveAsyncProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveAsyncProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveAsyncProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTester.ref.hpp new file mode 100644 index 000000000..164c48596 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title ActiveAsyncProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveAsyncProducts component test harness implementation class +// ====================================================================== + +#ifndef ActiveAsyncProductsTester_HPP +#define ActiveAsyncProductsTester_HPP + +#include "ActiveAsyncProductsGTestBase.hpp" +#include "ActiveAsyncProducts.hpp" + +class ActiveAsyncProductsTester : + public ActiveAsyncProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveAsyncProductsTester + ActiveAsyncProductsTester(); + + //! Destroy object ActiveAsyncProductsTester + ~ActiveAsyncProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + ActiveAsyncProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..886da4ce4 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveAsyncProductsTesterHelpers.ref.cpp @@ -0,0 +1,143 @@ +// ====================================================================== +// \title ActiveAsyncProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveAsyncProducts component test harness implementation class +// ====================================================================== + +#include "ActiveAsyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void ActiveAsyncProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void ActiveAsyncProductsTester :: + initComponents() +{ + this->init(); + this->component.init(ActiveAsyncProductsTester::TEST_INSTANCE_QUEUE_DEPTH, ActiveAsyncProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTestMain.ref.cpp new file mode 100644 index 000000000..5651abdba --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title ActiveGetProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component test harness implementation class +// ====================================================================== + +#include "ActiveGetProductsTester.hpp" + +TEST(Nominal, toDo) { + ActiveGetProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTester.ref.cpp new file mode 100644 index 000000000..8a028f8d0 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title ActiveGetProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component test harness implementation class +// ====================================================================== + +#include "ActiveGetProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveGetProductsTester :: + ActiveGetProductsTester() : + ActiveGetProductsGTestBase("ActiveGetProductsTester", ActiveGetProductsTester::MAX_HISTORY_SIZE), + component("ActiveGetProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +ActiveGetProductsTester :: + ~ActiveGetProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void ActiveGetProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void ActiveGetProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveGetProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveGetProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveGetProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTester.ref.hpp new file mode 100644 index 000000000..9bdfd133e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title ActiveGetProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGetProducts component test harness implementation class +// ====================================================================== + +#ifndef ActiveGetProductsTester_HPP +#define ActiveGetProductsTester_HPP + +#include "ActiveGetProductsGTestBase.hpp" +#include "ActiveGetProducts.hpp" + +class ActiveGetProductsTester : + public ActiveGetProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveGetProductsTester + ActiveGetProductsTester(); + + //! Destroy object ActiveGetProductsTester + ~ActiveGetProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + ActiveGetProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..366029efe --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGetProductsTesterHelpers.ref.cpp @@ -0,0 +1,136 @@ +// ====================================================================== +// \title ActiveGetProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGetProducts component test harness implementation class +// ====================================================================== + +#include "ActiveGetProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void ActiveGetProductsTester :: + connectPorts() +{ + // Connect special output ports + + this->component.set_productGetOut_OutputPort( + 0, + this->get_from_productGetOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void ActiveGetProductsTester :: + initComponents() +{ + this->init(); + this->component.init(ActiveGetProductsTester::TEST_INSTANCE_QUEUE_DEPTH, ActiveGetProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTestMain.ref.cpp new file mode 100644 index 000000000..f8f62ba49 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title ActiveGuardedProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component test harness implementation class +// ====================================================================== + +#include "ActiveGuardedProductsTester.hpp" + +TEST(Nominal, toDo) { + ActiveGuardedProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTester.ref.cpp new file mode 100644 index 000000000..06c2b6e75 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title ActiveGuardedProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component test harness implementation class +// ====================================================================== + +#include "ActiveGuardedProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveGuardedProductsTester :: + ActiveGuardedProductsTester() : + ActiveGuardedProductsGTestBase("ActiveGuardedProductsTester", ActiveGuardedProductsTester::MAX_HISTORY_SIZE), + component("ActiveGuardedProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +ActiveGuardedProductsTester :: + ~ActiveGuardedProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveGuardedProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveGuardedProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveGuardedProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTester.ref.hpp new file mode 100644 index 000000000..a4edc7a80 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title ActiveGuardedProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveGuardedProducts component test harness implementation class +// ====================================================================== + +#ifndef ActiveGuardedProductsTester_HPP +#define ActiveGuardedProductsTester_HPP + +#include "ActiveGuardedProductsGTestBase.hpp" +#include "ActiveGuardedProducts.hpp" + +class ActiveGuardedProductsTester : + public ActiveGuardedProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveGuardedProductsTester + ActiveGuardedProductsTester(); + + //! Destroy object ActiveGuardedProductsTester + ~ActiveGuardedProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + ActiveGuardedProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..fb0c20f74 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveGuardedProductsTesterHelpers.ref.cpp @@ -0,0 +1,143 @@ +// ====================================================================== +// \title ActiveGuardedProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveGuardedProducts component test harness implementation class +// ====================================================================== + +#include "ActiveGuardedProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void ActiveGuardedProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void ActiveGuardedProductsTester :: + initComponents() +{ + this->init(); + this->component.init(ActiveGuardedProductsTester::TEST_INSTANCE_QUEUE_DEPTH, ActiveGuardedProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTestMain.ref.cpp new file mode 100644 index 000000000..f55425f8c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title ActiveSyncProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component test harness implementation class +// ====================================================================== + +#include "ActiveSyncProductsTester.hpp" + +TEST(Nominal, toDo) { + ActiveSyncProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTester.ref.cpp new file mode 100644 index 000000000..7504ad48d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title ActiveSyncProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component test harness implementation class +// ====================================================================== + +#include "ActiveSyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +ActiveSyncProductsTester :: + ActiveSyncProductsTester() : + ActiveSyncProductsGTestBase("ActiveSyncProductsTester", ActiveSyncProductsTester::MAX_HISTORY_SIZE), + component("ActiveSyncProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +ActiveSyncProductsTester :: + ~ActiveSyncProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 ActiveSyncProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void ActiveSyncProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 ActiveSyncProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTester.ref.hpp new file mode 100644 index 000000000..765b71ce3 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title ActiveSyncProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for ActiveSyncProducts component test harness implementation class +// ====================================================================== + +#ifndef ActiveSyncProductsTester_HPP +#define ActiveSyncProductsTester_HPP + +#include "ActiveSyncProductsGTestBase.hpp" +#include "ActiveSyncProducts.hpp" + +class ActiveSyncProductsTester : + public ActiveSyncProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object ActiveSyncProductsTester + ActiveSyncProductsTester(); + + //! Destroy object ActiveSyncProductsTester + ~ActiveSyncProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + ActiveSyncProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..4a8fcc81a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveSyncProductsTesterHelpers.ref.cpp @@ -0,0 +1,143 @@ +// ====================================================================== +// \title ActiveSyncProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for ActiveSyncProducts component test harness implementation class +// ====================================================================== + +#include "ActiveSyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void ActiveSyncProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void ActiveSyncProductsTester :: + initComponents() +{ + this->init(); + this->component.init(ActiveSyncProductsTester::TEST_INSTANCE_QUEUE_DEPTH, ActiveSyncProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveTestTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveTestTesterHelpers.ref.cpp index 0573abb1c..93efd9904 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveTestTesterHelpers.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/ActiveTestTesterHelpers.ref.cpp @@ -22,6 +22,11 @@ namespace M { this->component.get_cmdIn_InputPort(0) ); + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + // Connect special output ports this->component.set_cmdRegOut_OutputPort( @@ -49,6 +54,16 @@ namespace M { this->get_from_prmSetOut(0) ); + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + this->component.set_textEventOut_OutputPort( 0, this->get_from_textEventOut(0) diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTestMain.ref.cpp new file mode 100644 index 000000000..9e88ac3f6 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "PassiveGetProductPortsOnlyTester.hpp" + +TEST(Nominal, toDo) { + PassiveGetProductPortsOnlyTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTester.ref.cpp new file mode 100644 index 000000000..5e0dcca9b --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTester.ref.cpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "PassiveGetProductPortsOnlyTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductPortsOnlyTester :: + PassiveGetProductPortsOnlyTester() : + PassiveGetProductPortsOnlyGTestBase("PassiveGetProductPortsOnlyTester", PassiveGetProductPortsOnlyTester::MAX_HISTORY_SIZE), + component("PassiveGetProductPortsOnly") +{ + this->initComponents(); + this->connectPorts(); +} + +PassiveGetProductPortsOnlyTester :: + ~PassiveGetProductPortsOnlyTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void PassiveGetProductPortsOnlyTester :: + toDo() +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTester.ref.hpp new file mode 100644 index 000000000..1bed4f3c9 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTester.ref.hpp @@ -0,0 +1,73 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProductPortsOnly component test harness implementation class +// ====================================================================== + +#ifndef PassiveGetProductPortsOnlyTester_HPP +#define PassiveGetProductPortsOnlyTester_HPP + +#include "PassiveGetProductPortsOnlyGTestBase.hpp" +#include "PassiveGetProductPortsOnly.hpp" + +class PassiveGetProductPortsOnlyTester : + public PassiveGetProductPortsOnlyGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGetProductPortsOnlyTester + PassiveGetProductPortsOnlyTester(); + + //! Destroy object PassiveGetProductPortsOnlyTester + ~PassiveGetProductPortsOnlyTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + PassiveGetProductPortsOnly component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTesterHelpers.ref.cpp new file mode 100644 index 000000000..fab7b377e --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductPortsOnlyTesterHelpers.ref.cpp @@ -0,0 +1,24 @@ +// ====================================================================== +// \title PassiveGetProductPortsOnlyTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "PassiveGetProductPortsOnlyTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void PassiveGetProductPortsOnlyTester :: + connectPorts() +{ + +} + +void PassiveGetProductPortsOnlyTester :: + initComponents() +{ + this->init(); + this->component.init(PassiveGetProductPortsOnlyTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTestMain.ref.cpp new file mode 100644 index 000000000..aef31abc5 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title PassiveGetProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component test harness implementation class +// ====================================================================== + +#include "PassiveGetProductsTester.hpp" + +TEST(Nominal, toDo) { + PassiveGetProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTester.ref.cpp new file mode 100644 index 000000000..c00a5700c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title PassiveGetProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component test harness implementation class +// ====================================================================== + +#include "PassiveGetProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveGetProductsTester :: + PassiveGetProductsTester() : + PassiveGetProductsGTestBase("PassiveGetProductsTester", PassiveGetProductsTester::MAX_HISTORY_SIZE), + component("PassiveGetProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +PassiveGetProductsTester :: + ~PassiveGetProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void PassiveGetProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void PassiveGetProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 PassiveGetProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void PassiveGetProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 PassiveGetProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTester.ref.hpp new file mode 100644 index 000000000..e33ba55ed --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTester.ref.hpp @@ -0,0 +1,113 @@ +// ====================================================================== +// \title PassiveGetProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGetProducts component test harness implementation class +// ====================================================================== + +#ifndef PassiveGetProductsTester_HPP +#define PassiveGetProductsTester_HPP + +#include "PassiveGetProductsGTestBase.hpp" +#include "PassiveGetProducts.hpp" + +class PassiveGetProductsTester : + public PassiveGetProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGetProductsTester + PassiveGetProductsTester(); + + //! Destroy object PassiveGetProductsTester + ~PassiveGetProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + PassiveGetProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..fbc1e39ca --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGetProductsTesterHelpers.ref.cpp @@ -0,0 +1,111 @@ +// ====================================================================== +// \title PassiveGetProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGetProducts component test harness implementation class +// ====================================================================== + +#include "PassiveGetProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void PassiveGetProductsTester :: + connectPorts() +{ + // Connect special output ports + + this->component.set_productGetOut_OutputPort( + 0, + this->get_from_productGetOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void PassiveGetProductsTester :: + initComponents() +{ + this->init(); + this->component.init(PassiveGetProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTestMain.ref.cpp new file mode 100644 index 000000000..26dd9279d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title PassiveGuardedProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component test harness implementation class +// ====================================================================== + +#include "PassiveGuardedProductsTester.hpp" + +TEST(Nominal, toDo) { + PassiveGuardedProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTester.ref.cpp new file mode 100644 index 000000000..70a9ba7b8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title PassiveGuardedProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component test harness implementation class +// ====================================================================== + +#include "PassiveGuardedProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveGuardedProductsTester :: + PassiveGuardedProductsTester() : + PassiveGuardedProductsGTestBase("PassiveGuardedProductsTester", PassiveGuardedProductsTester::MAX_HISTORY_SIZE), + component("PassiveGuardedProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +PassiveGuardedProductsTester :: + ~PassiveGuardedProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 PassiveGuardedProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void PassiveGuardedProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 PassiveGuardedProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTester.ref.hpp new file mode 100644 index 000000000..e2e1ab5b3 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTester.ref.hpp @@ -0,0 +1,113 @@ +// ====================================================================== +// \title PassiveGuardedProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveGuardedProducts component test harness implementation class +// ====================================================================== + +#ifndef PassiveGuardedProductsTester_HPP +#define PassiveGuardedProductsTester_HPP + +#include "PassiveGuardedProductsGTestBase.hpp" +#include "PassiveGuardedProducts.hpp" + +class PassiveGuardedProductsTester : + public PassiveGuardedProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveGuardedProductsTester + PassiveGuardedProductsTester(); + + //! Destroy object PassiveGuardedProductsTester + ~PassiveGuardedProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + PassiveGuardedProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..4d914e1ae --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveGuardedProductsTesterHelpers.ref.cpp @@ -0,0 +1,118 @@ +// ====================================================================== +// \title PassiveGuardedProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveGuardedProducts component test harness implementation class +// ====================================================================== + +#include "PassiveGuardedProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void PassiveGuardedProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void PassiveGuardedProductsTester :: + initComponents() +{ + this->init(); + this->component.init(PassiveGuardedProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTestMain.ref.cpp new file mode 100644 index 000000000..cf96b210c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "PassiveSyncProductPortsOnlyTester.hpp" + +TEST(Nominal, toDo) { + PassiveSyncProductPortsOnlyTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTester.ref.cpp new file mode 100644 index 000000000..36b0029db --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTester.ref.cpp @@ -0,0 +1,36 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "PassiveSyncProductPortsOnlyTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductPortsOnlyTester :: + PassiveSyncProductPortsOnlyTester() : + PassiveSyncProductPortsOnlyGTestBase("PassiveSyncProductPortsOnlyTester", PassiveSyncProductPortsOnlyTester::MAX_HISTORY_SIZE), + component("PassiveSyncProductPortsOnly") +{ + this->initComponents(); + this->connectPorts(); +} + +PassiveSyncProductPortsOnlyTester :: + ~PassiveSyncProductPortsOnlyTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyTester :: + toDo() +{ + // TODO +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTester.ref.hpp new file mode 100644 index 000000000..9aee68dcd --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTester.ref.hpp @@ -0,0 +1,73 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#ifndef PassiveSyncProductPortsOnlyTester_HPP +#define PassiveSyncProductPortsOnlyTester_HPP + +#include "PassiveSyncProductPortsOnlyGTestBase.hpp" +#include "PassiveSyncProductPortsOnly.hpp" + +class PassiveSyncProductPortsOnlyTester : + public PassiveSyncProductPortsOnlyGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveSyncProductPortsOnlyTester + PassiveSyncProductPortsOnlyTester(); + + //! Destroy object PassiveSyncProductPortsOnlyTester + ~PassiveSyncProductPortsOnlyTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + PassiveSyncProductPortsOnly component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTesterHelpers.ref.cpp new file mode 100644 index 000000000..c7833fa9c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductPortsOnlyTesterHelpers.ref.cpp @@ -0,0 +1,24 @@ +// ====================================================================== +// \title PassiveSyncProductPortsOnlyTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProductPortsOnly component test harness implementation class +// ====================================================================== + +#include "PassiveSyncProductPortsOnlyTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void PassiveSyncProductPortsOnlyTester :: + connectPorts() +{ + +} + +void PassiveSyncProductPortsOnlyTester :: + initComponents() +{ + this->init(); + this->component.init(PassiveSyncProductPortsOnlyTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTestMain.ref.cpp new file mode 100644 index 000000000..edd339804 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title PassiveSyncProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component test harness implementation class +// ====================================================================== + +#include "PassiveSyncProductsTester.hpp" + +TEST(Nominal, toDo) { + PassiveSyncProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTester.ref.cpp new file mode 100644 index 000000000..1d21839a6 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title PassiveSyncProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component test harness implementation class +// ====================================================================== + +#include "PassiveSyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +PassiveSyncProductsTester :: + PassiveSyncProductsTester() : + PassiveSyncProductsGTestBase("PassiveSyncProductsTester", PassiveSyncProductsTester::MAX_HISTORY_SIZE), + component("PassiveSyncProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +PassiveSyncProductsTester :: + ~PassiveSyncProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 PassiveSyncProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void PassiveSyncProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 PassiveSyncProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTester.ref.hpp new file mode 100644 index 000000000..c5b062dd1 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTester.ref.hpp @@ -0,0 +1,113 @@ +// ====================================================================== +// \title PassiveSyncProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for PassiveSyncProducts component test harness implementation class +// ====================================================================== + +#ifndef PassiveSyncProductsTester_HPP +#define PassiveSyncProductsTester_HPP + +#include "PassiveSyncProductsGTestBase.hpp" +#include "PassiveSyncProducts.hpp" + +class PassiveSyncProductsTester : + public PassiveSyncProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object PassiveSyncProductsTester + PassiveSyncProductsTester(); + + //! Destroy object PassiveSyncProductsTester + ~PassiveSyncProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + PassiveSyncProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..dfa5e628c --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveSyncProductsTesterHelpers.ref.cpp @@ -0,0 +1,118 @@ +// ====================================================================== +// \title PassiveSyncProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for PassiveSyncProducts component test harness implementation class +// ====================================================================== + +#include "PassiveSyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void PassiveSyncProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void PassiveSyncProductsTester :: + initComponents() +{ + this->init(); + this->component.init(PassiveSyncProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveTestTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveTestTesterHelpers.ref.cpp index 809ffd1d0..65de8ffd4 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveTestTesterHelpers.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/PassiveTestTesterHelpers.ref.cpp @@ -20,6 +20,11 @@ void PassiveTestTester :: this->component.get_cmdIn_InputPort(0) ); + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + // Connect special output ports this->component.set_cmdRegOut_OutputPort( @@ -47,6 +52,16 @@ void PassiveTestTester :: this->get_from_prmSetOut(0) ); + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + this->component.set_textEventOut_OutputPort( 0, this->get_from_textEventOut(0) diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTestMain.ref.cpp new file mode 100644 index 000000000..f14b928d6 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title QueuedGetProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component test harness implementation class +// ====================================================================== + +#include "QueuedGetProductsTester.hpp" + +TEST(Nominal, toDo) { + QueuedGetProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTester.ref.cpp new file mode 100644 index 000000000..7347b661f --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title QueuedGetProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component test harness implementation class +// ====================================================================== + +#include "QueuedGetProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedGetProductsTester :: + QueuedGetProductsTester() : + QueuedGetProductsGTestBase("QueuedGetProductsTester", QueuedGetProductsTester::MAX_HISTORY_SIZE), + component("QueuedGetProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +QueuedGetProductsTester :: + ~QueuedGetProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void QueuedGetProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void QueuedGetProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedGetProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedGetProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedGetProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTester.ref.hpp new file mode 100644 index 000000000..9d6e784a5 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title QueuedGetProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGetProducts component test harness implementation class +// ====================================================================== + +#ifndef QueuedGetProductsTester_HPP +#define QueuedGetProductsTester_HPP + +#include "QueuedGetProductsGTestBase.hpp" +#include "QueuedGetProducts.hpp" + +class QueuedGetProductsTester : + public QueuedGetProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedGetProductsTester + QueuedGetProductsTester(); + + //! Destroy object QueuedGetProductsTester + ~QueuedGetProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + QueuedGetProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..8780a5986 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGetProductsTesterHelpers.ref.cpp @@ -0,0 +1,136 @@ +// ====================================================================== +// \title QueuedGetProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGetProducts component test harness implementation class +// ====================================================================== + +#include "QueuedGetProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void QueuedGetProductsTester :: + connectPorts() +{ + // Connect special output ports + + this->component.set_productGetOut_OutputPort( + 0, + this->get_from_productGetOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void QueuedGetProductsTester :: + initComponents() +{ + this->init(); + this->component.init(QueuedGetProductsTester::TEST_INSTANCE_QUEUE_DEPTH, QueuedGetProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTestMain.ref.cpp new file mode 100644 index 000000000..d7509b624 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title QueuedGuardedProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component test harness implementation class +// ====================================================================== + +#include "QueuedGuardedProductsTester.hpp" + +TEST(Nominal, toDo) { + QueuedGuardedProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTester.ref.cpp new file mode 100644 index 000000000..156015417 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title QueuedGuardedProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component test harness implementation class +// ====================================================================== + +#include "QueuedGuardedProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedGuardedProductsTester :: + QueuedGuardedProductsTester() : + QueuedGuardedProductsGTestBase("QueuedGuardedProductsTester", QueuedGuardedProductsTester::MAX_HISTORY_SIZE), + component("QueuedGuardedProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +QueuedGuardedProductsTester :: + ~QueuedGuardedProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedGuardedProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedGuardedProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedGuardedProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTester.ref.hpp new file mode 100644 index 000000000..ba6956ab1 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title QueuedGuardedProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedGuardedProducts component test harness implementation class +// ====================================================================== + +#ifndef QueuedGuardedProductsTester_HPP +#define QueuedGuardedProductsTester_HPP + +#include "QueuedGuardedProductsGTestBase.hpp" +#include "QueuedGuardedProducts.hpp" + +class QueuedGuardedProductsTester : + public QueuedGuardedProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedGuardedProductsTester + QueuedGuardedProductsTester(); + + //! Destroy object QueuedGuardedProductsTester + ~QueuedGuardedProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + QueuedGuardedProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..81ca1264d --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedGuardedProductsTesterHelpers.ref.cpp @@ -0,0 +1,143 @@ +// ====================================================================== +// \title QueuedGuardedProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedGuardedProducts component test harness implementation class +// ====================================================================== + +#include "QueuedGuardedProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void QueuedGuardedProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void QueuedGuardedProductsTester :: + initComponents() +{ + this->init(); + this->component.init(QueuedGuardedProductsTester::TEST_INSTANCE_QUEUE_DEPTH, QueuedGuardedProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTestMain.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTestMain.ref.cpp new file mode 100644 index 000000000..2e07cb3d8 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTestMain.ref.cpp @@ -0,0 +1,17 @@ +// ====================================================================== +// \title QueuedSyncProductsTestMain.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component test harness implementation class +// ====================================================================== + +#include "QueuedSyncProductsTester.hpp" + +TEST(Nominal, toDo) { + QueuedSyncProductsTester tester; + tester.toDo(); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTester.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTester.ref.cpp new file mode 100644 index 000000000..5f7684b11 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTester.ref.cpp @@ -0,0 +1,82 @@ +// ====================================================================== +// \title QueuedSyncProductsTester.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component test harness implementation class +// ====================================================================== + +#include "QueuedSyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Construction and destruction +// ---------------------------------------------------------------------- + +QueuedSyncProductsTester :: + QueuedSyncProductsTester() : + QueuedSyncProductsGTestBase("QueuedSyncProductsTester", QueuedSyncProductsTester::MAX_HISTORY_SIZE), + component("QueuedSyncProducts") +{ + this->initComponents(); + this->connectPorts(); +} + +QueuedSyncProductsTester :: + ~QueuedSyncProductsTester() +{ + +} + +// ---------------------------------------------------------------------- +// Tests +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTester :: + toDo() +{ + // TODO +} + +// ---------------------------------------------------------------------- +// Handlers for typed from ports +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTester :: + from_noArgsOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO +} + +U32 QueuedSyncProductsTester :: + from_noArgsReturnOut_handler(NATIVE_INT_TYPE portNum) +{ + // TODO return +} + +void QueuedSyncProductsTester :: + from_typedOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedPortStrings::StringSize80& str1, + const E& e, + const A& a, + const S& s + ) +{ + // TODO +} + +F32 QueuedSyncProductsTester :: + from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, + U32 u32, + F32 f32, + bool b, + const Ports::TypedReturnPortStrings::StringSize80& str2, + const E& e, + const A& a, + const S& s + ) +{ + // TODO return +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTester.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTester.ref.hpp new file mode 100644 index 000000000..b29cd9285 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTester.ref.hpp @@ -0,0 +1,116 @@ +// ====================================================================== +// \title QueuedSyncProductsTester.hpp +// \author Generated by fpp-to-cpp +// \brief hpp file for QueuedSyncProducts component test harness implementation class +// ====================================================================== + +#ifndef QueuedSyncProductsTester_HPP +#define QueuedSyncProductsTester_HPP + +#include "QueuedSyncProductsGTestBase.hpp" +#include "QueuedSyncProducts.hpp" + +class QueuedSyncProductsTester : + public QueuedSyncProductsGTestBase +{ + + public: + + // ---------------------------------------------------------------------- + // Constants + // ---------------------------------------------------------------------- + + // Maximum size of histories storing events, telemetry, and port outputs + static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10; + + // Instance ID supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0; + + // Queue depth supplied to the component instance under test + static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10; + + public: + + // ---------------------------------------------------------------------- + // Construction and destruction + // ---------------------------------------------------------------------- + + //! Construct object QueuedSyncProductsTester + QueuedSyncProductsTester(); + + //! Destroy object QueuedSyncProductsTester + ~QueuedSyncProductsTester(); + + public: + + // ---------------------------------------------------------------------- + // Tests + // ---------------------------------------------------------------------- + + //! To do + void toDo(); + + private: + + // ---------------------------------------------------------------------- + // Handlers for typed from ports + // ---------------------------------------------------------------------- + + //! Handler implementation for noArgsOut + void from_noArgsOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for noArgsReturnOut + U32 from_noArgsReturnOut_handler( + NATIVE_INT_TYPE portNum //!< The port number + ); + + //! Handler implementation for typedOut + void from_typedOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedPortStrings::StringSize80& str1, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + //! Handler implementation for typedReturnOut + F32 from_typedReturnOut_handler( + NATIVE_INT_TYPE portNum, //!< The port number + U32 u32, //!< A U32 + F32 f32, //!< An F32 + bool b, //!< A boolean + const Ports::TypedReturnPortStrings::StringSize80& str2, //!< A string + const E& e, //!< An enum + const A& a, //!< An array + const S& s //!< A struct + ); + + private: + + // ---------------------------------------------------------------------- + // Helper functions + // ---------------------------------------------------------------------- + + //! Connect ports + void connectPorts(); + + //! Initialize components + void initComponents(); + + private: + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! The component under test + QueuedSyncProducts component; + +}; + +#endif diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTesterHelpers.ref.cpp new file mode 100644 index 000000000..8352902e6 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedSyncProductsTesterHelpers.ref.cpp @@ -0,0 +1,143 @@ +// ====================================================================== +// \title QueuedSyncProductsTesterHelpers.cpp +// \author Generated by fpp-to-cpp +// \brief cpp file for QueuedSyncProducts component test harness implementation class +// ====================================================================== + +#include "QueuedSyncProductsTester.hpp" + +// ---------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------- + +void QueuedSyncProductsTester :: + connectPorts() +{ + // Connect special input ports + + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + + // Connect special output ports + + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + + this->component.set_timeGetOut_OutputPort( + 0, + this->get_from_timeGetOut(0) + ); + + // Connect typed input ports + + this->connect_to_noArgsAsync( + 0, + this->component.get_noArgsAsync_InputPort(0) + ); + + this->connect_to_noArgsGuarded( + 0, + this->component.get_noArgsGuarded_InputPort(0) + ); + + this->connect_to_noArgsReturnGuarded( + 0, + this->component.get_noArgsReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsReturnSync( + i, + this->component.get_noArgsReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_noArgsSync( + i, + this->component.get_noArgsSync_InputPort(i) + ); + } + + this->connect_to_typedAsync( + 0, + this->component.get_typedAsync_InputPort(0) + ); + + this->connect_to_typedAsyncAssert( + 0, + this->component.get_typedAsyncAssert_InputPort(0) + ); + + this->connect_to_typedAsyncBlockPriority( + 0, + this->component.get_typedAsyncBlockPriority_InputPort(0) + ); + + this->connect_to_typedAsyncDropPriority( + 0, + this->component.get_typedAsyncDropPriority_InputPort(0) + ); + + this->connect_to_typedGuarded( + 0, + this->component.get_typedGuarded_InputPort(0) + ); + + this->connect_to_typedReturnGuarded( + 0, + this->component.get_typedReturnGuarded_InputPort(0) + ); + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedReturnSync( + i, + this->component.get_typedReturnSync_InputPort(i) + ); + } + + for (NATIVE_UINT_TYPE i = 0; i < 3; i++) { + this->connect_to_typedSync( + i, + this->component.get_typedSync_InputPort(i) + ); + } + + // Connect typed output ports + + this->component.set_noArgsOut_OutputPort( + 0, + this->get_from_noArgsOut(0) + ); + + this->component.set_noArgsReturnOut_OutputPort( + 0, + this->get_from_noArgsReturnOut(0) + ); + + this->component.set_typedOut_OutputPort( + 0, + this->get_from_typedOut(0) + ); + + this->component.set_typedReturnOut_OutputPort( + 0, + this->get_from_typedReturnOut(0) + ); +} + +void QueuedSyncProductsTester :: + initComponents() +{ + this->init(); + this->component.init(QueuedSyncProductsTester::TEST_INSTANCE_QUEUE_DEPTH, QueuedSyncProductsTester::TEST_INSTANCE_ID); +} diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedTestTesterHelpers.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedTestTesterHelpers.ref.cpp index cdb3ec0fe..dcab77dbd 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedTestTesterHelpers.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/QueuedTestTesterHelpers.ref.cpp @@ -20,6 +20,11 @@ void QueuedTestTester :: this->component.get_cmdIn_InputPort(0) ); + this->connect_to_productRecvIn( + 0, + this->component.get_productRecvIn_InputPort(0) + ); + // Connect special output ports this->component.set_cmdRegOut_OutputPort( @@ -47,6 +52,16 @@ void QueuedTestTester :: this->get_from_prmSetOut(0) ); + this->component.set_productRequestOut_OutputPort( + 0, + this->get_from_productRequestOut(0) + ); + + this->component.set_productSendOut_OutputPort( + 0, + this->get_from_productSendOut(0) + ); + this->component.set_textEventOut_OutputPort( 0, this->get_from_textEventOut(0) diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/run.sh b/compiler/tools/fpp-to-cpp/test/component/test-impl/run.sh index 94dfc9ab3..5fa8e5c99 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-impl/run.sh +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/run.sh @@ -12,23 +12,33 @@ empty() passive() { run_test "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../passive" passive && \ - diff_test_template PassiveTest && \ - diff_test_template PassiveSerial && \ diff_test_template PassiveCommands && \ diff_test_template PassiveEvents && \ + diff_test_template PassiveGetProductPortsOnly && \ + diff_test_template PassiveGetProducts && \ + diff_test_template PassiveGuardedProducts && \ + diff_test_template PassiveParams && \ + diff_test_template PassiveSerial && \ + diff_test_template PassiveSyncProductPortsOnly && \ + diff_test_template PassiveSyncProducts && \ diff_test_template PassiveTelemetry && \ - diff_test_template PassiveParams + diff_test_template PassiveTest } active() { run_test "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../active" active && \ - diff_test_template ActiveTest && \ - diff_test_template ActiveSerial && \ + diff_test_template ActiveAsyncProductPortsOnly && \ + diff_test_template ActiveAsyncProducts && \ diff_test_template ActiveCommands && \ diff_test_template ActiveEvents && \ + diff_test_template ActiveGetProducts && \ + diff_test_template ActiveGuardedProducts && \ + diff_test_template ActiveParams && \ + diff_test_template ActiveSerial && \ + diff_test_template ActiveSyncProducts && \ diff_test_template ActiveTelemetry && \ - diff_test_template ActiveParams + diff_test_template ActiveTest } queued() diff --git a/compiler/tools/fpp-to-cpp/test/component/test-impl/update-ref.sh b/compiler/tools/fpp-to-cpp/test/component/test-impl/update-ref.sh index cdb60f4c9..7e5792ea9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/test-impl/update-ref.sh +++ b/compiler/tools/fpp-to-cpp/test/component/test-impl/update-ref.sh @@ -12,32 +12,45 @@ empty() passive() { update "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../passive" passive - move_test_template PassiveTest - move_test_template PassiveSerial move_test_template PassiveCommands move_test_template PassiveEvents - move_test_template PassiveTelemetry + move_test_template PassiveGetProductPortsOnly + move_test_template PassiveGetProducts + move_test_template PassiveGuardedProducts move_test_template PassiveParams + move_test_template PassiveSerial + move_test_template PassiveSyncProductPortsOnly + move_test_template PassiveSyncProducts + move_test_template PassiveTelemetry + move_test_template PassiveTest } active() { update "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../active" active - move_test_template ActiveTest - move_test_template ActiveSerial + move_test_template ActiveAsyncProductPortsOnly + move_test_template ActiveAsyncProducts move_test_template ActiveCommands move_test_template ActiveEvents - move_test_template ActiveTelemetry + move_test_template ActiveGetProducts + move_test_template ActiveGuardedProducts move_test_template ActiveParams + move_test_template ActiveSerial + move_test_template ActiveSyncProducts + move_test_template ActiveTelemetry + move_test_template ActiveTest } queued() { update "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../queued" queued - move_test_template QueuedTest - move_test_template QueuedSerial move_test_template QueuedCommands move_test_template QueuedEvents - move_test_template QueuedTelemetry + move_test_template QueuedGetProducts + move_test_template QueuedGuardedProducts move_test_template QueuedParams + move_test_template QueuedSerial + move_test_template QueuedSyncProducts + move_test_template QueuedTelemetry + move_test_template QueuedTest } diff --git a/compiler/tools/fpp-to-cpp/test/fprime/Svc/Sched/Sched.fpp b/compiler/tools/fpp-to-cpp/test/fprime/Svc/Sched/Sched.fpp new file mode 100644 index 000000000..9911bf48b --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/fprime/Svc/Sched/Sched.fpp @@ -0,0 +1,8 @@ +module Svc { + + @ Scheduler Port with order argument + port Sched( + context: NATIVE_UINT_TYPE @< The call order + ) + +} diff --git a/compiler/tools/fpp-to-json/test/activeComponents.ref.txt b/compiler/tools/fpp-to-json/test/activeComponents.ref.txt index f278d6536..1acd5f88a 100644 --- a/compiler/tools/fpp-to-json/test/activeComponents.ref.txt +++ b/compiler/tools/fpp-to-json/test/activeComponents.ref.txt @@ -1124,7 +1124,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/commands.ref.txt b/compiler/tools/fpp-to-json/test/commands.ref.txt index 9a355b592..198a0b3a4 100644 --- a/compiler/tools/fpp-to-json/test/commands.ref.txt +++ b/compiler/tools/fpp-to-json/test/commands.ref.txt @@ -938,7 +938,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/constTypesComponents.ref.txt b/compiler/tools/fpp-to-json/test/constTypesComponents.ref.txt index 1dba7076b..e3433e277 100644 --- a/compiler/tools/fpp-to-json/test/constTypesComponents.ref.txt +++ b/compiler/tools/fpp-to-json/test/constTypesComponents.ref.txt @@ -733,7 +733,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/events.ref.txt b/compiler/tools/fpp-to-json/test/events.ref.txt index 9a258f458..036964da0 100644 --- a/compiler/tools/fpp-to-json/test/events.ref.txt +++ b/compiler/tools/fpp-to-json/test/events.ref.txt @@ -938,7 +938,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "32" : { "aNode" : { @@ -1129,7 +1137,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/importedTopologies.ref.txt b/compiler/tools/fpp-to-json/test/importedTopologies.ref.txt index a20b905ba..7bf1f28ff 100644 --- a/compiler/tools/fpp-to-json/test/importedTopologies.ref.txt +++ b/compiler/tools/fpp-to-json/test/importedTopologies.ref.txt @@ -1696,7 +1696,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/internalPorts.ref.txt b/compiler/tools/fpp-to-json/test/internalPorts.ref.txt index c3991906d..cb415d116 100644 --- a/compiler/tools/fpp-to-json/test/internalPorts.ref.txt +++ b/compiler/tools/fpp-to-json/test/internalPorts.ref.txt @@ -398,7 +398,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/matchedPorts.ref.txt b/compiler/tools/fpp-to-json/test/matchedPorts.ref.txt index bdcbaea1d..b1d9fc652 100644 --- a/compiler/tools/fpp-to-json/test/matchedPorts.ref.txt +++ b/compiler/tools/fpp-to-json/test/matchedPorts.ref.txt @@ -588,7 +588,15 @@ } } ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/parameters.ref.txt b/compiler/tools/fpp-to-json/test/parameters.ref.txt index aa4a5abc1..3d340e32b 100644 --- a/compiler/tools/fpp-to-json/test/parameters.ref.txt +++ b/compiler/tools/fpp-to-json/test/parameters.ref.txt @@ -1469,7 +1469,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 18 + "defaultParamId" : 18, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/passiveComponent.ref.txt b/compiler/tools/fpp-to-json/test/passiveComponent.ref.txt index 709add575..41120d9c5 100644 --- a/compiler/tools/fpp-to-json/test/passiveComponent.ref.txt +++ b/compiler/tools/fpp-to-json/test/passiveComponent.ref.txt @@ -1031,7 +1031,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/queuedComponents.ref.txt b/compiler/tools/fpp-to-json/test/queuedComponents.ref.txt index ad2bf2176..c1fc2ddba 100644 --- a/compiler/tools/fpp-to-json/test/queuedComponents.ref.txt +++ b/compiler/tools/fpp-to-json/test/queuedComponents.ref.txt @@ -1270,7 +1270,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/simpleComponents.ref.txt b/compiler/tools/fpp-to-json/test/simpleComponents.ref.txt index 19ffb4ecf..f1d6ce807 100644 --- a/compiler/tools/fpp-to-json/test/simpleComponents.ref.txt +++ b/compiler/tools/fpp-to-json/test/simpleComponents.ref.txt @@ -1162,7 +1162,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "38" : { "aNode" : { @@ -1297,7 +1305,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "58" : { "aNode" : { @@ -1448,7 +1464,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "68" : { "aNode" : { @@ -1534,7 +1558,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/simpleTopology.ref.txt b/compiler/tools/fpp-to-json/test/simpleTopology.ref.txt index c4772a544..3ebc9c45c 100644 --- a/compiler/tools/fpp-to-json/test/simpleTopology.ref.txt +++ b/compiler/tools/fpp-to-json/test/simpleTopology.ref.txt @@ -930,7 +930,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/specialPorts.ref.txt b/compiler/tools/fpp-to-json/test/specialPorts.ref.txt index 3b8b9494f..e8c618d93 100644 --- a/compiler/tools/fpp-to-json/test/specialPorts.ref.txt +++ b/compiler/tools/fpp-to-json/test/specialPorts.ref.txt @@ -968,7 +968,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "10" : { "aNode" : { @@ -1097,7 +1105,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "14" : { "aNode" : { @@ -1176,7 +1192,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "19" : { "aNode" : { @@ -1305,7 +1329,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 }, "23" : { "aNode" : { @@ -1384,7 +1416,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-json/test/telemetry.ref.txt b/compiler/tools/fpp-to-json/test/telemetry.ref.txt index 08d805a94..8c0967474 100644 --- a/compiler/tools/fpp-to-json/test/telemetry.ref.txt +++ b/compiler/tools/fpp-to-json/test/telemetry.ref.txt @@ -1272,7 +1272,15 @@ ], "portMatchingList" : [ ], - "defaultParamId" : 0 + "defaultParamId" : 0, + "containerMap" : { + + }, + "defaultContainerId" : 0, + "recordMap" : { + + }, + "defaultRecordId" : 0 } }, "includedFileSet" : [ diff --git a/compiler/tools/fpp-to-xml/test/component/DpBufferRequestPortAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/DpBufferRequestPortAi.ref.xml new file mode 100644 index 000000000..25248b4bb --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/DpBufferRequestPortAi.ref.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/DpBufferSendPortAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/DpBufferSendPortAi.ref.xml new file mode 100644 index 000000000..58f76284e --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/DpBufferSendPortAi.ref.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/DpGetPortAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/DpGetPortAi.ref.xml new file mode 100644 index 000000000..b934c3508 --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/DpGetPortAi.ref.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/DpRequestPortAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/DpRequestPortAi.ref.xml new file mode 100644 index 000000000..e25753f44 --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/DpRequestPortAi.ref.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/DpResponsePortAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/DpResponsePortAi.ref.xml new file mode 100644 index 000000000..31e54e681 --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/DpResponsePortAi.ref.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/DpSendPortAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/DpSendPortAi.ref.xml new file mode 100644 index 000000000..4391b0065 --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/DpSendPortAi.ref.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/ProductRecvPortAsyncComponentAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/ProductRecvPortAsyncComponentAi.ref.xml new file mode 100644 index 000000000..3faf62275 --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/ProductRecvPortAsyncComponentAi.ref.xml @@ -0,0 +1,15 @@ + + + + + + DpResponsePortAi.xml + + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/ProductRecvPortGuardedComponentAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/ProductRecvPortGuardedComponentAi.ref.xml new file mode 100644 index 000000000..96c804fdb --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/ProductRecvPortGuardedComponentAi.ref.xml @@ -0,0 +1,15 @@ + + + + + + DpResponsePortAi.xml + + + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/SpecialPortsComponentAi.ref.xml b/compiler/tools/fpp-to-xml/test/component/SpecialPortsComponentAi.ref.xml index 3464d6a9d..3cda96fc3 100644 --- a/compiler/tools/fpp-to-xml/test/component/SpecialPortsComponentAi.ref.xml +++ b/compiler/tools/fpp-to-xml/test/component/SpecialPortsComponentAi.ref.xml @@ -9,6 +9,10 @@ Generated by fpp-to-xml CmdPortAi.xml CmdRegPortAi.xml CmdResponsePortAi.xml + DpGetPortAi.xml + DpRequestPortAi.xml + DpResponsePortAi.xml + DpSendPortAi.xml LogPortAi.xml LogTextPortAi.xml PrmGetPortAi.xml @@ -22,6 +26,10 @@ Generated by fpp-to-xml + + + + diff --git a/compiler/tools/fpp-to-xml/test/component/ports.fpp b/compiler/tools/fpp-to-xml/test/component/ports.fpp index cc03625fc..acd1ce8e8 100644 --- a/compiler/tools/fpp-to-xml/test/component/ports.fpp +++ b/compiler/tools/fpp-to-xml/test/component/ports.fpp @@ -9,6 +9,10 @@ module Fw { port Cmd port CmdReg port CmdResponse + port DpGet + port DpRequest + port DpResponse + port DpSend port Log port LogText port PrmGet diff --git a/compiler/tools/fpp-to-xml/test/component/product_recv_port_async.fpp b/compiler/tools/fpp-to-xml/test/component/product_recv_port_async.fpp new file mode 100644 index 000000000..1bdcf034c --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/product_recv_port_async.fpp @@ -0,0 +1,9 @@ +module M { + + active component ProductRecvPortAsync { + + async product recv port productRecvIn priority 10 drop + + } + +} diff --git a/compiler/tools/fpp-to-xml/test/component/product_recv_port_async.ref.txt b/compiler/tools/fpp-to-xml/test/component/product_recv_port_async.ref.txt new file mode 100644 index 000000000..e69de29bb diff --git a/compiler/tools/fpp-to-xml/test/component/product_recv_port_guarded.fpp b/compiler/tools/fpp-to-xml/test/component/product_recv_port_guarded.fpp new file mode 100644 index 000000000..ba7d8254f --- /dev/null +++ b/compiler/tools/fpp-to-xml/test/component/product_recv_port_guarded.fpp @@ -0,0 +1,9 @@ +module M { + + passive component ProductRecvPortGuarded { + + guarded product recv port productRecvIn + + } + +} diff --git a/compiler/tools/fpp-to-xml/test/component/product_recv_port_guarded.ref.txt b/compiler/tools/fpp-to-xml/test/component/product_recv_port_guarded.ref.txt new file mode 100644 index 000000000..e69de29bb diff --git a/compiler/tools/fpp-to-xml/test/component/run.sh b/compiler/tools/fpp-to-xml/test/component/run.sh index d76cc8c8f..73f2a8512 100644 --- a/compiler/tools/fpp-to-xml/test/component/run.sh +++ b/compiler/tools/fpp-to-xml/test/component/run.sh @@ -39,12 +39,25 @@ ports() run_test "-p $PWD" ports && \ diff_xml PPort \ CmdPort CmdRegPort CmdResponsePort \ + DpGetPort DpRequestPort DpResponsePort DpSendPort \ LogPort LogTextPort \ PrmGetPort PrmSetPort \ TimePort \ TlmPort } +product_recv_port_async() +{ + run_test "-p $PWD -i ports.fpp" product_recv_port_async && \ + diff_xml ProductRecvPortAsyncComponent +} + +product_recv_port_guarded() +{ + run_test "-p $PWD -i ports.fpp" product_recv_port_guarded && \ + diff_xml ProductRecvPortGuardedComponent +} + special_ports() { run_test "-p $PWD -i ports.fpp" special_ports && \ diff --git a/compiler/tools/fpp-to-xml/test/component/special_ports.fpp b/compiler/tools/fpp-to-xml/test/component/special_ports.fpp index 068d3ac69..27ea3f0ad 100644 --- a/compiler/tools/fpp-to-xml/test/component/special_ports.fpp +++ b/compiler/tools/fpp-to-xml/test/component/special_ports.fpp @@ -14,6 +14,11 @@ module M { telemetry port tlmOut + product get port productGetOut + product request port productRequestOut + sync product recv port productRecvIn + product send port productSendOut + } } diff --git a/compiler/tools/fpp-to-xml/test/component/tests.sh b/compiler/tools/fpp-to-xml/test/component/tests.sh index 7b035d836..a7e46817f 100644 --- a/compiler/tools/fpp-to-xml/test/component/tests.sh +++ b/compiler/tools/fpp-to-xml/test/component/tests.sh @@ -6,6 +6,8 @@ general_ports internal_ports parameters ports +product_recv_port_async +product_recv_port_guarded special_ports telemetry types diff --git a/compiler/tools/fpp-to-xml/test/component/update-ref.sh b/compiler/tools/fpp-to-xml/test/component/update-ref.sh index e80ad443f..805c13087 100644 --- a/compiler/tools/fpp-to-xml/test/component/update-ref.sh +++ b/compiler/tools/fpp-to-xml/test/component/update-ref.sh @@ -39,12 +39,25 @@ ports() update "-p $PWD" ports move_xml PPort \ CmdPort CmdRegPort CmdResponsePort \ + DpGetPort DpRequestPort DpResponsePort DpSendPort \ LogPort LogTextPort \ PrmGetPort PrmSetPort \ TimePort \ TlmPort } +product_recv_port_async() +{ + update "-p $PWD -i ports.fpp" product_recv_port_async + move_xml ProductRecvPortAsyncComponent +} + +product_recv_port_guarded() +{ + update "-p $PWD -i ports.fpp" product_recv_port_guarded + move_xml ProductRecvPortGuardedComponent +} + special_ports() { update "-p $PWD -i ports.fpp" special_ports diff --git a/docs/code-prettify/run_prettify.js b/docs/code-prettify/run_prettify.js index 861dfef2a..9c37a6d4e 100644 --- a/docs/code-prettify/run_prettify.js +++ b/docs/code-prettify/run_prettify.js @@ -419,6 +419,7 @@ var IN_GLOBAL_SCOPE = false; "component," + "connections," + "constant," + + "container," + "cpu," + "default," + "diagnostic," + @@ -451,14 +452,18 @@ var IN_GLOBAL_SCOPE = false; "port," + "priority," + "private," + + "product," + "queued," + "queue," + + "record," + "recv," + "red," + "ref," + "reg," + + "request," + "resp," + "save," + + "send," + "serial," + "set," + "severity," + diff --git a/docs/fpp-spec.html b/docs/fpp-spec.html index a666e1945..6804108ff 100644 --- a/docs/fpp-spec.html +++ b/docs/fpp-spec.html @@ -5,7 +5,7 @@ -The F Prime Prime (FPP) Language Specification, v2.0.1 +The F Prime Prime (FPP) Language Specification, Unreleased, after v2.0.1