Open Humancell opened 5 years ago
This version currently does not have that behavior, but I would definitely see the use case for this. Maybe this will fit your needs? https://github.com/wizard97/Embedded_RingBuf_CPP/issues/12
Yes ... your new feature would do what I am looking for:
bool addForce(const Type &obj)
Is this now a part of your next release?
I don't currently have plans to add it, but you are welcome to add it in and submit a pull request.
Ok ... but I'm confused about what I am looking at (not as well versed at Github as I'd like to be) ... who wrote this code that you linked to, and can't you pull that into your project?
I made both of these projects, they both do the same thing. This one uses only C, the other one takes advantage of C++ features.
I think it will just be easier for you if you use my other project (https://github.com/wizard97/Embedded_RingBuf_CPP). The add method has the following signature
bool add(const Type &obj, bool overwrite=false)
If you call this method with overwrite
set to true, then this will overwrite the oldest element when the buffer is full.
I'm curious if there is a way to add an option to add(), or a new call (push()?) that would always add to the queue by "pushing" the oldest item out of the queue?
In the current implementation it appears that if we are adding and the buffer fills, we are forced to lose the "new" items. This works in two of our cases, but we have one where we want the "oldest" data to be lost so that the queue contains the latest {x} records.
Does this make sense? Thoughts?