Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: show planned path in enum class changes for maintainer review #44

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dksmiffs
Copy link
Contributor

Work started on #22, this draft intended for early maintainer feedback on approach.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 5.12821% with 37 lines in your changes missing coverage. Please review.

Project coverage is 32.10%. Comparing base (a025929) to head (197acba).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/PDU/Information_Operations/IO_Action_PDU.cpp 0.00% 12 Missing ⚠️
src/DataTypes/IOEffect.cpp 8.33% 11 Missing ⚠️
src/DataTypes/StandardVariable.cpp 0.00% 5 Missing ⚠️
src/PDU/Information_Operations/IO_Report_PDU.cpp 0.00% 4 Missing ⚠️
src/DataTypes/IOCommunicationsNode.cpp 25.00% 3 Missing ⚠️
include/KDIS/DataTypes/FactoryDecoder.hpp 0.00% 1 Missing ⚠️
src/DataTypes/DEAreaAimpoint.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
- Coverage   32.11%   32.10%   -0.02%     
==========================================
  Files         290      290              
  Lines       27470    27483      +13     
  Branches     1125     1125              
==========================================
  Hits         8823     8823              
- Misses      18647    18660      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@carlocorradini
Copy link
Collaborator

carlocorradini commented Jan 16, 2025

@dksmiffs I would also add the type to the enum class if mapping to a known DIS type (and therefore knowing the maximum number of elements):

enum class Example : std::uint8_t {
  // ...
}

@carlocorradini carlocorradini marked this pull request as ready for review January 16, 2025 22:43
@carlocorradini carlocorradini marked this pull request as draft January 16, 2025 22:45
@dksmiffs
Copy link
Contributor Author

dksmiffs commented Jan 16, 2025

@carlocorradini - in 6fb761f, please note line 99 in src/DataTypes/StandardVariable.cpp. I'd like your feedback on what I should do there. StandardVariableType is a KUINT32 enum, but FactoryDecode takes a KINT32. I obviously don't like that code the way I have it written.

Update: see 197acba below for my proposed fix to this issue.

This change is needed to allow
StandardVariable::FactoryDecodeStandardVariable() to pass a KUINT32
as the first parameter to FactoryDecode, since the underlying type of
the StandardVariableType enum class is KUINT32.
Copy link
Owner

@karljj1 karljj1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Thanks!

@carlocorradini
Copy link
Collaborator

@carlocorradini - in 6fb761f, please note line 99 in src/DataTypes/StandardVariable.cpp. I'd like your feedback on what I should do there. StandardVariableType is a KUINT32 enum, but FactoryDecode takes a KINT32. I obviously don't like that code the way I have it written.

Update: see 197acba below for my proposed fix to this issue.

Because the generic represents the underlying type of an enum, why not set KUINT32 as the default value? What do you think?
Furthermore, what do you think if we take directly the enum type (rather than the primitive underlying type) as generic and use a combination of std::is_enum (static assertion that the generic is an enum) and std::underlying_type?

@dksmiffs
Copy link
Contributor Author

Sounds good, @carlocorradini.

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