Skip to content

Commit

Permalink
[ISSUE #111][COMPONENTS] Introduce components architecture in the pro…
Browse files Browse the repository at this point in the history
…ject

1. [x] Have you followed the guidelines in our [Contributing document](../blob/master/CONTRIBUTING.md)?
2. [x] Have you checked to ensure there aren't other open [Pull Requests](../pulls) for the same update/change?
3. [x] Have you built the project, and performed manual testing of your functionality for all supported platforms - Linux and Windows?
4. [x] Is your change backward-compatible with the previous version of the plugin?

>>> Change description:

- Creation of the separate component from the dltWrappers folder of the project
- Adaptation of the project
- Update of the class diagrams
- Update of README

>>> Verification criteria:

- Manually checked on the Windows platform
- All sanity checks on Git Hub were passed
  • Loading branch information
svlad-90 committed Dec 29, 2020
1 parent 2200bc6 commit db7fd5f
Show file tree
Hide file tree
Showing 84 changed files with 4,426 additions and 1,676 deletions.
71 changes: 42 additions & 29 deletions dltmessageanalyzerplugin/src/CDLTMessageAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "components/patternsView/api/IPatternsModel.hpp"
#include "components/groupedView/api/CGroupedView.hpp"
#include "settings/CSettingsManager.hpp"
#include "dltWrappers/CDLTFileWrapper.hpp"
#include "components/logsWrapper/api/IFileWrapper.hpp"
#include "common/CRegexDirectoryMonitor.hpp"

#include "components/groupedView/api/IGroupedViewModel.hpp"
Expand All @@ -48,6 +48,8 @@
#include "components/plant_uml/api/CUMLView.hpp"
#include "common/CTableMemoryJumper.hpp"

#include "components/logsWrapper/api/IDLTLogsWrapperCreator.hpp"

#include "DMA_Plantuml.hpp"

//CDLTMessageAnalyzer
Expand All @@ -64,7 +66,8 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
QLineEdit* pFiltersSearchInput,
CUMLView* pUMLView, const std::shared_ptr<CTableMemoryJumper>& pSearchViewTableJumper,
CSearchResultView* pSearchResultView,
const std::shared_ptr<ISearchResultModel>& pSearchResultModel):
const std::shared_ptr<ISearchResultModel>& pSearchResultModel,
const std::weak_ptr<IDLTLogsWrapperCreator>& pDLTLogsWrapperCreator):
IDLTMessageAnalyzerControllerConsumer (pController),
// default widgets
mpProgressBarLabel(pProgressBarLabel),
Expand Down Expand Up @@ -105,6 +108,7 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
#endif
, mMeasurementRequestTimer()
, mpSearchViewTableJumper(pSearchViewTableJumper)
, mpDLTLogsWrapperCreator(pDLTLogsWrapperCreator)
{
//////////////METATYPES_REGISTRATION/////////////////////
qRegisterMetaType<tIntRangePtrWrapper>("tIntRangePtrWrapper");
Expand Down Expand Up @@ -494,11 +498,11 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
handleLoadedRegexConfig();

// set initial cache status
mpCacheStatusLabel->setText(CDLTFileWrapper::formCacheStatusString(0,
MBToB( CSettingsManager::getInstance()->getCacheMaxSizeMB() ),
0,
CSettingsManager::getInstance()->getCacheEnabled(),
false));
mpCacheStatusLabel->setText(formCacheStatusString(0,
MBToB( CSettingsManager::getInstance()->getCacheMaxSizeMB() ),
0,
CSettingsManager::getInstance()->getCacheEnabled(),
false));
}

void CDLTMessageAnalyzer::decodeMsg(QDltMsg& msg) const
Expand Down Expand Up @@ -644,7 +648,7 @@ void CDLTMessageAnalyzer::resetSearchRange()
mSearchRange = tIntRangeProperty();
}

void CDLTMessageAnalyzer::setFile(const tDLTFileWrapperPtr& pFile)
void CDLTMessageAnalyzer::setFile(const tFileWrapperPtr& pFile)
{
if(nullptr != mpFile)
{
Expand Down Expand Up @@ -679,13 +683,18 @@ void CDLTMessageAnalyzer::setFile(const tDLTFileWrapperPtr& pFile)
mpFile->setMaxCacheSize( MBToB( static_cast<unsigned int>(CSettingsManager::getInstance()->getCacheMaxSizeMB()) ) );
mpFile->setEnableCache( CSettingsManager::getInstance()->getCacheEnabled() );



#ifndef PLUGIN_API_COMPATIBILITY_MODE_1_0_0
if(nullptr != mpMessageDecoder)
if(nullptr != mpMessageDecoder && false == mpDLTLogsWrapperCreator.expired())
{
mpFile->setMessageDecoder(mpMessageDecoder);
}
mpFile->setMessageDecoder(mpDLTLogsWrapperCreator.lock()->createMsgDecoder(mpMessageDecoder));
}
#else
mpFile->setDecoderPlugins(mDecoderPluginsList);
if(false == mpDLTLogsWrapperCreator.expired())
{
mpFile->setMessageDecoder(mpDLTLogsWrapperCreator.lock()->createMsgDecoder(mDecoderPluginsList));
}
#endif
}

