aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_lfringbuffer11.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Tests: Don't include iostream if not explicitly usedSven Gothel2022-08-051-1/+0
|
* Catch2: Adopt tests to v3.0.1Sven Gothel2022-06-191-2/+0
|
* Adopt fraction and fraction_timespec, use wait_until() w/ out-of-loop ↵Sven Gothel2022-05-011-3/+4
| | | | | | | | | | absolute timeout_time, avoiding deadlocks Classes affected incl. API change using fraction for relative time - latch - ringbuffer - service_runner - simple_timer
* ringbuffer: Add notion of operating threading mode for more efficancyv0.7.0Sven Gothel2021-11-021-0/+16
| | | | | | Add notion of operating threading mode for more efficancy: - One producer-thread and one consumer-thread (default) - Multiple producer-threads and multiple consumer-threads
* test_lfringbuffer11: Fix GCC 8.4 optimization warning (uninitialized var)Sven Gothel2021-11-011-1/+1
|
* ringbuffer API change: Drop whole `NullValue` *angle*, simplifying; Drop ↵Sven Gothel2021-10-311-5/+5
| | | | | | | | | | | | | | | | | | | | `use_memset` non-type template param use `use_memcpy` - ringbuffer API change: Drop whole `NullValue` *angle*, simplifying - Drop `Value_type [get|peek]*()`, use `bool [get|peek]*(Value_type&)` instead - Use `bool` return to determine success and `Value_type` reference as storage. - Drop `NullValue_type` template type param and `NullValue_type` ctor argument. - Simplifies and unifies single and multi get and put, as well as testing (motivation). - ringbuffer: Drop `use_memset` non-type template param, simply use `use_memcpy` having same semantics of *TriviallyCopyable* - favor ::memcpy over ::memmove if applicable don't confuse with our `use_memmove` semantics :) - Use proper 'void*' cast to lose const'ness, drop non-required 'void*' cast for source (memmove) - Use global namespace ::memmove and ::explicit_bzero
* ringbuffer: Use std names for sizes: getSize() -> size(); getFreeSlots() -> ↵Sven Gothel2021-10-051-12/+12
| | | | freeSlots()
* ringbuffer::get() and ::getBlocking(): Pass size of dest buffer and minimum ↵v0.4.0Sven Gothel2021-06-191-1/+1
| | | | | | | | count to wait for, return actual received elements Receiving `min(dest_len, getSize()>=min_count)` elements is most efficient for receiver code. This is aligned with new/changed 'waitForElements(..)' and 'waitForFreeSlots(..)' methods.
* ringbuffer: Add typename 'NullValue_type', denoting the type for 'nullelem', ↵v0.3.3Sven Gothel2021-06-111-4/+4
| | | | | | | | | | | | | | | | decoupling for complex .. Changed typename 'T' to 'Value_type' for readability. Using a dedicated typename 'NullValue_type', denoting the type for 'nullelem'. Distinguishing the 'nullelem' NullValue_type from Value_type is required for special Value_type assignment like 'std::unique_ptr<T>'. In the latter case, we can't assign or copy 'std::unique_ptr<T>' as 'nullelem', but have to use 'nullptr'. Hence using std::nullptr_t for NullValue_type. This finally resolved the 'nullelem' custom setup as started in commit 50534c737b6fa540f958b2ad638890e257479722.
* ringbuffer: Move the 'T nullelem' to ctor, simplifying ringbuffer declarationSven Gothel2021-06-101-3/+3
| | | | | | | | | | | Having the `nullelem` passed as reference as a template parameter gives user the burden to have a static instance setup before declaration. This is not nice. For now, we better pass `nullelem` via the constructor. We would like to pass `T nullelem` as a non-type template parameter of type `T`, a potential Class. However, this is only allowed in C++20 and we use C++17 for now.
* jau::ringbuffer<> enhancement: Support block access, integral types, ↵Sven Gothel2021-06-101-89/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | non-value-range-collision get*(..) variant Support block access ======================= - Add support for bulk get*(..) and put*(..) operations. - In case 'T' is Trivially_Copyable, memcpy is used for performance to copy values. - In case 'T' is an integral, memset is used for performance to remove data. Support integral types ======================= - Passing 'nullelem' as 'const T& nullelem' instead of 'std::nullptr' Support non-value-range-collision get*(..) variant ================================================== Provide get*(..) variant returning 'bool' to signal clear success in cases where the 'T' value range doesn't provide a 'failure' value, i.e. 'nullelem'. Implementation details ======================== - Remove 'size', as we are required to determine race-free size by R and W position for block access - Use 'syncWrite' for write-operations (put*), i.e. modifying the writePos. - Use 'syncRead' for read-operations (get*), i.e. modifying the readPos. - Reorderd method in order -- peek, get and put Test Coverage ================ - test_lfringbuffer01: Trivial + Integral (byte array) - test_lfringbuffer02: Trivial + !Integral (Integer array) - test_lfringbuffer03: !Trivial + !Integral (shared_ptr<Integer> array) - test_lfringbuffer[11-13] covers same order for concurrency tests All tests cover sequential and bulk/range get and put operations
* unit tests: Add MIT license headerSven Gothel2020-12-251-0/+23
|
* Replace cppunit.h with Catch2 (v3-devel): Supporting CI integration, more ↵Sven Gothel2020-12-211-52/+49
| | | | versatile functionality (benchmarking, ..)
* ringbuffer: Parameterize Size_type, allowing using e.g. jau::nsize_t for ↵Sven Gothel2020-10-201-19/+19
| | | | | | element count and size semantics. This refines commit 0814f8212ac1ec19fef79d8ed55a162d3d8583f3, supporting less invasize size types like nsize_t.
* ringbuffer: Normalize using size_t instead of int for element count and size ↵Sven Gothel2020-10-201-34/+31
| | | | semantics.
* Move jaucpp files to root-folderSven Gothel2020-10-161-0/+187