Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch DataModel::Provider to a span-based list iterator - flash and …
…ram savings, simpler interface (#37033) * Copied over the new AttributePathExpandIterator and will incrementally use it (so I can validate tests) * Rename AttributePathExpandIterator to legacy * Prepare for using new style iterators ... checking NOT YET enabled though * Enabled checks ... and unit tests fail, but this now can be debugged * Fix some of the underlying bugs: read handling logic assumes we are ok to undo * Unit tests pass now * Restyle * Use new iterator in IME * Update logic to use the new iterator on testRead * more updates * Restyle * Remove the legacy attribute path expand iterator * Update naming * Restyle * Remove extra argument for ReadHandler constructor * Restyle * Slight flash improvement * Fix up includes * Removed empty line * added comment on why state is a friend class * Comment updates * Restyle, add some comments and add extra checks on validity check only for expansion. This saves a tiny amount of flash (32 bytes) * Remove an include * Comment updates, renamed mLastOutputPath to mOutputPath * Fix one typo * Re-arrange members of ReadHandler to optimize for memory layout. This saves 8 bytes for struct. We still have a 20-byte padding which I am unsure how to get rid of * Restyle * Rename State to Position * One more rename * Remove redundant assigment ...we are at a net 0 txt increase now on qpg * Add more unit tests for non-obvious requirement that wildcard expansion checks path validity, however non-wildcard does not check it * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Update src/app/ReadHandler.h Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Update src/app/ReadHandler.cpp Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Use different values for the cluster ids for testing * One more state to position change * mExpanded is now set during output path returning. Removed 2 more sets to save another tinier amount of .text * Import metadatalist class and test * Remove some tests that seem redundant, keep only one * Start with generated commands, see if we can replace its usage... * Unit tests for GeneratedCommands pass * Start with an implementation of accepted commands (no testing yet) * More tests pass * Updated AcceptedCommands as well .. unit tests pass * Restyle * Fix namespaces * Slight refactor. Code is still very much ugly * A bit of refactor, code looks better and tests pass now * Code compile for semantic tag ... made std::optional support non-trivial destructors * Update test * Make chip::Optional be trivially destructible if the underlying type is. Previous implementation always had a destructor, so it was never trivially destructible. * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/InteractionModelEngine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/ReadHandler.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/ReadHandler.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Use mCompletePosition * Another rename * Undo submodule update * Restyle * Remove extra char * Remove unused variable * Update comment text to not sound like graph parsing * Rename method to be more descriptive * Remove one more unused variable * Update peek attribute iterator to rollback and update code logic a bit. Hoping for cleaner code * Semantic tags conversion is done * Restyle * Migrate device types to the new format * update comment a bit * Add unused marker for chip errors used for logging only * Fix descriptor cluster * Fix microwave oven * Restyle * Fix intentional bugprone-use-after-move * Fix intentional bugprone-use-after-move * Restyle * Fix based on clang feedback * Move endpoints to the new style of iteration * Fix includes * Fix includes * Fix includes * make it standard that test Providers are for now CodegenDataModelProvider. Saves me some typing as I move things around * Restyle * Minor update in logic: do the endpoint selection when next is called * Allow startup to try to mark attributes dirty even if no provider exists yet * Fix typo * start implementing client clusters * Update ClientCluster logic * Restyle * Start defining the server cluster query * Actually use the new server cluster functionality * Fix an include * More include fixes * implement the get attributes and adapt unit tests * Restyle * more updates to cleanup code. I am a bit concerned about O(n^2) attribute access... * A rename and moved finder methods out of inline. Saves 650 bytes of flash * Update logic to centralize metadata list code with less templating * move the generic metadata list to detail, add an assert on trivial destruction * Fix namespace prefix * Save 70 bytes by using references in condensed for loops * Replace count-if because it seems to result in smaller code (46 bytes) * Another find_if replacement * Replaced some find_if...we are down to 92 bytes on qpg * Replaced one more find-if, saving another 88 bytes of flash * Removed algorithm includes: these are slow and would like compile to fail if used * Save more flash ... we should be at a net negative now * This seems to save even more * More savings by more encode overrides ... this is silly... * Fix typos * More explicit casting, removed 64-bit overrides * Added one more check for freeing memory .Still need to track a leak that darwin finds * Fix memory leak in assignment * Self-review: fix includes * Self-review: fix includes * Self-review: fix includes * Self-review: fix includes * Update src/data-model-providers/codegen/CodegenDataModelProvider.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/data-model-providers/codegen/CodegenDataModelProvider.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/AttributePathExpandIterator.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/clusters/descriptor/descriptor.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/clusters/descriptor/descriptor.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataList.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Fix spelling for acquire * Update src/app/data-model-provider/MetadataList.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataList.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataList.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Fix is_trivially_destructible * Update src/app/data-model-provider/MetadataSearch.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * More fixes * Fix includes * Fix invalid check typo * Fix comment * Correct comment * Updated comment * Make logic between clusters/attributes/endpoints the same regarding nullopt and wildcards * Restyle * Update logic for IsDescentantof * Help compiler generate efficient code as we keep reusing the same pointer * clearer logic that we handle all cases * Fixes * Use calloc * Update comment * Fix include * Fix casting * Make cluster count functions from ember public API since they seem reusable * Also fix dynamic dispatch * update enumeration entry * another comment update * Undo submodule update * Rename metadata search to metadta lookup * Update metadata list methods to be all uppercase * Fix more renames * Fix invalid cast * Update src/data-model-providers/codegen/CodegenDataModelProvider.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/data-model-providers/codegen/CodegenDataModelProvider.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/data-model-providers/codegen/CodegenDataModelProvider.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataList.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address comments * fix bug * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Update src/app/WriteHandler.cpp Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Update src/app/AttributePathExpandIterator.cpp Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Restyle and include update --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com>
- Loading branch information