Expand All @@ -699,36 +708,36 @@ void CDLTMessageAnalyzer::setFile(const tDLTFileWrapperPtr& pFile)
}
else
{
mpCacheStatusLabel->setText(CDLTFileWrapper::formCacheStatusString(0,
MBToB( CSettingsManager::getInstance()->getCacheMaxSizeMB() ),
0,
CSettingsManager::getInstance()->getCacheEnabled(),
false));
mpCacheStatusLabel->setText(formCacheStatusString(0,
MBToB( CSettingsManager::getInstance()->getCacheMaxSizeMB() ),
0,
CSettingsManager::getInstance()->getCacheEnabled(),
false));
}
}
};

connect( mpFile.get(), &CDLTFileWrapper::isEnabledChanged, [updateCacheStatus](bool)
connect( mpFile.get(), &IFileWrapper::isEnabledChanged, [updateCacheStatus](bool)
{
updateCacheStatus();
});

connect( mpFile.get(), &CDLTFileWrapper::loadChanged, [updateCacheStatus](unsigned int)
connect( mpFile.get(), &IFileWrapper::loadChanged, [updateCacheStatus](unsigned int)
{
updateCacheStatus();
});

connect( mpFile.get(), &CDLTFileWrapper::currentSizeMbChanged, [updateCacheStatus](tCacheSizeMB)
connect( mpFile.get(), &IFileWrapper::currentSizeMbChanged, [updateCacheStatus](tCacheSizeMB)
{
updateCacheStatus();
});

connect( mpFile.get(), &CDLTFileWrapper::maxSizeMbChanged, [updateCacheStatus](tCacheSizeMB)
connect( mpFile.get(), &IFileWrapper::maxSizeMbChanged, [updateCacheStatus](tCacheSizeMB)
{
updateCacheStatus();
});

connect( mpFile.get(), &CDLTFileWrapper::fullChanged, [updateCacheStatus](bool)
connect( mpFile.get(), &IFileWrapper::fullChanged, [updateCacheStatus](bool)
{
updateCacheStatus();
});
Expand Down Expand Up @@ -772,14 +781,18 @@ bool CDLTMessageAnalyzer::analyze()
return false;
}


#ifndef PLUGIN_API_COMPATIBILITY_MODE_1_0_0
if(nullptr != mpMessageDecoder)
{
mpFile->setMessageDecoder(mpMessageDecoder);
}
if(nullptr != mpMessageDecoder && false == mpDLTLogsWrapperCreator.expired())
{
mpFile->setMessageDecoder(mpDLTLogsWrapperCreator.lock()->createMsgDecoder(mpMessageDecoder));
}
#else
tryLoadDecoderPlugins();
mpFile->setDecoderPlugins(mDecoderPluginsList);
if(false == mpDLTLogsWrapperCreator.expired())
{
tryLoadDecoderPlugins();
mpFile->setMessageDecoder(mpDLTLogsWrapperCreator.lock()->createMsgDecoder(mDecoderPluginsList));
}
#endif

mpFile->setMaxCacheSize( MBToB( static_cast<unsigned int>(CSettingsManager::getInstance()->getCacheMaxSizeMB() ) ) );
Expand Down Expand Up @@ -1729,7 +1742,7 @@ PUML_PACKAGE_BEGIN(DMA_Root)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CFiltersView, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(IFiltersModel, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CUMLView, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CDLTFileWrapper, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(IFileWrapper, 1, 1, uses)
PUML_USE_DEPENDENCY_CHECKED(CBGColorAnimation, 1, 1, uses)
#ifndef PLUGIN_API_COMPATIBILITY_MODE_1_0_0
PUML_AGGREGATION_DEPENDENCY_CHECKED(QDltMessageDecoder, 1, 1, uses)
Expand Down
8 changes: 5 additions & 3 deletions dltmessageanalyzerplugin/src/CDLTMessageAnalyzer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer
QLineEdit* pFiltersSearchInput,
CUMLView* pUMLView, const std::shared_ptr<CTableMemoryJumper>& pSearchViewTableJumper,
CSearchResultView* pSearchResultView,
const std::shared_ptr<ISearchResultModel>& pSearchResultModel);
const std::shared_ptr<ISearchResultModel>& pSearchResultModel,
const std::weak_ptr<IDLTLogsWrapperCreator>& pDLTLogsWrapperCreator);

/**
* @brief setFile - set's the file to be used for analysis
* @param pFile - pointer to file to be used
*/
void setFile(const tDLTFileWrapperPtr& pFile);
void setFile(const tFileWrapperPtr& pFile);

/**
* @brief setMainTableView - sets main table view, which is used for jumping functioanlity
Expand Down Expand Up @@ -287,7 +288,7 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer
tRequestId mRequestId;
int mNumberOfDots;
bool mbIsConnected;
tDLTFileWrapperPtr mpFile;
tFileWrapperPtr mpFile;

#ifndef PLUGIN_API_COMPATIBILITY_MODE_1_0_0
QDltMessageDecoder* mpMessageDecoder;
Expand All @@ -304,6 +305,7 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer

QElapsedTimer mMeasurementRequestTimer;
std::shared_ptr<CTableMemoryJumper> mpSearchViewTableJumper;
std::weak_ptr<IDLTLogsWrapperCreator> mpDLTLogsWrapperCreator;
};

#endif // CDLTMESSAGEANALYZER_HPP
3 changes: 1 addition & 2 deletions dltmessageanalyzerplugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ include_directories(../../thirdparty/DMA_Plantuml/src)
DMA_add_subdirectory_with_clang_tidy(common)
DMA_add_subdirectory_with_clang_tidy(components)
DMA_add_subdirectory_with_clang_tidy(settings)
DMA_add_subdirectory_with_clang_tidy(dltWrappers)

add_library(DLT-Message-Analyzer MODULE
dltmessageanalyzerplugin.cpp
Expand All @@ -120,7 +119,7 @@ target_link_libraries(DLT-Message-Analyzer
DMA_log
DMA_settings
DMA_logo
DMA_dltWrappers
DMA_logsWrapper
DMA_filtersView
DMA_filtersView_no_clang_tidy
DMA_groupedView
Expand Down
13 changes: 9 additions & 4 deletions dltmessageanalyzerplugin/src/common/Definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,16 @@ QString getName(eRequestState field);

typedef int tWorkerId;

class CDLTFileWrapper;
typedef std::shared_ptr<CDLTFileWrapper> tDLTFileWrapperPtr;
class IFileWrapper;
typedef std::shared_ptr<IFileWrapper> tFileWrapperPtr;

class CDLTMsgWrapper;
typedef std::shared_ptr<CDLTMsgWrapper> tDLTMsgWrapperPtr;
class IMsgWrapper;
typedef std::shared_ptr<IMsgWrapper> tMsgWrapperPtr;

class IMsgDecoder;
typedef std::shared_ptr<IMsgDecoder> tMsgDecoderPtr;

class IDLTLogsWrapperCreator;

typedef uint32_t tCacheSizeMB;
typedef uint64_t tCacheSizeB;
Expand Down
1 change: 1 addition & 0 deletions dltmessageanalyzerplugin/src/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DMA_add_subdirectory_with_clang_tidy(filtersView)
DMA_add_subdirectory_with_clang_tidy(groupedView)
DMA_add_subdirectory_with_clang_tidy(log)
DMA_add_subdirectory_with_clang_tidy(logo)
DMA_add_subdirectory_with_clang_tidy(logsWrapper)
DMA_add_subdirectory_with_clang_tidy(patternsView)
DMA_add_subdirectory_with_clang_tidy(plant_uml)
DMA_add_subdirectory_with_clang_tidy(searchView)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class IDLTMessageAnalyzerController: public QObject
* @return - request id, if search was successfully started. Or INVALID_REQUEST_ID otherwise
*/
virtual tRequestId requestAnalyze( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public slots:

protected:
IDLTMessageAnalyzerControllerConsumer( const std::weak_ptr<IDLTMessageAnalyzerController>& pController );
tRequestId requestAnalyze( const tDLTFileWrapperPtr& pFile,
tRequestId requestAnalyze( const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "QTimer"
#include "QDebug"

#include "dltWrappers/CDLTFileWrapper.hpp"
#include "components/logsWrapper/api/IFileWrapper.hpp"

#include "DMA_Plantuml.hpp"

Expand Down Expand Up @@ -161,7 +161,7 @@ void CContinuousAnalyzer::progressNotification(const tRequestId& requestId,
}

tRequestId CContinuousAnalyzer::requestAnalyze( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand Down Expand Up @@ -304,7 +304,7 @@ CContinuousAnalyzer::tRequestData::tRequestData(const tRequestId& requestId_,
const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient_,
const tRequestId& subRequestId_,
bool bIsContinuousAnalysis_,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const QRegularExpression& regex_,
const int& numberOfThreads_,
const tRegexScriptingMetadata& regexScriptingMetadata_): requestId(requestId_),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CContinuousAnalyzer : public IDLTMessageAnalyzerController
* @brief requestAnalyze - check IDLTMessageAnalyzerController for details
*/
tRequestId requestAnalyze( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand Down Expand Up @@ -91,7 +91,7 @@ class CContinuousAnalyzer : public IDLTMessageAnalyzerController
const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient_,
const tRequestId& subRequestId_,
bool bIsContinuousAnalysis_,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const QRegularExpression& regex_,
const int& numberOfThreads_,
const tRegexScriptingMetadata& regexScriptingMetadata_);
Expand All @@ -101,7 +101,7 @@ class CContinuousAnalyzer : public IDLTMessageAnalyzerController
bool bIsContinuousAnalysis;
int fromMessage;
int toMessage;
tDLTFileWrapperPtr mpFile;
tFileWrapperPtr mpFile;
QRegularExpression regex;
tRegexScriptingMetadata regexScriptingMetadata;
int numberOfThreads;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "qdlt.h"

#include "CMTAnalyzer.hpp"
#include "dltWrappers/CDLTFileWrapper.hpp"
#include "../api/IDLTMessageAnalyzerControllerConsumer.hpp"
#include "dltWrappers/CDLTMsgWrapper.hpp"
#include "components/logsWrapper/api/IFileWrapper.hpp"
#include "components/logsWrapper/api/IMsgWrapper.hpp"
#include "components/log/api/CLog.hpp"
#include "common/cpp_extensions.hpp"

Expand Down Expand Up @@ -73,7 +73,7 @@ CMTAnalyzer::~CMTAnalyzer()
}

tRequestId CMTAnalyzer::requestAnalyze( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand Down Expand Up @@ -154,7 +154,7 @@ bool CMTAnalyzer::regexAnalysisIteration(tRequestMap::iterator& inputIt, const t

const tRequestId requestId = inputIt.key();

const tDLTFileWrapperPtr& pFile = inputIt.value().pFile;
const tFileWrapperPtr& pFile = inputIt.value().pFile;

auto analysisIterationSpecificThread = [pFile](const tRequestId& requestId_,
tRequestMap::iterator& inputIt_,
Expand Down Expand Up @@ -437,7 +437,7 @@ CMTAnalyzer::tWorkerItem::tWorkerItem(const tQThreadPtr& pQThread_, const tDLTRe

//CMTAnalyzer::tRequestData
CMTAnalyzer::tRequestData::tRequestData( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient_,
const tDLTFileWrapperPtr& pFile_,
const tFileWrapperPtr& pFile_,
const int& fromMessage_,
const int& numberOfMessages_,
const QRegularExpression& regex_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CMTAnalyzer: public IDLTMessageAnalyzerController

//IDLTMessageAnalyzerController implementation
tRequestId requestAnalyze( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand All @@ -53,14 +53,14 @@ private slots:
struct tRequestData
{
tRequestData( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient_,
const tDLTFileWrapperPtr& pFile_,
const tFileWrapperPtr& pFile_,
const int& fromMessage_,
const int& numberOfMessages,
const QRegularExpression& regex_,
const tRegexScriptingMetadata& regexScriptingMetadata_,
const int& numberOfThreads_);
std::weak_ptr<IDLTMessageAnalyzerControllerConsumer> pClient;
tDLTFileWrapperPtr pFile; // file, which should be analyzed
tFileWrapperPtr pFile; // file, which should be analyzed
int requestedRegexMatches; // number of strings, which were requested to be analyzed from the regex analyzer thread
int processedRegexMatches; // number of strings, which were already analyzed by the regex analyzer thread
int numberOfMessagesToBeAnalyzed; // overall number of messages, which were requested to be analyzed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PUML_PACKAGE_BEGIN(DMA_Analyzer_API)
PUML_INHERITANCE_CHECKED(QObject, extends)
PUML_PURE_VIRTUAL_METHOD( +, void cancelRequest( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient, const tRequestId& requestId ) )
PUML_PURE_VIRTUAL_METHOD( +, tRequestId requestAnalyze( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient,
const tDLTFileWrapperPtr& pFile,
const tFileWrapperPtr& pFile,
const int& fromMessage,
const int& numberOfMessages,
const QRegularExpression& regex,
Expand All @@ -26,5 +26,6 @@ PUML_PACKAGE_BEGIN(DMA_Analyzer_API)
bool isContinuous) )
PUML_PURE_VIRTUAL_METHOD( +, void cancelRequest( const std::weak_ptr<IDLTMessageAnalyzerControllerConsumer>& pClient, const tRequestId& requestId ) )
PUML_PURE_VIRTUAL_METHOD( +, int getMaximumNumberOfThreads() const )
PUML_USE_DEPENDENCY_CHECKED(IFileWrapper, 1, 1, uses)
PUML_ABSTRACT_CLASS_END()
PUML_PACKAGE_END()
Loading

0 comments on commit db7fd5f

Please sign in to comment.