@@ -1074,7 +1074,7 @@ AddEventStatus addEvent(PCM::RawPMUConfigs & curPMUConfigs, string eventStr)
1074
1074
const auto configArray = split (configStr, ' ,' );
1075
1075
bool fixed = false ;
1076
1076
std::string lookup;
1077
- auto pmtAddRecord = [&lookup, &pmuName, &config](const std::vector<TelemetryDB::PMTRecord> & records) -> AddEventStatus
1077
+ auto pmtAddRecord = [&lookup, &pmuName, &config](const std::vector<TelemetryDB::PMTRecord> & records, const bool first = false ) -> AddEventStatus
1078
1078
{
1079
1079
if (pmuName == " pmt" )
1080
1080
{
@@ -1083,7 +1083,7 @@ AddEventStatus addEvent(PCM::RawPMUConfigs & curPMUConfigs, string eventStr)
1083
1083
cerr << " ERROR: lookup \" " << lookup << " \" not found in PMT telemetry database\n " ;
1084
1084
return AddEventStatus::Failed;
1085
1085
}
1086
- if (records.size () > 1 )
1086
+ if (records.size () > 1 && first == false )
1087
1087
{
1088
1088
cerr << " ERROR: lookup \" " << lookup << " \" is ambiguous in PMT telemetry database\n\n " ;
1089
1089
for (const auto & record : records)
@@ -1092,10 +1092,11 @@ AddEventStatus addEvent(PCM::RawPMUConfigs & curPMUConfigs, string eventStr)
1092
1092
record.print (cerr);
1093
1093
cerr << " \n " ;
1094
1094
}
1095
+ cerr << " Alternatively use lookupf or ilookupf to select the first record in the list.\n " ;
1095
1096
return AddEventStatus::Failed;
1096
1097
}
1097
1098
config.second = records[0 ].fullName ;
1098
- assert (records.size () = = 1 );
1099
+ assert (records.size () > = 1 );
1099
1100
config.first [PCM::PMTEventPosition::UID] = records[0 ].uid ;
1100
1101
config.first [PCM::PMTEventPosition::offset] = records[0 ].qWordOffset ;
1101
1102
config.first [PCM::PMTEventPosition::type] = (records[0 ].sampleType == " Snapshot" ) ? PCM::MSRType::Static : PCM::MSRType::Freerun;
@@ -1150,6 +1151,16 @@ AddEventStatus addEvent(PCM::RawPMUConfigs & curPMUConfigs, string eventStr)
1150
1151
if (pmtAddRecord (telemDB.ilookup (lookup)) != AddEventStatus::OK)
1151
1152
return AddEventStatus::Failed;
1152
1153
}
1154
+ else if (pcm_sscanf (item) >> s_expect (" lookupf=" ) >> setw (255 ) >> lookup)
1155
+ {
1156
+ if (pmtAddRecord (telemDB.lookup (lookup), true ) != AddEventStatus::OK)
1157
+ return AddEventStatus::Failed;
1158
+ }
1159
+ else if (pcm_sscanf (item) >> s_expect (" ilookupf=" ) >> setw (255 ) >> lookup)
1160
+ {
1161
+ if (pmtAddRecord (telemDB.ilookup (lookup), true ) != AddEventStatus::OK)
1162
+ return AddEventStatus::Failed;
1163
+ }
1153
1164
else if (item == " fixed" )
1154
1165
{
1155
1166
fixed = true ;
0 commit comments