Skip to content
Snippets Groups Projects

CbmEvent: GetIndex() function re-implimentation and constant qualifiers for getters

Merged Sergei Zharko requested to merge s.zharko/cbmroot:CbmEvent-fix into master
All threads resolved!
2 files
+ 19
7
Compare changes
  • Side-by-side
  • Inline

Files

+ 10
5
@@ -39,12 +39,17 @@ void CbmEvent::ClearData(ECbmDataType type) { fIndexMap[type].clear(); }
// ----- Get a data index ----------------------------------------------
uint32_t CbmEvent::GetIndex(ECbmDataType type, uint32_t iData)
uint32_t CbmEvent::GetIndex(ECbmDataType type, uint32_t iData) const
{
if (fIndexMap.find(type) == fIndexMap.end()) return -1;
if (fIndexMap[type].size() <= iData) return -2;
return fIndexMap.at(type)[iData];
auto it = fIndexMap.find(type);
if (it == fIndexMap.end()) {
return -1;
}
const auto& indices = it->second;
if (indices.size() <= iData) {
return -2;
}
return indices[iData];
}
// -------------------------------------------------------------------------
Loading