Move more packet formatting code to dataio#2848
Open
lmoureaux wants to merge 22 commits intolongturn:masterfrom
Open
Move more packet formatting code to dataio#2848lmoureaux wants to merge 22 commits intolongturn:masterfrom
lmoureaux wants to merge 22 commits intolongturn:masterfrom
Conversation
I was a bit ambitious and ported everything at once. It builds but connection fails. This will get fixed in later commits.
The switch happens before SEND_PACKET_END is run. We thus need to cache it from SEND_PACKET_BEGIN.
This will facilitate serialization.
This allows all information to flow through function arguments, unifying the interface between types.
This removes a special case from generate_packets.py
This removes a special case from generate_packets.py
This moves complexity from the generated code to normal source files. The get_ and put_ interfaces are also getting even closer.
Use QByteArray features to manipulate attribute contents, avoiding error-prone low-level dio calls.
With this change, all dio_get calls in packets_gen.cpp share the same syntax: dio_get(din, field, args...). Only the arguments differ. This simplifies the generated code.
This allows unifying all dio_put calls with the same syntax.
After moving a lot of code to dataio, generate_packets can become simpler.
Collaborator
|
Looks like Codacy found some issues. I'd prefer to merge the referenced PR and then rebase this before I review this PR. |
Contributor
Author
|
Agreed on the rebase. I fixed the unreachable code from codacy, the other checks trigger whenever one uses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This builds on #2845 to move basic packet serialization logic out of
generate_packets.py. Enums and arrays no longer need explicitly generated code; they rely on template functions indataioinstead. For instance, reading a packet now looks like this regardless of the data types involved:The generated code used to contain a lot of logic such as loops. This is now entirely gone (as far as the
dio_*part is concerned).