From f8769bce97423a59910dae9eeda4e41ce01bdc92 Mon Sep 17 00:00:00 2001 From: Vladyslav Goncharuk Date: Fri, 14 Jun 2024 01:04:11 +0300 Subject: [PATCH] [SEARCH_VIEW] Investigate high RAM consumption This patch introduces various optimizations of RAM consumption and, consequently, CPU consumption. All optimizations were proven to be functional with the Valgrind Massif tool. Signed-off-by: Vladyslav Goncharuk --- .../src/common/BaseDefinitions.cpp | 2 +- .../src/common/BaseDefinitions.hpp | 2 +- .../src/common/CTreeItem.cpp | 18 +- .../src/common/CTreeItem.hpp | 19 +- .../src/common/Definitions.cpp | 201 +++--- .../src/common/Definitions.hpp | 59 +- .../analyzer/src/CDLTRegexAnalyzerWorker.cpp | 34 +- .../filtersView/src/CFiltersModel.cpp | 13 +- .../groupedView/src/CGroupedViewModel.cpp | 17 +- .../plotView/src/CPlotViewComponent.cpp | 16 +- .../src/CSearchResultHighlightingDelegate.cpp | 22 +- .../searchView/src/CSearchResultModel.cpp | 609 ++++++++++-------- .../searchView/src/CSearchResultView.cpp | 4 +- .../src/plugin/src/CDLTMessageAnalyzer.cpp | 41 +- 14 files changed, 598 insertions(+), 459 deletions(-) diff --git a/dltmessageanalyzerplugin/src/common/BaseDefinitions.cpp b/dltmessageanalyzerplugin/src/common/BaseDefinitions.cpp index 5ef930a5..1f25f177 100644 --- a/dltmessageanalyzerplugin/src/common/BaseDefinitions.cpp +++ b/dltmessageanalyzerplugin/src/common/BaseDefinitions.cpp @@ -8,5 +8,5 @@ bool QOptionalColor::operator== ( const QOptionalColor& rhs ) const { - return color == rhs.color && isSet == rhs.isSet; + return color_code == rhs.color_code && isSet == rhs.isSet; } diff --git a/dltmessageanalyzerplugin/src/common/BaseDefinitions.hpp b/dltmessageanalyzerplugin/src/common/BaseDefinitions.hpp index 57d6d437..0f69a553 100644 --- a/dltmessageanalyzerplugin/src/common/BaseDefinitions.hpp +++ b/dltmessageanalyzerplugin/src/common/BaseDefinitions.hpp @@ -40,7 +40,7 @@ Q_DECLARE_METATYPE(tQStringPtrWrapper) struct QOptionalColor { bool isSet = false; - QColor color; + QRgb color_code; bool operator== ( const QOptionalColor& rhs ) const; }; typedef QVector QOptionalColorVec; diff --git a/dltmessageanalyzerplugin/src/common/CTreeItem.cpp b/dltmessageanalyzerplugin/src/common/CTreeItem.cpp index 327a3ac5..0b5bb7a1 100644 --- a/dltmessageanalyzerplugin/src/common/CTreeItem.cpp +++ b/dltmessageanalyzerplugin/src/common/CTreeItem.cpp @@ -423,18 +423,18 @@ CTreeItem::CTreeItem(CTreeItem *pParent, const tHandleDuplicateFunc& handleDuplicateFunc, const tFindItemFunc& findFunc) : - mData(), - mHandleDuplicateFunc(handleDuplicateFunc), mChildItems(), - mpParentItem(pParent), - mSortedChildren(), - mbFirstLevelSorted(true), - mbWholeSorted(true), - mSortingColumn(defaultSortingColumn), - mSortOrder(Qt::SortOrder::DescendingOrder), mSortingFunction(sortingFunction), mFindFunc(findFunc), - mpGuard(std::make_shared(0)) + mHandleDuplicateFunc(handleDuplicateFunc), + mData(), + mSortedChildren(), + mpGuard(std::make_shared(0)), + mpParentItem(pParent), + mSortOrder(Qt::SortOrder::DescendingOrder), + mSortingColumn(defaultSortingColumn), + mbFirstLevelSorted(true), + mbWholeSorted(true) {} tTreeItemPtr CTreeItem::appendChild(const tDataItem& key, const tData& additionItems) diff --git a/dltmessageanalyzerplugin/src/common/CTreeItem.hpp b/dltmessageanalyzerplugin/src/common/CTreeItem.hpp index a57f67ec..481c540d 100644 --- a/dltmessageanalyzerplugin/src/common/CTreeItem.hpp +++ b/dltmessageanalyzerplugin/src/common/CTreeItem.hpp @@ -253,19 +253,20 @@ class CTreeItem void setIdx(const int& val); private: - tData mData; - tHandleDuplicateFunc mHandleDuplicateFunc; + tChildrenMap mChildItems; - tTreeItemPtr mpParentItem; - QVector mSortedChildren; - bool mbFirstLevelSorted; - bool mbWholeSorted; - int mSortingColumn; - Qt::SortOrder mSortOrder; tSortingFunction mSortingFunction; tFindItemFunc mFindFunc; - int mIdx; // idx in parent's collection + tHandleDuplicateFunc mHandleDuplicateFunc; + tData mData; + QVector mSortedChildren; tGuarded mpGuard; + tTreeItemPtr mpParentItem; + Qt::SortOrder mSortOrder; + int mIdx; // idx in parent's collection + int mSortingColumn; + bool mbFirstLevelSorted; + bool mbWholeSorted; }; #endif // CTreeItem_HPP diff --git a/dltmessageanalyzerplugin/src/common/Definitions.cpp b/dltmessageanalyzerplugin/src/common/Definitions.cpp index 2e6a3452..e5b479cd 100644 --- a/dltmessageanalyzerplugin/src/common/Definitions.cpp +++ b/dltmessageanalyzerplugin/src/common/Definitions.cpp @@ -432,11 +432,11 @@ tHighlightingRange::tHighlightingRange( const tHighlightingRangeItem& from_, const tHighlightingRangeItem& to_, const QColor& color_, bool explicitColor_ ): -from(from_), to(to_), color(color_), explicitColor(explicitColor_) +color_code(color_.rgb()), from(from_), to(to_), explicitColor(explicitColor_) {} tHighlightingRange::tHighlightingRange(): -from(0), to(0), color(0,0,0), explicitColor(false) +color_code(RGB_MASK), from(0), to(0), explicitColor(false) {} bool tHighlightingRange::operator< ( const tHighlightingRange& rVal ) const @@ -634,7 +634,7 @@ tTreeItemSharedPtr getMatchesTree( const tFoundMatches& foundMatches ) typedef std::vector tStack; tStack matchesStack; - matchesStack.reserve(static_cast(foundMatches.size()) + 10); // +10 to cover possible overhead of nested groups. + matchesStack.reserve(static_cast(foundMatches.foundMatchesVec.size()) + 10); // +10 to cover possible overhead of nested groups. auto switchToParent = [&pCurrentItem, &matchesStack](int numberOfElementsToPop) { @@ -664,7 +664,7 @@ tTreeItemSharedPtr getMatchesTree( const tFoundMatches& foundMatches ) matchesStack.push_back( &match ); // push new element to the stack }; - for(const auto& match : foundMatches) + for(const auto& match : foundMatches.foundMatchesVec) { int counter = 0; @@ -735,10 +735,11 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte return dummyResult; } - tHighlightingRangeList resultList; - resultList.reserve(static_cast(regexScriptingMetadata.getItemsVec().size() + 10)); // +10 to cover overhead which might be caused with nested groups + tCalcRangesCoverageMulticolorResult result; + tHighlightingRangeVec& resultVec = result.highlightingRangeVec; + resultVec.reserve(static_cast(regexScriptingMetadata.getItemsVec().size())); - auto postVisitFunction = [&resultList, &inputRange, ®exScriptingMetadata, &gradientColors, &groupIdToColorMap](tTreeItem* pItem) + auto postVisitFunction = [&resultVec, &inputRange, ®exScriptingMetadata, &gradientColors, &groupIdToColorMap](tTreeItem* pItem) { const auto& match = *(pItem->data(static_cast(eTreeColumns::eTreeColumn_FoundMatch)).get()); @@ -777,7 +778,7 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte if(true == scriptedColor.isSet) { - color = scriptedColor.color; + color = QColor(scriptedColor.color_code); bIsExplicitColor = true; } else @@ -810,7 +811,7 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte { // let's add it tAnalysisRange rangeToBeAdded( tIntRange( analysisRange.from, firstChildAnalysisRange.from - 1 ), inputRange); - resultList.push_back( tHighlightingRange( rangeToBeAdded.from, + resultVec.push_back( tHighlightingRange( rangeToBeAdded.from, rangeToBeAdded.to, selectedColor.second, selectedColor.first ) ); @@ -831,7 +832,7 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte if((secondChildAnalysisRange.from - firstChildAnalysisRange.to) > 1) { tAnalysisRange rangeToBeAdded( tIntRange( firstChildAnalysisRange.to+1, secondChildAnalysisRange.from-1 ), inputRange); - resultList.push_back( tHighlightingRange( rangeToBeAdded.from, + resultVec.push_back( tHighlightingRange( rangeToBeAdded.from, rangeToBeAdded.to, selectedColor.second, selectedColor.first ) ); @@ -849,7 +850,7 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte { // let's add it tAnalysisRange rangeToBeAdded( tIntRange( lastChildAnalysisRange.to + 1, analysisRange.to ), inputRange); - resultList.push_back( tHighlightingRange( rangeToBeAdded.from, + resultVec.push_back( tHighlightingRange( rangeToBeAdded.from, rangeToBeAdded.to, selectedColor.second, selectedColor.first ) ); @@ -859,7 +860,7 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte else // if there are no children { // let's add item unconditionally - resultList.push_back( tHighlightingRange( analysisRange.from, + resultVec.push_back( tHighlightingRange( analysisRange.from, analysisRange.to, selectedColor.second, selectedColor.first ) ); @@ -874,28 +875,21 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte if(0 != normalizationIdx) { - for(auto& resultListItem : resultList) + for(auto& resultVecItem : resultVec) { - resultListItem.from = resultListItem.from - normalizationIdx; - resultListItem.to = resultListItem.to - normalizationIdx; + resultVecItem.from = resultVecItem.from - normalizationIdx; + resultVecItem.to = resultVecItem.to - normalizationIdx; } } - tCalcRangesCoverageMulticolorResult result; - - - result.highlightingRangeSet.insert(resultList.begin(), resultList.end()); - - //for( const auto& resultItem : resultList ) - //{ - //SEND_MSG(QString("[calcRangesCoverageMulticolor][result] - |from-%1;to-%2;red-%3;green-%4;blue-%5,expColor-%6|") - // .arg(resultItem.from) - // .arg(resultItem.to) - // .arg(resultItem.color.red()) - // .arg(resultItem.color.green()) - // .arg(resultItem.color.blue()) - // .arg(resultItem.explicitColor)); - //} + // for( const auto& resultItem : result.highlightingRangeVec ) + // { + // SEND_MSG(QString("[calcRangesCoverageMulticolor][result] - |from-%1;to-%2;color-%3,expColor-%4|") + // .arg(resultItem.from) + // .arg(resultItem.to) + // .arg(resultItem.color_code) + // .arg(resultItem.explicitColor)); + // } #ifdef DEBUG_CALC_RANGES auto nsecEnd = timer.nsecsElapsed(); @@ -910,28 +904,61 @@ tCalcRangesCoverageMulticolorResult calcRangesCoverageMulticolor( const tTreeIte } //tItemMetadata -tItemMetadata::tItemMetadata(): msgId(-1), +tItemMetadata::tItemMetadata(): highlightingInfoMultiColor(), fieldRanges(), + msgId(-1), strSize(0), - msgSize(0u), - timeStamp(0u) + timeStamp(0u), + msgSize(0u) +{ + +} + +tItemMetadata::tItemMetadata(const tItemMetadata& rhs): +highlightingInfoMultiColor(rhs.highlightingInfoMultiColor), +fieldRanges(rhs.fieldRanges), +pUMLInfo(rhs.pUMLInfo == nullptr ? nullptr : std::make_unique(*rhs.pUMLInfo)), +pPlotViewInfo(rhs.pPlotViewInfo == nullptr ? nullptr : std::make_unique(*rhs.pPlotViewInfo)), +msgId(rhs.msgId), +msgIdFiltered(rhs.msgIdFiltered), +strSize(rhs.strSize), +timeStamp(rhs.timeStamp), +msgSize(rhs.msgSize) { } +tItemMetadata& tItemMetadata::operator= (const tItemMetadata& rhs) +{ + if(&rhs == this) + return *this; + + highlightingInfoMultiColor = rhs.highlightingInfoMultiColor; + fieldRanges = rhs.fieldRanges; + pUMLInfo = rhs.pUMLInfo == nullptr ? nullptr : std::make_unique(*rhs.pUMLInfo); + pPlotViewInfo = rhs.pPlotViewInfo == nullptr ? nullptr : std::make_unique(*rhs.pPlotViewInfo); + msgId = rhs.msgId; + msgIdFiltered = rhs.msgIdFiltered; + strSize = rhs.strSize; + timeStamp = rhs.timeStamp; + msgSize = rhs.msgSize; + + return *this; +} + tItemMetadata::tItemMetadata( const tMsgId& msgId_, const tMsgId& msgIdFiltered_, const tFieldRanges& fieldRanges_, const int& strSize_, - const unsigned int& msgSize_, + const std::uint32_t& msgSize_, const unsigned int& timeStamp_): + fieldRanges(fieldRanges_), msgId(msgId_), msgIdFiltered(msgIdFiltered_), - fieldRanges(fieldRanges_), strSize(strSize_), - msgSize(msgSize_), - timeStamp(timeStamp_) + timeStamp(timeStamp_), + msgSize(msgSize_) { } @@ -981,7 +1008,7 @@ tTreeItemSharedPtr tItemMetadata::updateHighlightingInfo( const tFoundMatches& f typedef std::map tSortedMatches; tSortedMatches sortedMatches; - for(const auto& match : foundMatches) + for(const auto& match : foundMatches.foundMatchesVec) { sortedMatches.insert(std::make_pair(tSortedMatchKey(match.range.from, match.range.to - match.range.from), &match)); } @@ -1004,12 +1031,14 @@ tTreeItemSharedPtr tItemMetadata::updateHighlightingInfo( const tFoundMatches& f { auto highlightingRangesMulticolorRes = calcRangesCoverageMulticolor( pMatchesTree, it.value(), regexScriptingMetadata, gradientColors, createColorsMappingTable() ); - if(false == highlightingRangesMulticolorRes.highlightingRangeSet.empty()) + if(false == highlightingRangesMulticolorRes.highlightingRangeVec.empty()) { - highlightingInfoMultiColor.insert( it.key(), highlightingRangesMulticolorRes.highlightingRangeSet ); + highlightingInfoMultiColor.insert( it.key(), highlightingRangesMulticolorRes.highlightingRangeVec ); } } + // SEND_WRN(QString("highlightingInfoMultiColor size - %1").arg(highlightingInfoMultiColor.size())); + //static std::atomic counter(0); //if(counter % 1000 == 0) @@ -1027,18 +1056,22 @@ tItemMetadata::tUpdateUMLInfoResult tItemMetadata::updateUMLInfo(const tFoundMat const tRegexScriptingMetadata& regexScriptingMetadata, tTreeItemSharedPtr pTree) { + // SEND_WRN(QString("[tItemMetadata] updatePlotViewInfo")); + tUpdateUMLInfoResult result; tRegexScriptingMetadata::tCheckIDs checkIDs; - for(const auto& match : foundMatches) + for(const auto& match : foundMatches.foundMatchesVec) { checkIDs.insert(match.idx); } + pUMLInfo = std::make_unique(); + // check if string matches all required UML attributes - UMLInfo.bUMLConstraintsFulfilled = regexScriptingMetadata.doesContainConsistentUMLData(false, checkIDs).first; - UMLInfo.UMLDataMap.clear(); + pUMLInfo->bUMLConstraintsFulfilled = regexScriptingMetadata.doesContainConsistentUMLData(false, checkIDs).first; + pUMLInfo->UMLDataMap.clear(); /* * What should we fill in here? @@ -1060,7 +1093,7 @@ tItemMetadata::tUpdateUMLInfoResult tItemMetadata::updateUMLInfo(const tFoundMat auto pMatchesTree = pTree != nullptr ? pTree : getMatchesTree(foundMatches); - if(true == UMLInfo.bUMLConstraintsFulfilled) // if UML matches are sufficient + if(true == pUMLInfo->bUMLConstraintsFulfilled) // if UML matches are sufficient { if(nullptr != pMatchesTree) { @@ -1110,7 +1143,7 @@ tItemMetadata::tUpdateUMLInfoResult tItemMetadata::updateUMLInfo(const tFoundMat UML_IDItem.first == eUML_ID::UML_EVENT; }; - if(false == isReqResEv() || false == UMLInfo.bContains_Req_Resp_Ev) + if(false == isReqResEv() || false == pUMLInfo->bContains_Req_Resp_Ev) { if(nullptr == UML_IDItem.second.pUML_Custom_Value || true == UML_IDItem.second.pUML_Custom_Value->isEmpty()) // if there is no client's custom value @@ -1135,19 +1168,19 @@ tItemMetadata::tUpdateUMLInfoResult tItemMetadata::updateUMLInfo(const tFoundMat } } - UMLInfo.UMLDataMap[UML_IDItem.first].push_back(UMLDataItem); + pUMLInfo->UMLDataMap[UML_IDItem.first].push_back(UMLDataItem); } else // otherwise { // let's directly assign custom client's value tUMLDataItem UMLDataItem; UMLDataItem.pUML_Custom_Value = UML_IDItem.second.pUML_Custom_Value; - UMLInfo.UMLDataMap[UML_IDItem.first].push_back(UMLDataItem); + pUMLInfo->UMLDataMap[UML_IDItem.first].push_back(UMLDataItem); } if(true == isReqResEv()) { - UMLInfo.bContains_Req_Resp_Ev = true; + pUMLInfo->bContains_Req_Resp_Ev = true; } } else @@ -1174,18 +1207,21 @@ tItemMetadata::updatePlotViewInfo(const tFoundMatches& foundMatches, const tRegexScriptingMetadata& regexScriptingMetadata, tTreeItemSharedPtr pTree) { + // SEND_WRN(QString("[tItemMetadata] updatePlotViewInfo")); tUpdatePlotViewInfoResult result; tRegexScriptingMetadata::tCheckIDs checkIDs; - for(const auto& match : foundMatches) + for(const auto& match : foundMatches.foundMatchesVec) { checkIDs.insert(match.idx); } + pPlotViewInfo = std::make_unique(); + // check if string matches all required UML attributes - plotViewInfo.bPlotViewConstraintsFulfilled = regexScriptingMetadata.doesContainConsistentPlotViewData(false, checkIDs, true).first; - plotViewInfo.plotViewDataMap.clear(); + pPlotViewInfo->bPlotViewConstraintsFulfilled = regexScriptingMetadata.doesContainConsistentPlotViewData(false, checkIDs, true).first; + pPlotViewInfo->plotViewDataMap.clear(); /* * What should we fill in here? @@ -1206,7 +1242,7 @@ tItemMetadata::updatePlotViewInfo(const tFoundMatches& foundMatches, auto pMatchesTree = pTree != nullptr ? pTree : getMatchesTree(foundMatches); - if(true == plotViewInfo.bPlotViewConstraintsFulfilled) // if UML matches are sufficient + if(true == pPlotViewInfo->bPlotViewConstraintsFulfilled) // if UML matches are sufficient { if(nullptr != pMatchesTree) { @@ -1271,7 +1307,7 @@ tItemMetadata::updatePlotViewInfo(const tFoundMatches& foundMatches, plotViewDataItem.optColor = plotViewIDParametersMap.second.optColor; plotViewDataItem.pPlotViewGroupName = plotViewIDParametersMap.second.pPlotViewGroupName; plotViewDataItem.plotViewSplitParameters = plotViewIDParametersMap.second.plotViewSplitParameters; - plotViewInfo.plotViewDataMap[plotViewIDParametersMap.first].push_back(plotViewDataItem); + pPlotViewInfo->plotViewDataMap[plotViewIDParametersMap.first].push_back(plotViewDataItem); }; for(const auto& plotViewIDParametersItem : *(plotViewDataRes.second)) @@ -1299,31 +1335,38 @@ tItemMetadata::updatePlotViewInfo(const tFoundMatches& foundMatches, tFoundMatch::tFoundMatch(): pMatchStr(std::make_shared()), range(0,0), -idx(0), -msgSizeBytes(0u), -timeStamp(0u), -msgId(0) +idx(0) {} tFoundMatch::tFoundMatch( const tQStringPtr& pMatchStr_, const tIntRange& range_, - const int& idx_, - const unsigned int& msgSizeBytes_, - const unsigned int& timeStamp_, - const tMsgId& msgId_): + const int& idx_): pMatchStr((nullptr!=pMatchStr_)?pMatchStr_:std::make_shared()), range(range_), -idx(idx_), -msgSizeBytes(msgSizeBytes_), -timeStamp(timeStamp_), -msgId(msgId_) +idx(idx_) {} bool tFoundMatch::operator< (const tFoundMatch& rhs) const { - return msgId < rhs.msgId; + Q_UNUSED(rhs); + return false; } +//tFoundMatches +tFoundMatches::tFoundMatches(): +timeStamp(0u), +msgId(0), +msgSizeBytes(0u) +{} + +tFoundMatches::tFoundMatches(const std::uint32_t& msgSizeBytes_, + const unsigned int& timeStamp_, + const tMsgId& msgId_): +timeStamp(timeStamp_), +msgId(msgId_), +msgSizeBytes(msgSizeBytes_) +{} + //tFoundMatchesPackItem tFoundMatchesPackItem::tFoundMatchesPackItem() { @@ -1332,7 +1375,7 @@ tFoundMatchesPackItem::tFoundMatchesPackItem() tFoundMatchesPackItem::tFoundMatchesPackItem( tItemMetadata&& itemMetadata_, tFoundMatches&& foundMatches_ ): - mItemMetadata(itemMetadata_), + mItemMetadata(std::move(itemMetadata_)), mFoundMatches(foundMatches_) { } @@ -1898,7 +1941,7 @@ tRegexScriptingMetadataItemPtr parseRegexGroupName( const QString& groupName, && true == bBlueParsed) { optColor.isSet = true; - optColor.color = QColor(red, green, blue); + optColor.color_code = QColor(red, green, blue).rgb(); } } } @@ -1913,7 +1956,7 @@ tRegexScriptingMetadataItemPtr parseRegexGroupName( const QString& groupName, if(colorsMap.end() != foundColor) { optColor.isSet = true; - optColor.color = foundColor->second; + optColor.color_code = foundColor->second.rgb(); } } } @@ -2666,27 +2709,27 @@ bool tColorWrapper::operator< ( const tColorWrapper& rhs ) const } else { - if( optColor.color.red() < rhs.optColor.color.red() ) + if( qRed(optColor.color_code) < qRed(rhs.optColor.color_code) ) { bResult = true; } - else if( optColor.color.red() > rhs.optColor.color.red() ) + else if( qRed(optColor.color_code) > qRed(rhs.optColor.color_code) ) { bResult = false; } else { - if( optColor.color.green() < rhs.optColor.color.green() ) + if( qGreen(optColor.color_code) < qGreen(rhs.optColor.color_code) ) { bResult = true; } - else if( optColor.color.green() > rhs.optColor.color.green() ) + else if( qGreen(optColor.color_code) > qGreen(rhs.optColor.color_code) ) { bResult = false; } else { - if( optColor.color.blue() < rhs.optColor.color.blue() ) + if( qBlue(optColor.color_code) < qBlue(rhs.optColor.color_code) ) { bResult = true; } @@ -3512,6 +3555,16 @@ QColor getChartColor() return sColors[sColorsCounter++ % sColorsSize]; } + tUMLInfo::tUMLInfo() + { + // SEND_WRN(QString("tUMLInfo instance created")); + } + + tPlotViewInfo::tPlotViewInfo() + { + // SEND_WRN(QString("tPlotViewInfo instance created")); + } + PUML_PACKAGE_BEGIN(Qt) PUML_CLASS_BEGIN(QThread) PUML_CLASS_END() diff --git a/dltmessageanalyzerplugin/src/common/Definitions.hpp b/dltmessageanalyzerplugin/src/common/Definitions.hpp index d7db9264..d4b81ff7 100644 --- a/dltmessageanalyzerplugin/src/common/Definitions.hpp +++ b/dltmessageanalyzerplugin/src/common/Definitions.hpp @@ -89,19 +89,19 @@ extern const QString sDefaultRegexFileName; typedef int tMsgId; extern const tMsgId INVALID_MSG_ID; -typedef int tHighlightingRangeItem; +typedef std::int32_t tHighlightingRangeItem; struct tHighlightingRange { tHighlightingRange(); tHighlightingRange( const tHighlightingRangeItem& from_, const tHighlightingRangeItem& to_, const QColor& color_, bool explicitColor_ ); bool operator< ( const tHighlightingRange& rVal ) const; + QRgb color_code; tHighlightingRangeItem from; tHighlightingRangeItem to; - QColor color; bool explicitColor; }; -typedef std::vector tHighlightingRangeList; +typedef std::vector tHighlightingRangeVec; typedef std::set tHighlightingRangeSet; template @@ -154,7 +154,6 @@ struct tRange }; typedef tRange tIntRange; - Q_DECLARE_METATYPE(tIntRange) struct tIntRangePtrWrapper @@ -333,7 +332,7 @@ struct tHighlightingGradient // generates a set of colors from a gradient's definition QVector generateColors( const tHighlightingGradient& gradient ); -typedef QMap tHighlightingInfoMulticolor; +typedef QMap tHighlightingInfoMulticolor; typedef QMap tFieldRanges; struct tFoundMatch @@ -341,10 +340,7 @@ struct tFoundMatch tFoundMatch(); tFoundMatch( const tQStringPtr& pMatchStr_, const tIntRange& range_, - const int& idx_, - const unsigned int& msgSizeBytes_, - const unsigned int& timeStamp_, - const tMsgId& msgId_); + const int& idx_ ); /** * @brief operator < - fake. No actually used as of now. @@ -356,10 +352,7 @@ struct tFoundMatch tQStringPtr pMatchStr; tIntRange range; - int idx; - unsigned int msgSizeBytes; - unsigned int timeStamp; - tMsgId msgId; + std::int16_t idx; }; Q_DECLARE_METATYPE( const tFoundMatch* ) @@ -392,7 +385,19 @@ QVariant toQVariant(const tDataItem& item); tDataItem toRegexDataItem(const QVariant& variant, const eRegexFiltersColumn& column); ///////////////////////////////////////////// -typedef std::vector tFoundMatches; +typedef std::vector tFoundMatchesVec; + +struct tFoundMatches +{ + tFoundMatches(); + tFoundMatches(const std::uint32_t& msgSizeBytes_, + const unsigned int& timeStamp_, + const tMsgId& msgId_); + tFoundMatchesVec foundMatchesVec; + unsigned int timeStamp; + tMsgId msgId; + std::uint32_t msgSizeBytes; +}; typedef QVector QColorVec; @@ -482,7 +487,7 @@ tRegexScriptingMetadataItemPtr parseRegexGroupName( const QString& groupName, struct tCalcRangesCoverageMulticolorResult { - tHighlightingRangeSet highlightingRangeSet; + tHighlightingRangeVec highlightingRangeVec; }; typedef std::map tGroupIdToColorMap; @@ -536,9 +541,10 @@ typedef std::vector tUMLDataItemsVec; typedef std::map tUMLDataMap; struct tUMLInfo { + tUMLInfo(); + tUMLDataMap UMLDataMap; bool bUMLConstraintsFulfilled = false; bool bApplyForUMLCreation = false; - tUMLDataMap UMLDataMap; bool bContains_Req_Resp_Ev = false; }; @@ -557,19 +563,22 @@ typedef std::vector tPlotViewDataItemVec; typedef std::map tPlotViewDataMap; struct tPlotViewInfo { + tPlotViewInfo(); + tPlotViewDataMap plotViewDataMap; bool bPlotViewConstraintsFulfilled = false; bool bApplyForPlotCreation = false; - tPlotViewDataMap plotViewDataMap; }; struct tItemMetadata { tItemMetadata(); + tItemMetadata(const tItemMetadata& rhs); + tItemMetadata& operator= (const tItemMetadata& rhs); tItemMetadata( const tMsgId& msgId_, const tMsgId& msgIdFiltered_, const tFieldRanges& fieldRanges_, const int& strSize_, - const unsigned int& msgSize_, + const std::uint32_t& msgSize_, const unsigned int& timeStamp_); tTreeItemSharedPtr updateHighlightingInfo( const tFoundMatches& foundMatches, const QVector& gradientColors, @@ -595,15 +604,15 @@ struct tItemMetadata const tRegexScriptingMetadata& regexScriptingMetadata, tTreeItemSharedPtr pTree = nullptr); - tMsgId msgId; - tMsgId msgIdFiltered; tHighlightingInfoMulticolor highlightingInfoMultiColor; tFieldRanges fieldRanges; + std::unique_ptr pUMLInfo = nullptr; + std::unique_ptr pPlotViewInfo = nullptr; + tMsgId msgId; + tMsgId msgIdFiltered; int strSize; - unsigned int msgSize; unsigned int timeStamp; - tUMLInfo UMLInfo; - tPlotViewInfo plotViewInfo; + std::uint32_t msgSize; }; typedef QPair tProcessingStringItem; @@ -623,7 +632,9 @@ struct tFoundMatchesPackItem tItemMetadata mItemMetadata; tFoundMatches mFoundMatches; }; -typedef std::vector tFoundMatchesPackItemVec; + +typedef std::shared_ptr tFoundMatchesPackItemPtr; +typedef std::vector tFoundMatchesPackItemVec; struct tFoundMatchesPack { diff --git a/dltmessageanalyzerplugin/src/components/analyzer/src/CDLTRegexAnalyzerWorker.cpp b/dltmessageanalyzerplugin/src/components/analyzer/src/CDLTRegexAnalyzerWorker.cpp index 38282ca5..f77344ca 100644 --- a/dltmessageanalyzerplugin/src/components/analyzer/src/CDLTRegexAnalyzerWorker.cpp +++ b/dltmessageanalyzerplugin/src/components/analyzer/src/CDLTRegexAnalyzerWorker.cpp @@ -102,7 +102,11 @@ void CDLTRegexAnalyzerWorker::analyzePortion( const tAnalyzePortionData& analyz if (true == match.hasMatch()) { - tFoundMatches foundMatches; + tFoundMatches foundMatches(processingString.first.msgSize, + processingString.first.timeStamp, + processingString.first.msgId); + + int foundMatchesVecCapacity = 0; for (int i = 0; i <= match.lastCapturedIndex(); ++i) { @@ -112,16 +116,32 @@ void CDLTRegexAnalyzerWorker::analyzePortion( const tAnalyzePortionData& analyz { if(0 != matchItem.size()) { - foundMatches.push_back( tFoundMatch( std::make_shared(matchItem), + ++foundMatchesVecCapacity; + } + } + } + + // SEND_WRN(QString("foundMatches.foundMatchesVec capacity before reserve - %1").arg(foundMatches.foundMatchesVec.capacity())); + foundMatches.foundMatchesVec.reserve(foundMatchesVecCapacity); + // SEND_WRN(QString("foundMatches.foundMatchesVec capacity after reserve - %1").arg(foundMatches.foundMatchesVec.capacity())); + + for (int i = 0; i <= match.lastCapturedIndex(); ++i) + { + const auto& matchItem = match.captured(i); + + if(i>0) + { + if(0 != matchItem.size()) + { + foundMatches.foundMatchesVec.push_back( tFoundMatch( std::make_shared(matchItem), tIntRange( match.capturedStart(i), match.capturedEnd(i) - 1 ), - i, - processingString.first.msgSize, - processingString.first.timeStamp, - processingString.first.msgId) ); + i) ); } } } + // SEND_WRN(QString("foundMatches.foundMatchesVec capacity after filling in the data - %1").arg(foundMatches.foundMatchesVec.capacity())); + tItemMetadata itemMetadata = processingString.first; auto pTree = itemMetadata.updateHighlightingInfo(foundMatches, mColors, @@ -146,7 +166,7 @@ void CDLTRegexAnalyzerWorker::analyzePortion( const tAnalyzePortionData& analyz pTree); } - foundMatchesPack.matchedItemVec.push_back( tFoundMatchesPackItem( std::move(itemMetadata), std::move(foundMatches) ) ); + foundMatchesPack.matchedItemVec.push_back( std::make_shared( std::move(itemMetadata), std::move(foundMatches) ) ); } } diff --git a/dltmessageanalyzerplugin/src/components/filtersView/src/CFiltersModel.cpp b/dltmessageanalyzerplugin/src/components/filtersView/src/CFiltersModel.cpp index bf9416c2..accaad29 100644 --- a/dltmessageanalyzerplugin/src/components/filtersView/src/CFiltersModel.cpp +++ b/dltmessageanalyzerplugin/src/components/filtersView/src/CFiltersModel.cpp @@ -742,13 +742,16 @@ void CFiltersModel::filterRegexTokensInternal() void CFiltersModel::addCompletionData( const tFoundMatches& foundMatches ) { - for(const auto& foundMatch : foundMatches) + if(false == mVarGroupsMap.empty()) { - auto foundVarGroup = mVarGroupsMap.find(foundMatch.idx); - - if(foundVarGroup != mVarGroupsMap.end()) + for(const auto& foundMatch : foundMatches.foundMatchesVec) { - mCompletionCache[foundMatch.idx].insert( tQStringPtrWrapper( foundMatch.pMatchStr ) ); + auto foundVarGroup = mVarGroupsMap.find(foundMatch.idx); + + if(foundVarGroup != mVarGroupsMap.end()) + { + mCompletionCache[foundMatch.idx].insert( tQStringPtrWrapper( foundMatch.pMatchStr ) ); + } } } } diff --git a/dltmessageanalyzerplugin/src/components/groupedView/src/CGroupedViewModel.cpp b/dltmessageanalyzerplugin/src/components/groupedView/src/CGroupedViewModel.cpp index 1cac2e0d..89e043f3 100644 --- a/dltmessageanalyzerplugin/src/components/groupedView/src/CGroupedViewModel.cpp +++ b/dltmessageanalyzerplugin/src/components/groupedView/src/CGroupedViewModel.cpp @@ -467,39 +467,42 @@ void CGroupedViewModel::addMatches( const tFoundMatches& matches, bool update ) { if(mpRootItem) { - if(false == matches.empty()) + if(false == matches.foundMatchesVec.empty()) { tTreeItem::tDataVec dataVec; + dataVec.reserve(matches.foundMatchesVec.size() + 1); { CTreeItem::tData data; + data.reserve(9); data.push_back( tQStringPtrWrapper(sRootItemName) ); /*SubString*/ data.push_back(tDataItem(1)); /*Messages*/ data.push_back(tDataItem(0)); /*MessagesPercantage*/ data.push_back(tDataItem(0)); /*MessagesPerSecond*/ - data.push_back(tDataItem(static_cast(matches[0].msgSizeBytes))); /*Payload*/ + data.push_back(tDataItem(static_cast(matches.msgSizeBytes))); /*Payload*/ data.push_back(tDataItem(0)); /*PayloadPercantage*/ data.push_back(tDataItem(0)); /*PayloadPerSecondAverage*/ data.push_back(tDataItem()); /*AfterLastVisible*/ - data.push_back(tDataItem(tGroupedViewMetadata(matches[0].timeStamp, matches[0].msgId))); /*Metadata*/ + data.push_back(tDataItem(tGroupedViewMetadata(matches.timeStamp, matches.msgId))); /*Metadata*/ dataVec.push_back( data ); mAnalyzedValues.analyzedMessages += 1; - mAnalyzedValues.analyzedPayload += matches[0].msgSizeBytes; + mAnalyzedValues.analyzedPayload += matches.msgSizeBytes; } - for(const auto& match : matches) + for(const auto& match : matches.foundMatchesVec) { CTreeItem::tData data; + data.reserve(9); data.push_back( tQStringPtrWrapper(match.pMatchStr) ); /*SubString*/ data.push_back(tDataItem(1)); /*Messages*/ data.push_back(tDataItem(0)); /*MessagesPercantage*/ data.push_back(tDataItem(0)); /*MessagesPerSecond*/ - data.push_back(tDataItem(static_cast(match.msgSizeBytes))); /*Payload*/ + data.push_back(tDataItem(static_cast(matches.msgSizeBytes))); /*Payload*/ data.push_back(tDataItem(0)); /*PayloadPercantage*/ data.push_back(tDataItem(0)); /*PayloadPerSecondAverage*/ data.push_back(tDataItem()); /*AfterLastVisible*/ - data.push_back(tDataItem(tGroupedViewMetadata(match.timeStamp, match.msgId))); /*Metadata*/ + data.push_back(tDataItem(tGroupedViewMetadata(matches.timeStamp, matches.msgId))); /*Metadata*/ dataVec.push_back( data ); } diff --git a/dltmessageanalyzerplugin/src/components/plotView/src/CPlotViewComponent.cpp b/dltmessageanalyzerplugin/src/components/plotView/src/CPlotViewComponent.cpp index 7e441d7d..5851edab 100644 --- a/dltmessageanalyzerplugin/src/components/plotView/src/CPlotViewComponent.cpp +++ b/dltmessageanalyzerplugin/src/components/plotView/src/CPlotViewComponent.cpp @@ -347,10 +347,10 @@ void generateAxisRect(const std::pairsetBrush(usedColor.color); - pGraph->setPen(usedColor.color); + pGraph->setBrush(QColor(usedColor.color_code)); + pGraph->setPen(QColor(usedColor.color_code)); auto getAxisTypeResult = pPlot->getAxisRectType(pAxisRect); if(true == getAxisTypeResult.first && getAxisTypeResult.second == ePlotViewAxisType::e_POINT) { - pGraph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, QColor(0,0,0), usedColor.color, 6)); + pGraph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, QColor(0,0,0), QColor(usedColor.color_code), 6)); } else { diff --git a/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultHighlightingDelegate.cpp b/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultHighlightingDelegate.cpp index bf31b9c8..06da3942 100644 --- a/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultHighlightingDelegate.cpp +++ b/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultHighlightingDelegate.cpp @@ -153,7 +153,7 @@ static void collectDrawData(const QString& inputStr, if(true == isExplicitColor) { - drawData.color = range.color; + drawData.color = range.color_code; } else { @@ -163,7 +163,7 @@ static void collectDrawData(const QString& inputStr, } else { - drawData.color = range.color; + drawData.color = range.color_code; } } @@ -273,7 +273,7 @@ static void drawText( const tDrawDataPack& drawDataPack, } static void collectDrawDataPack(const QString& inputStr, - const tHighlightingRangeSet& highlightingData, + const tHighlightingRangeVec& highlightingData, tDrawDataPack& drawDataPack, const QStyleOptionViewItem& option, bool isMonoColorHighlighting, @@ -284,8 +284,10 @@ static void collectDrawDataPack(const QString& inputStr, drawDataPack.isSelected = true; } + tHighlightingRangeSet highlightingRangeSet(highlightingData.begin(), highlightingData.end()); + int i = 0; - for(auto it = highlightingData.begin(); it != highlightingData.end(); ++it) + for(auto it = highlightingRangeSet.begin(); it != highlightingRangeSet.end(); ++it) { const auto& range = *it; @@ -296,7 +298,7 @@ static void collectDrawDataPack(const QString& inputStr, collectDrawData( inputStr, drawDataPack, option, - tHighlightingRange(0, range.from - 1, range.color, range.explicitColor), + tHighlightingRange(0, range.from - 1, range.color_code, range.explicitColor), false, isMonoColorHighlighting, regexMonoHighlightingColor); @@ -305,7 +307,7 @@ static void collectDrawDataPack(const QString& inputStr, collectDrawData( inputStr, drawDataPack, option, - tHighlightingRange( range.from, range.to, range.color, range.explicitColor ), + tHighlightingRange( range.from, range.to, range.color_code, range.explicitColor ), true, isMonoColorHighlighting, regexMonoHighlightingColor ); @@ -321,7 +323,7 @@ static void collectDrawDataPack(const QString& inputStr, collectDrawData( inputStr, drawDataPack, option, - tHighlightingRange(prevRange.to + 1, range.from - 1, range.color, range.explicitColor), + tHighlightingRange(prevRange.to + 1, range.from - 1, range.color_code, range.explicitColor), false, isMonoColorHighlighting, regexMonoHighlightingColor ); @@ -330,20 +332,20 @@ static void collectDrawDataPack(const QString& inputStr, collectDrawData( inputStr, drawDataPack, option, - tHighlightingRange( range.from, range.to, range.color, range.explicitColor ), + tHighlightingRange( range.from, range.to, range.color_code, range.explicitColor ), true, isMonoColorHighlighting, regexMonoHighlightingColor ); } - if(i == static_cast(highlightingData.size() - 1)) // last element + if(i == static_cast(highlightingRangeSet.size() - 1)) // last element { if( range.to < inputStr.size() - 1 ) { collectDrawData( inputStr, drawDataPack, option, - tHighlightingRange(range.to + 1, inputStr.size() - 1, range.color, range.explicitColor), + tHighlightingRange(range.to + 1, inputStr.size() - 1, range.color_code, range.explicitColor), false, isMonoColorHighlighting, regexMonoHighlightingColor ); diff --git a/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultModel.cpp b/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultModel.cpp index 0484921a..9b3de865 100644 --- a/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultModel.cpp +++ b/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultModel.cpp @@ -19,7 +19,16 @@ CSettingsManagerClient(pSettingsManager), mFoundMatchesPack(), mpFile(nullptr) { - + SEND_WRN(QString("Size of tFoundMatchesPackItem - %1").arg(sizeof(tFoundMatchesPackItem))); + SEND_WRN(QString("Size of tItemMetadata - %1").arg(sizeof(tItemMetadata))); + SEND_WRN(QString("Size of tFoundMatches - %1").arg(sizeof(tFoundMatches))); + SEND_WRN(QString("Size of tFoundMatch - %1").arg(sizeof(tFoundMatch))); + SEND_WRN(QString("Size of tHighlightingInfoMulticolor - %1").arg(sizeof(tHighlightingInfoMulticolor))); + SEND_WRN(QString("Size of tFieldRanges - %1").arg(sizeof(tFieldRanges))); + SEND_WRN(QString("Size of tUMLInfo - %1").arg(sizeof(tUMLInfo))); + SEND_WRN(QString("Size of tPlotViewInfo - %1").arg(sizeof(tPlotViewInfo))); + SEND_WRN(QString("Size of tHighlightingRange - %1").arg(sizeof(tHighlightingRange))); + SEND_WRN(QString("Size of tDataItem - %1").arg(sizeof(tDataItem))); } void CSearchResultModel::setFile(const tFileWrapperPtr& pFile) @@ -56,11 +65,11 @@ const tFoundMatchesPackItem& CSearchResultModel::getFoundMatchesItemPack( const if ( ( modelIndex.row() < 0 || modelIndex.row() >= static_cast(mFoundMatchesPack.matchedItemVec.size()) ) || ( modelIndex.column() < 0 || modelIndex.column() >= static_cast(eSearchResultColumn::Last) ) ) { - static const tFoundMatchesPackItem sDummyValue; - return sDummyValue; + static const tFoundMatchesPackItemPtr spDummyValue = std::make_shared(); + return *spDummyValue; } - return mFoundMatchesPack.matchedItemVec[ static_cast(modelIndex.row()) ]; + return *mFoundMatchesPack.matchedItemVec[ static_cast(modelIndex.row()) ]; } QVariant CSearchResultModel::data(const QModelIndex &index, int role) const @@ -103,44 +112,53 @@ QVariant CSearchResultModel::data(const QModelIndex &index, int role) const ( column != eSearchResultColumn::UML_Applicability && column != eSearchResultColumn::PlotView_Applicability ) ) { - auto msgId = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadata().msgId; - const auto& pMsg = mpFile->getMsg(msgId); - auto pStrValue = getDataStrFromMsg(msgId, pMsg, column); - - if(nullptr != pStrValue) + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(index.row())]) { - result = std::move(*pStrValue); + auto msgId = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadata().msgId; + const auto& pMsg = mpFile->getMsg(msgId); + auto pStrValue = getDataStrFromMsg(msgId, pMsg, column); + + if(nullptr != pStrValue) + { + result = std::move(*pStrValue); + } } } else if( role == Qt::CheckStateRole &&( index.column() == static_cast(eSearchResultColumn::UML_Applicability) ) ) { - const auto& UMLInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadata().UMLInfo; - - if(true == UMLInfo.bUMLConstraintsFulfilled) + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(index.row())]) { - if(true == UMLInfo.bApplyForUMLCreation) - { - result = Qt::CheckState::Checked; - } - else + const auto& pUMLInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadata().pUMLInfo; + + if(nullptr != pUMLInfo && true == pUMLInfo->bUMLConstraintsFulfilled) { - result = Qt::CheckState::Unchecked; + if(true == pUMLInfo->bApplyForUMLCreation) + { + result = Qt::CheckState::Checked; + } + else + { + result = Qt::CheckState::Unchecked; + } } } } else if( role == Qt::CheckStateRole &&( index.column() == static_cast(eSearchResultColumn::PlotView_Applicability) ) ) { - const auto& plotViewInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadata().plotViewInfo; - - if(true == plotViewInfo.bPlotViewConstraintsFulfilled) + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(index.row())]) { - if(true == plotViewInfo.bApplyForPlotCreation) - { - result = Qt::CheckState::Checked; - } - else + const auto& pPlotViewInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadata().pPlotViewInfo; + + if(nullptr != pPlotViewInfo && true == pPlotViewInfo->bPlotViewConstraintsFulfilled) { - result = Qt::CheckState::Unchecked; + if(true == pPlotViewInfo->bApplyForPlotCreation) + { + result = Qt::CheckState::Checked; + } + else + { + result = Qt::CheckState::Unchecked; + } } } } @@ -180,28 +198,34 @@ Qt::ItemFlags CSearchResultModel::flags(const QModelIndex &index) const { if(static_cast(index.column()) == eSearchResultColumn::UML_Applicability) { - const auto& UMLInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadata().UMLInfo; - - if(true == UMLInfo.bUMLConstraintsFulfilled) + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(index.row())]) { - result = QAbstractItemModel::flags(index) | Qt::ItemIsEditable; - } - else - { - result = QAbstractItemModel::flags(index) & (~Qt::ItemIsEditable); + const auto& pUMLInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadata().pUMLInfo; + + if(nullptr != pUMLInfo && true == pUMLInfo->bUMLConstraintsFulfilled) + { + result = QAbstractItemModel::flags(index) | Qt::ItemIsEditable; + } + else + { + result = QAbstractItemModel::flags(index) & (~Qt::ItemIsEditable); + } } } else if(static_cast(index.column()) == eSearchResultColumn::PlotView_Applicability) { - const auto& plotViewInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadata().plotViewInfo; - - if(true == plotViewInfo.bPlotViewConstraintsFulfilled) - { - result = QAbstractItemModel::flags(index) | Qt::ItemIsEditable; - } - else + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(index.row())]) { - result = QAbstractItemModel::flags(index) & (~Qt::ItemIsEditable); + const auto& pPlotViewInfo = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadata().pPlotViewInfo; + + if(nullptr != pPlotViewInfo && true == pPlotViewInfo->bPlotViewConstraintsFulfilled) + { + result = QAbstractItemModel::flags(index) | Qt::ItemIsEditable; + } + else + { + result = QAbstractItemModel::flags(index) & (~Qt::ItemIsEditable); + } } } else @@ -245,7 +269,10 @@ int CSearchResultModel::getFileIdx( const QModelIndex& idx ) const if(row >= 0 && static_cast(row) < mFoundMatchesPack.matchedItemVec.size()) { - result = mFoundMatchesPack.matchedItemVec[static_cast(row)].getItemMetadata().msgIdFiltered; + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(row)]) + { + result = mFoundMatchesPack.matchedItemVec[static_cast(row)]->getItemMetadata().msgIdFiltered; + } } return result; @@ -298,269 +325,272 @@ std::pair CSearchResultModel::get for(const auto& foundMatchPack : mFoundMatchesPack.matchedItemVec) { - QString subStr; - - const auto& itemMetadata = foundMatchPack.getItemMetadata(); - - if(true == itemMetadata.UMLInfo.bUMLConstraintsFulfilled - && true == itemMetadata.UMLInfo.bApplyForUMLCreation) + if(nullptr != foundMatchPack) { - // Result string - : [timestamp] () + QString subStr; - tIntRange insertMethodFormattingRange; - tIntRange insertMethodFormattingOffset; + const auto& itemMetadata = foundMatchPack->getItemMetadata(); - auto getUMLItemRepresentation = [this, &itemMetadata, &row](const eUML_ID& UML_ID)->std::pair + if(nullptr != itemMetadata.pUMLInfo && true == itemMetadata.pUMLInfo->bUMLConstraintsFulfilled + && true == itemMetadata.pUMLInfo->bApplyForUMLCreation) { - std::pair UMLRepresentationResult; - UMLRepresentationResult.first = false; + // Result string - : [timestamp] () - auto foundUMLDataItem = itemMetadata.UMLInfo.UMLDataMap.find(UML_ID); + tIntRange insertMethodFormattingRange; + tIntRange insertMethodFormattingOffset; - if(foundUMLDataItem != itemMetadata.UMLInfo.UMLDataMap.end()) + auto getUMLItemRepresentation = [this, &itemMetadata, &row](const eUML_ID& UML_ID)->std::pair { - for(const auto& item : foundUMLDataItem->second) + std::pair UMLRepresentationResult; + UMLRepresentationResult.first = false; + + auto foundUMLDataItem = itemMetadata.pUMLInfo->UMLDataMap.find(UML_ID); + + if(foundUMLDataItem != itemMetadata.pUMLInfo->UMLDataMap.end()) { - if(item.pUML_Custom_Value == nullptr || - true == item.pUML_Custom_Value->isEmpty()) // if there is no client-defined value + for(const auto& item : foundUMLDataItem->second) { - // let's use value from the corresponding group - for(const auto& stringCoverageMapItem : item.stringCoverageMap) + if(item.pUML_Custom_Value == nullptr || + true == item.pUML_Custom_Value->isEmpty()) // if there is no client-defined value { - auto column = stringCoverageMapItem.first; + // let's use value from the corresponding group + for(const auto& stringCoverageMapItem : item.stringCoverageMap) + { + auto column = stringCoverageMapItem.first; - QString message = getStrValue(row, column); + QString message = getStrValue(row, column); - auto messageSize = message.size(); - const auto& range = stringCoverageMapItem.second.range; + auto messageSize = message.size(); + const auto& range = stringCoverageMapItem.second.range; - if(range.from >= 0 && range.from < messageSize && - range.to >= 0 && range.to < messageSize ) - { - switch(UML_ID) + if(range.from >= 0 && range.from < messageSize && + range.to >= 0 && range.to < messageSize ) { - case eUML_ID::UML_REQUEST: - UMLRepresentationResult.second.append("->"); - break; - case eUML_ID::UML_RESPONSE: - case eUML_ID::UML_EVENT: - UMLRepresentationResult.second.append("<-"); - break; - case eUML_ID::UML_ARGUMENTS: + switch(UML_ID) { - int numberOfCharacters = range.to - range.from + 1; - QString argString = message.mid(range.from, numberOfCharacters); - argString.replace("[[", "[ ["); - argString.replace("]]", "] ]"); - UMLRepresentationResult.second.append(argString); - - if(true == stringCoverageMapItem.second.bAddSeparator) + case eUML_ID::UML_REQUEST: + UMLRepresentationResult.second.append("->"); + break; + case eUML_ID::UML_RESPONSE: + case eUML_ID::UML_EVENT: + UMLRepresentationResult.second.append("<-"); + break; + case eUML_ID::UML_ARGUMENTS: { - UMLRepresentationResult.second.append(" "); + int numberOfCharacters = range.to - range.from + 1; + QString argString = message.mid(range.from, numberOfCharacters); + argString.replace("[[", "[ ["); + argString.replace("]]", "] ]"); + UMLRepresentationResult.second.append(argString); + + if(true == stringCoverageMapItem.second.bAddSeparator) + { + UMLRepresentationResult.second.append(" "); + } } - } - break; - case eUML_ID::UML_CLIENT: - case eUML_ID::UML_SERVICE: - { - QString str; - str.append("\""); - str.append(message.mid(range.from, range.to - range.from + 1)); - - if(true == stringCoverageMapItem.second.bAddSeparator) + break; + case eUML_ID::UML_CLIENT: + case eUML_ID::UML_SERVICE: { - str.append(" "); - } + QString str; + str.append("\""); + str.append(message.mid(range.from, range.to - range.from + 1)); - str.append("\""); + if(true == stringCoverageMapItem.second.bAddSeparator) + { + str.append(" "); + } - UMLRepresentationResult.second.append(str); - } - break; - case eUML_ID::UML_TIMESTAMP: - { - QString str; - str.append("["); - str.append( message.mid(range.from, range.to - range.from + 1) ); - str.append("] "); + str.append("\""); - UMLRepresentationResult.second.append(str); - } - break; - default: - { - UMLRepresentationResult.second.append(message.mid(range.from, range.to - range.from + 1)); + UMLRepresentationResult.second.append(str); + } + break; + case eUML_ID::UML_TIMESTAMP: + { + QString str; + str.append("["); + str.append( message.mid(range.from, range.to - range.from + 1) ); + str.append("] "); - if(true == stringCoverageMapItem.second.bAddSeparator) + UMLRepresentationResult.second.append(str); + } + break; + default: { - UMLRepresentationResult.second.append(" "); + UMLRepresentationResult.second.append(message.mid(range.from, range.to - range.from + 1)); + + if(true == stringCoverageMapItem.second.bAddSeparator) + { + UMLRepresentationResult.second.append(" "); + } } + break; } - break; } - } - UMLRepresentationResult.first = true; + UMLRepresentationResult.first = true; + } } - } - else // otherwise - { - switch(UML_ID) + else // otherwise { - case eUML_ID::UML_CLIENT: - case eUML_ID::UML_SERVICE: - { - QString str; - str.reserve(item.pUML_Custom_Value->size() + 2); - str.append("\""); - str.append(*item.pUML_Custom_Value); - str.append("\""); - - // let's directly use client-defined value, ignoring value from the group - UMLRepresentationResult.second.append(str); - } - break; - case eUML_ID::UML_TIMESTAMP: - { - const auto column = eSearchResultColumn::Timestamp; - QString timestampVal = getStrValue(row, column); - QString str; - str.reserve(timestampVal.size() + 3); - str.append("["); - str.append( timestampVal ); - str.append("] "); - - // let's use dlt's native timestamp - UMLRepresentationResult.second.append(str); - } - break; - default: + switch(UML_ID) { - // let's directly use client-defined value, ignoring value from the group - UMLRepresentationResult.second.append(*item.pUML_Custom_Value); + case eUML_ID::UML_CLIENT: + case eUML_ID::UML_SERVICE: + { + QString str; + str.reserve(item.pUML_Custom_Value->size() + 2); + str.append("\""); + str.append(*item.pUML_Custom_Value); + str.append("\""); + + // let's directly use client-defined value, ignoring value from the group + UMLRepresentationResult.second.append(str); + } + break; + case eUML_ID::UML_TIMESTAMP: + { + const auto column = eSearchResultColumn::Timestamp; + QString timestampVal = getStrValue(row, column); + QString str; + str.reserve(timestampVal.size() + 3); + str.append("["); + str.append( timestampVal ); + str.append("] "); + + // let's use dlt's native timestamp + UMLRepresentationResult.second.append(str); + } + break; + default: + { + // let's directly use client-defined value, ignoring value from the group + UMLRepresentationResult.second.append(*item.pUML_Custom_Value); + } + break; } - break; - } - UMLRepresentationResult.first = true; + UMLRepresentationResult.first = true; + } } } - } - else - { - if(UML_ID == eUML_ID::UML_TIMESTAMP) + else { - const auto column = eSearchResultColumn::Timestamp; - QString timestampVal = getStrValue(row, column); - QString str; - str.reserve(timestampVal.size() + 3); - str.append("["); - str.append( timestampVal ); - str.append("] "); - - // let's use dlt's native timestamp - UMLRepresentationResult.second.append(str); - UMLRepresentationResult.first = true; + if(UML_ID == eUML_ID::UML_TIMESTAMP) + { + const auto column = eSearchResultColumn::Timestamp; + QString timestampVal = getStrValue(row, column); + QString str; + str.reserve(timestampVal.size() + 3); + str.append("["); + str.append( timestampVal ); + str.append("] "); + + // let's use dlt's native timestamp + UMLRepresentationResult.second.append(str); + UMLRepresentationResult.first = true; + } } - } - return UMLRepresentationResult; - }; + return UMLRepresentationResult; + }; - auto appendUMLData = [&getUMLItemRepresentation, &subStr](const eUML_ID& UML_ID) - { - auto umlRepresentationResult = getUMLItemRepresentation(UML_ID); + auto appendUMLData = [&getUMLItemRepresentation, &subStr](const eUML_ID& UML_ID) + { + auto umlRepresentationResult = getUMLItemRepresentation(UML_ID); - if(true == umlRepresentationResult.first) + if(true == umlRepresentationResult.first) + { + subStr.append(umlRepresentationResult.second); + } + else + { + //SEND_ERR(QString("Was not able to find \"%1\" field!").arg(getUMLIDAsString(UML_ID))); + } + }; + + appendUMLData(eUML_ID::UML_CLIENT); + subStr.append(" "); + appendUMLData(eUML_ID::UML_REQUEST); + appendUMLData(eUML_ID::UML_RESPONSE); + appendUMLData(eUML_ID::UML_EVENT); + subStr.append(" "); + appendUMLData(eUML_ID::UML_SERVICE); + subStr.append(" : "); + int wrappingStartingPoint = subStr.size(); + appendUMLData(eUML_ID::UML_TIMESTAMP); + appendUMLData(eUML_ID::UML_SEQUENCE_ID); + subStr.append(" "); + insertMethodFormattingRange.from = subStr.size(); + appendUMLData(eUML_ID::UML_METHOD); + insertMethodFormattingRange.to = subStr.size(); + subStr.append("("); + + if(true == getSettingsManager()->getUML_ShowArguments()) { - subStr.append(umlRepresentationResult.second); + appendUMLData(eUML_ID::UML_ARGUMENTS); } else { - //SEND_ERR(QString("Was not able to find \"%1\" field!").arg(getUMLIDAsString(UML_ID))); + subStr.append(" ... "); } - }; - appendUMLData(eUML_ID::UML_CLIENT); - subStr.append(" "); - appendUMLData(eUML_ID::UML_REQUEST); - appendUMLData(eUML_ID::UML_RESPONSE); - appendUMLData(eUML_ID::UML_EVENT); - subStr.append(" "); - appendUMLData(eUML_ID::UML_SERVICE); - subStr.append(" : "); - int wrappingStartingPoint = subStr.size(); - appendUMLData(eUML_ID::UML_TIMESTAMP); - appendUMLData(eUML_ID::UML_SEQUENCE_ID); - subStr.append(" "); - insertMethodFormattingRange.from = subStr.size(); - appendUMLData(eUML_ID::UML_METHOD); - insertMethodFormattingRange.to = subStr.size(); - subStr.append("("); - - if(true == getSettingsManager()->getUML_ShowArguments()) - { - appendUMLData(eUML_ID::UML_ARGUMENTS); - } - else - { - subStr.append(" ... "); - } - - subStr.append(")"); + subStr.append(")"); - subStr.append("\n"); + subStr.append("\n"); - // wrapping logic - { - if(true == getSettingsManager()->getUML_WrapOutput()) + // wrapping logic { - const int insertNewLineRange = 100; - - if(subStr.size() > insertNewLineRange) + if(true == getSettingsManager()->getUML_WrapOutput()) { - const QString insertStr = "\\n"; + const int insertNewLineRange = 100; - subStr.reserve(subStr.size() + ( insertStr.size() * ( (subStr.size() / insertNewLineRange) + 1 ) ) ); + if(subStr.size() > insertNewLineRange) + { + const QString insertStr = "\\n"; - int currentIndex = wrappingStartingPoint + insertNewLineRange; - int currentOffset = 0; + subStr.reserve(subStr.size() + ( insertStr.size() * ( (subStr.size() / insertNewLineRange) + 1 ) ) ); - while( (currentIndex + currentOffset) < subStr.size()) - { - if(currentIndex + currentOffset < insertMethodFormattingRange.from) - { - insertMethodFormattingOffset.from += insertStr.size(); - } + int currentIndex = wrappingStartingPoint + insertNewLineRange; + int currentOffset = 0; - if(currentIndex + currentOffset < insertMethodFormattingRange.to) + while( (currentIndex + currentOffset) < subStr.size()) { - insertMethodFormattingOffset.to += insertStr.size(); - } + if(currentIndex + currentOffset < insertMethodFormattingRange.from) + { + insertMethodFormattingOffset.from += insertStr.size(); + } - subStr.insert( currentIndex + currentOffset, insertStr ); - currentIndex += insertNewLineRange; - currentOffset += insertStr.size(); + if(currentIndex + currentOffset < insertMethodFormattingRange.to) + { + insertMethodFormattingOffset.to += insertStr.size(); + } + + subStr.insert( currentIndex + currentOffset, insertStr ); + currentIndex += insertNewLineRange; + currentOffset += insertStr.size(); + } } } } - } - subStr.insert(insertMethodFormattingRange.from + insertMethodFormattingOffset.from, "__**"); - subStr.insert(insertMethodFormattingRange.to + insertMethodFormattingOffset.to + 4, "**__"); + subStr.insert(insertMethodFormattingRange.from + insertMethodFormattingOffset.from, "__**"); + subStr.insert(insertMethodFormattingRange.to + insertMethodFormattingOffset.to + 4, "**__"); - outputString.append(subStr); + outputString.append(subStr); - ++numberOfRows; + ++numberOfRows; - const auto& maxRowsNumber = getSettingsManager()->getUML_MaxNumberOfRowsInDiagram(); + const auto& maxRowsNumber = getSettingsManager()->getUML_MaxNumberOfRowsInDiagram(); - // if we've reached the limit - if(numberOfRows >= maxRowsNumber) - { - // stop addition of new rows - SEND_WRN(QString("Not all UML content will be rendered. Number of rows in diagram was limited to %1 rows due to specified settings").arg(maxRowsNumber)); - break; + // if we've reached the limit + if(numberOfRows >= maxRowsNumber) + { + // stop addition of new rows + SEND_WRN(QString("Not all UML content will be rendered. Number of rows in diagram was limited to %1 rows due to specified settings").arg(maxRowsNumber)); + break; + } } } @@ -1475,45 +1505,49 @@ ISearchResultModel::tPlotContent CSearchResultModel::createPlotContent() const for(const auto& foundMatchPack : mFoundMatchesPack.matchedItemVec) { - const auto& itemMetadata = foundMatchPack.getItemMetadata(); - - if(true == itemMetadata.plotViewInfo.bPlotViewConstraintsFulfilled - && true == itemMetadata.plotViewInfo.bApplyForPlotCreation) + if(nullptr != foundMatchPack) { - detail::tMetadataItem metadataItem; - - bool bXDataPresented = itemMetadata.plotViewInfo.plotViewDataMap.find(ePlotViewID::PLOT_X_DATA) != - itemMetadata.plotViewInfo.plotViewDataMap.end(); - bool skipRowFlag = false; + const auto& itemMetadata = foundMatchPack->getItemMetadata(); - for(auto it = itemMetadata.plotViewInfo.plotViewDataMap.begin(); - it != itemMetadata.plotViewInfo.plotViewDataMap.end() && false == skipRowFlag; - ++it) + if(nullptr != itemMetadata.pPlotViewInfo + && true == itemMetadata.pPlotViewInfo->bPlotViewConstraintsFulfilled + && true == itemMetadata.pPlotViewInfo->bApplyForPlotCreation) { - const auto& plotViewDataMap = *it; - const auto& plotViewID = plotViewDataMap.first; - const auto& plotViewDataItemVec = plotViewDataMap.second; - - skipRowFlag = !detail::processPlotViewDataItemVec(*this, - plotViewID, - plotViewDataItemVec, - result, - itemMetadata.msgIdFiltered, - axisNameMetadataMap, - row, - bXDataPresented, - metadataItem); + detail::tMetadataItem metadataItem; + + bool bXDataPresented = itemMetadata.pPlotViewInfo->plotViewDataMap.find(ePlotViewID::PLOT_X_DATA) != + itemMetadata.pPlotViewInfo->plotViewDataMap.end(); + bool skipRowFlag = false; + + for(auto it = itemMetadata.pPlotViewInfo->plotViewDataMap.begin(); + it != itemMetadata.pPlotViewInfo->plotViewDataMap.end() && false == skipRowFlag; + ++it) + { + const auto& plotViewDataMap = *it; + const auto& plotViewID = plotViewDataMap.first; + const auto& plotViewDataItemVec = plotViewDataMap.second; + + skipRowFlag = !detail::processPlotViewDataItemVec(*this, + plotViewID, + plotViewDataItemVec, + result, + itemMetadata.msgIdFiltered, + axisNameMetadataMap, + row, + bXDataPresented, + metadataItem); + } } - } - ++row; + ++row; - // Lock labels parsing for axis rects where they were already parsed, - // cause we do not expect new content for those in other found lines. - for(auto& axisNameMetadataMapPair : axisNameMetadataMap) - { - if(true == axisNameMetadataMapPair.second.bLabelParsed) + // Lock labels parsing for axis rects where they were already parsed, + // cause we do not expect new content for those in other found lines. + for(auto& axisNameMetadataMapPair : axisNameMetadataMap) { - axisNameMetadataMapPair.second.bLabelParsingLocked = true; + if(true == axisNameMetadataMapPair.second.bLabelParsed) + { + axisNameMetadataMapPair.second.bLabelParsingLocked = true; + } } } } @@ -1533,12 +1567,15 @@ void CSearchResultModel::setUML_Applicability( const QModelIndex& index, bool ch { if(true == index.isValid()) { - auto& UML_Info = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadataWriteable().UMLInfo; - - if(true == UML_Info.bUMLConstraintsFulfilled) + if(nullptr != mFoundMatchesPack.matchedItemVec[static_cast(index.row())]) { - UML_Info.bApplyForUMLCreation = checked; - dataChanged(index, index); + auto& pUML_Info = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadataWriteable().pUMLInfo; + + if(nullptr != pUML_Info && true == pUML_Info->bUMLConstraintsFulfilled) + { + pUML_Info->bApplyForUMLCreation = checked; + dataChanged(index, index); + } } } } @@ -1547,11 +1584,11 @@ void CSearchResultModel::setPlotView_Applicability( const QModelIndex& index, bo { if(true == index.isValid()) { - auto& plotView_Info = mFoundMatchesPack.matchedItemVec[static_cast(index.row())].getItemMetadataWriteable().plotViewInfo; + auto& pPlotView_Info = mFoundMatchesPack.matchedItemVec[static_cast(index.row())]->getItemMetadataWriteable().pPlotViewInfo; - if(true == plotView_Info.bPlotViewConstraintsFulfilled) + if(nullptr != pPlotView_Info && true == pPlotView_Info->bPlotViewConstraintsFulfilled) { - plotView_Info.bApplyForPlotCreation = checked; + pPlotView_Info->bApplyForPlotCreation = checked; dataChanged(index, index); } } diff --git a/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultView.cpp b/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultView.cpp index 400eb4c6..516ff8cc 100644 --- a/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultView.cpp +++ b/dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultView.cpp @@ -578,7 +578,7 @@ void CSearchResultView::copySelectionToClipboard( bool copyAsHTML, bool copyOnly if(true == isExplicitColor) { - result = range.color; + result = range.color_code; } else { @@ -588,7 +588,7 @@ void CSearchResultView::copySelectionToClipboard( bool copyAsHTML, bool copyOnly } else { - result = range.color; + result = range.color_code; } } diff --git a/dltmessageanalyzerplugin/src/plugin/src/CDLTMessageAnalyzer.cpp b/dltmessageanalyzerplugin/src/plugin/src/CDLTMessageAnalyzer.cpp index 50e5501c..39c0bf42 100644 --- a/dltmessageanalyzerplugin/src/plugin/src/CDLTMessageAnalyzer.cpp +++ b/dltmessageanalyzerplugin/src/plugin/src/CDLTMessageAnalyzer.cpp @@ -1137,13 +1137,16 @@ void CDLTMessageAnalyzer::progressNotification(const tProgressNotificationData& for(auto foundMatchesIt = progressNotificationData.processedMatches.matchedItemVec.begin(); foundMatchesIt != progressNotificationData.processedMatches.matchedItemVec.end(); ++foundMatchesIt) { - auto endIt = progressNotificationData.processedMatches.matchedItemVec.end(); - if(true == isGroupedViewFeatureActiveForCurrentAnalysis()) + if(nullptr != *foundMatchesIt) { - mpGroupedViewModel->addMatches(foundMatchesIt->getFoundMatches(), foundMatchesIt == --(endIt)); - } + auto endIt = progressNotificationData.processedMatches.matchedItemVec.end(); + if(true == isGroupedViewFeatureActiveForCurrentAnalysis()) + { + mpGroupedViewModel->addMatches((*foundMatchesIt)->getFoundMatches(), foundMatchesIt == --(endIt)); + } - mpFiltersModel->addCompletionData(foundMatchesIt->getFoundMatches()); + mpFiltersModel->addCompletionData((*foundMatchesIt)->getFoundMatches()); + } } updateProgress(progressNotificationData.progress, @@ -1183,14 +1186,17 @@ void CDLTMessageAnalyzer::progressNotification(const tProgressNotificationData& foundMatchesIt != progressNotificationData.processedMatches.matchedItemVec.end(); ++foundMatchesIt) { - auto endIt = progressNotificationData.processedMatches.matchedItemVec.end(); - - if(true == isGroupedViewFeatureActiveForCurrentAnalysis()) + if(nullptr != *foundMatchesIt) { - mpGroupedViewModel->addMatches(foundMatchesIt->getFoundMatches(), foundMatchesIt == --(endIt)); - } + auto endIt = progressNotificationData.processedMatches.matchedItemVec.end(); - mpFiltersModel->addCompletionData(foundMatchesIt->getFoundMatches()); + if(true == isGroupedViewFeatureActiveForCurrentAnalysis()) + { + mpGroupedViewModel->addMatches((*foundMatchesIt)->getFoundMatches(), foundMatchesIt == --(endIt)); + } + + mpFiltersModel->addCompletionData((*foundMatchesIt)->getFoundMatches()); + } } updateProgress(progressNotificationData.progress, @@ -1226,11 +1232,14 @@ void CDLTMessageAnalyzer::progressNotification(const tProgressNotificationData& for(const auto& match : progressNotificationData.processedMatches.matchedItemVec) { - CTableMemoryJumper::tCheckItem checkItem; - checkItem.first = static_cast( match.getItemMetadata().msgId ); - checkItem.second = additionResult.second.from + counter; - checkSet.insert(checkItem); - ++counter; + if(nullptr != match) + { + CTableMemoryJumper::tCheckItem checkItem; + checkItem.first = static_cast( match->getItemMetadata().msgId ); + checkItem.second = additionResult.second.from + counter; + checkSet.insert(checkItem); + ++counter; + } } mpSearchViewTableJumper->checkRows(checkSet);