-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Add Basic_Templates
sample with CSV reader class
#2403
Merged
Merged
Conversation
This file contains 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
Doesn't need to be so big any more and allows more samples to build without customised hwconfig. Size is now similar to other architectures.
3 tasks
slaff
pushed a commit
that referenced
this pull request
Jun 18, 2024
This PR extends the capabilities `CsvReader` class, introduced in #2403. Goals: - Extend testing, verify efficient use of memory - Add Parser capability to allow filtering and processing of (very) large files streamed via network, in files, etc. - Add seeking support to allow indexing, bookmarking, etc. - Add iterator support The code has been moved into a separate library. Changes: **Fix String move to avoid de-allocating buffers** Use longer of two buffers for result. Example: ``` String s1 = "Greater than SSO buffer length"; String s2; s1 = ""; // Buffer remains allocated s2 = std::move(s1); // The move we need to fix ``` At present this move will result in s1's buffer being de-allocated. This can lead to performance degratation due to subsequent memory reallocations where a String is being passed around as a general buffer. This change uses the larger of the two buffers when deciding how to behave. Checks added to HostTests to enforce predictable behaviour. **Add CStringArray::release method** Allows efficient conversion to a regular `String` object for manipulation. **Fix CStringArray operator+=** Must take reference, not copy - inefficient and fails when used with FlashString. **Move CsvReader into separate library** The `CsvReader` class has been moved out of `Core/Data` and into `CsvReader` which has additional capabilities. Changes to existing code: - Add ``CsvReader`` to your project's :cpp:envvar:`COMPONENT_DEPENDS` - Change ``#include <Data/CsvReader>`` to ``#include <CSV/Reader.h>`` - Change ``CsvReader`` class to :cpp:class:`CSV::Reader`
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 PR aims to provide a clearer example of how to use templates.
It also updates the Formatter classes:
quote
method needs to first escape any embedded quotes. Uses "" rather than " as it's CSV-compatible.