Skip to content

701 Add dynamic targeting functionality for factory services to DS. (#977)#1161

Merged
jeffdiclemente merged 2 commits intoCppMicroServices:c++14-compliantfrom
insi-eb:701_dynamic_target
Jul 25, 2025
Merged

701 Add dynamic targeting functionality for factory services to DS. (#977)#1161
jeffdiclemente merged 2 commits intoCppMicroServices:c++14-compliantfrom
insi-eb:701_dynamic_target

Conversation

@RobertLauferElektrobit
Copy link
Copy Markdown

@RobertLauferElektrobit RobertLauferElektrobit commented Jul 25, 2025

cherry-pick of commit 5f144ee (PR #977)

additional commit to adapt for C++14 (for inline variables)

see discussion #701

pelliott-mathworks and others added 2 commits July 25, 2025 11:53
…icroServices#977)

* Add dynamic targeting functionality for factory services to DS.

Add dynamic targeting functionality for factory services to DS.
- move CreateFactoryComponent from ConfigurationNotifier to new class ComponentFactoryImpl
- Process targets from configuration objects in CreateFactoryComponent
- Add one test. (more to be added later).
Signed-off by: pelliott@mathworks.com

* Update TestSCRExtensionRegistry.cpp

Fix merge issue.
Signed-off-by: pelliott@mathworks.com

* Update ComponentFactoryImpl.cpp

Fixed local variable with  no name issue. Signed-off-by: pelliott@mathworks.com

* Changes requested by code reviews

Changes from code reviews to improve efficiency. Signed-off-by: pelliott@mathworks.com

* Added tests for the dynamic target functionality

Added more tests for the factory dynamic target functionality. Signed-off by: The MathWorks Inc. <pelliott@mathworks.com>

* Update ConfigurationNotifier.cpp

Fixed compiler error on mac os caused by initializing memory variables out of order. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Fix data race condition detected by Thread Sanitizer

Added mutex to be used by CreateFactoryConfiguration when calculating the random instance name for the factory pid. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Update TestFactoryTarget.cpp

Fix memory leak in usDeclarativeServicesTests. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* dynamic target for factory services

Made some fixes as a result of code review feedback. Also added tests to improve code coverage. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Fixed issues from code review of dynamic target functionality

Fixed issues in ComponentFactoryImpl.cpp and TestFactoryTarget.cpp. Code review feedback. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Added tests for dynamic targets

Dynamic targets only apply to configuration objects associated with constructing factory instances. Added code to detect and log dynamic targets in configuration objects that are not constructing factory instances. Added tests to confirm logging and to confirm that the appearance of a dynamic target in a configuration object that is not constructing a factory instance has no effect. Signed-off-by. The MathWorks, Inc. <pelliott@mathworks.com>

* SCRCodeGen change for factory components

Added test to make sure that the configuration-pid array for factory components only contains one pid. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Changes do to code review feedback for dynamic target implementation

Changes from code review feedback. The most significant ones were:
ConfigurationAdminImpl::RandomInstanceName - replaced mutex by using thread_local storage for the variable.
When a dynamic target appears in a configuration object the key will be referenceName.target instead of interfaceName.
Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Responses to code review feedback

Fixed issues raised by code reviews. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Responses to code review feedback

Update dynamic target functionality based on code review feedback. Signed-off-by: The Mathworks, Inc. <pelliott@mathworks.com>

* Update ComponentFactoryImpl.cpp

Fixed problem introduced in last commit. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Update ConfigurationAdminImpl.hpp

Whitespace change. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* TestBundleDSFAC1 fix

Fix unused input parameter error. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Update TestFixture.hpp

Removing these reset function calls introduced some memcheck issues. Restoring the calls. Signed-off-by: The MathWorks, Inc. <pelliott@mathworks.com>

* Update ConfigurationNotifier.hpp

FIx merge issue

* Update ConfigurationNotifier.hpp

Fix merge issue

* Update compendium/DeclarativeServices/src/manager/ComponentFactoryImpl.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update compendium/DeclarativeServices/src/manager/ComponentFactoryImpl.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update compendium/DeclarativeServices/src/manager/ComponentFactoryImpl.hpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update compendium/DeclarativeServices/src/manager/ComponentFactoryImpl.hpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update compendium/test_bundles/TestBundleDSFAC1/src/ServiceImpl.hpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update compendium/DeclarativeServices/src/manager/ComponentFactoryImpl.hpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Get rid of some clang tidy warnings

Signed-off-by The MathWorks, Inc. <pelliott#mathworks.com>

* Update ServiceImpl.hpp

Updating link tidy warnings. <pelliott@mathworks.com>

* Fixed errors introduced by clang tidy fixes.

Fixed errors introduced by clang tidy fixes.Signed-off-by <pelliott@mathworks.com>

* Update ComponentFactoryImpl.cpp

Fix issues introduced by clang tidy edits. signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

* Update ComponentFactoryImpl.cpp

Fiz ComponentFactoryImpl Constructor issue introduced by clang tidy "fixes". Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.08%. Comparing base (1315d98) to head (901542d).

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##           c++14-compliant    #1161      +/-   ##
===================================================
- Coverage            88.10%   86.08%   -2.02%     
===================================================
  Files                  231      131     -100     
  Lines                11547     7502    -4045     
===================================================
- Hits                 10173     6458    -3715     
+ Misses                1374     1044     -330     

see 102 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffdiclemente jeffdiclemente merged commit 1b87699 into CppMicroServices:c++14-compliant Jul 25, 2025
18 of 46 checks passed
@RobertLauferElektrobit RobertLauferElektrobit deleted the 701_dynamic_target branch July 25, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants