Boost logo

Boost Users :

Subject: Re: [Boost-users] sliding window containing n seconds of data
From: Michael (mwpowellhtx_at_[hidden])
Date: 2015-04-22 01:56:17


On April 22, 2015 1:10:12 AM EDT, Ben Pope <benpope81_at_[hidden]> wrote:
>On Wednesday, April 22, 2015 12:22 PM, Lane wrote:
>> I like the idea of using a circular_buffer, but still not sure how to
>> time the data on this buffer. I'd like for objects on this buffer to
>be
>> removed after n seconds, and not based on fixed capacity where they
>get
>> over-written. Or did I misunderstand? I think somehow attaching a
>timer
>> to each and every object on this buffer is the part I'm having
>trouble
>> with efficiently.
>
>I don't think you need to remove them after n seconds, you just need to
>
>not read entries older than n seconds, so perhaps store the data with a
>
>timestamp, and then clean up or ignore old entries during the read.

Seems like a fairly straightforward thing to do with vectors and iterators? That's standard C++, nothing boost-y about that. Use the algorithms if necessary. Or boost.range if necessary.

Possibly lockfree to help with new versus expired items, etc.

>Ben
>
>
>_______________________________________________
>Boost-users mailing list
>Boost-users_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net