Johnfreeman/daqdataformats issue79 code refactoring#81
Conversation
…nto detail/*.hxx file; also add static_asserts enforcing simple layouts given how these structs are used
By "unused", I'm not counting usage in unit tests or Python bindings This includes: Fragment::BufferAdoptionMode::kReadOnlyMode TriggerRecord::set_header TriggerRecord::set_fragments TriggerRecord::get_sum_of_fragment_payload_sizes TriggerRecordHeader::operator[] (*) (*) This actually *is* used, but it's exactly replicated by TriggerRecordHeader::at, so a couple of lines in other package will need to switch over to TriggerRecordHeader::at. Note that I'm preferring "at" over "operator[]" because in std:: containers' at functions perform bounds checking and their operator[] functions don't
… they're not used in our codebase; also fix an incorrectly placed detail/ComponentRequest.hxx include
…e - move inline keywords from point-of-declaration to point-of-definition and some function definitions into *.hxx files
-free up memory in the Fragment constructor before it throws an exception -Remove an overflow check which only checks a tiny sliver of overflow phase space -Change TypeDefaults from a class with everything public to a struct -Take advantage of the memory continuity of an std::vector of ComponentRequests -Refactor Fragment::set_header_fields to be robust against the addition of new header fields
… coding standards (declaration order, etc.). Starting to think unit tests should be explicitly given looser standards.
…ry in a unit test
…repr__ for concrete structs
-Add a couple of brief descriptions at the tops of files -Simplify Doxygen syntax in places -Remove comments which simply restate what's clear from the code
…and the the at functions in std:: by having it return-by-const-reference rather than by copy
…ings since the addition of Python bindings to the == and != operators mean that Python now expects to be able to put SourceID in a set
…the unsigned int in the hashing function
|
Further details can be found in the commit comments (and of course, the code changes themselves, but here's a summary of what I did:
|
|
Looking at the usage in TRBModule, shouldn't it really be |
eflumerf
left a comment
There was a problem hiding this comment.
Build, unit tests, and integration tests all look normal. Can be merged as-is, or after another round of review if further method renames are performed.
Description
This PR is meant to address parts of Issue #79 (a general code review of
daqdataformats) with a strong focus merely on refactoring (so, not changing the interfaces in ways that will require changes in other packages).The only exception to this that I dropped
ComponentRequest::operator[]since it had been range checking the index passed to it but in the standard library theatfunction in containers is range checked andoperator[]isn't. This means I needed to make very minor changes todfmodulesanddfmessagesreplacingoperator[]withat:DUNE-DAQ/dfmodules#488
DUNE-DAQ/dfmessages#79
Those PRs should be merged along with this PR.
Testing the changes should begin with a test build which uses this feature branch and the feature branches of the same name in
dfmodulesanddfmessages. Basically it's regression - we want to make sure everything behaves the same. So, standard integration tests and extended integration tests should give us the same results as usual.Please note that once this PR is approved we should run the code through
clang-formatbefore merging.Type of change
n.b. while there are changes to in-code comments, the contents of
docs/will be addressed in a separate PRTesting checklist
dbt-build --unittest)pytest -s minimal_system_quick_test.py)dunedaq_integtest_bundle.sh)python -m pytest)pre-commit run --all-files)Comments here on the testing
Further checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))