Boost logo

Boost Users :

Subject: Re: [Boost-users] Accumulators: Using data vector from Interprocess
From: dhruva (dhruvakm_at_[hidden])
Date: 2008-12-23 22:00:11


Hello,
 The help and support on this list is unmatched by any of the paid
support you get from most companies. Thank you all for such detailed
responses.
For someone like be getting into boost, this really helps.

On Wed, Dec 24, 2008 at 12:49 AM, Eric Niebler <eric_at_[hidden]> wrote:
> Eric Niebler wrote:
>>
>> A moving average accumulator is an often requested feature. I knocked one
>> together as a proof-of-concept during the accumulators review, but never
>> polished it. You can find it in this message:
>>
>> http://lists.boost.org/Archives/boost/2007/07/124979.php
>
> Whoops, that's a rolling average algorithm for the time series library. The
> implementation for the accumulators library is considerably simpler. I just
> knocked this together, but it seems to work.
>
>
> ///////////////////////////////////////////////////////////////////////////////
> // Copyright 2008 Eric Niebler. Distributed under the Boost
> // Software License, Version 1.0. (See accompanying file
> // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
>
> #include <boost/circular_buffer.hpp>
>
> BOOST_PARAMETER_NESTED_KEYWORD(tag, rolling_average_window_size,
> window_size)

In this example, the window size is know and fixed (I agree it was
based on my requirement that I had posted in the original post).
However, my window is a time window. Something like weekly sliding
window average. Since the data collection frequency could vary in my
case, I will not be able to use a circular list. I used a deque where
I add at the end and pop off from the top till the difference between
the last time stamp (most recently added) to first time stamp is NOT
greater than the window size.
 It is here that I intend to create the deque using interprocess. I
will have deque will have a pair of time stamp and value
(pair<timestamp, data>). Would accumulator handle a complex type in a
list or should it be a list of data only on which computations will be
made. Is there some concept like accessor which I can implement to
define getting the data from the list to send it. I could get the
'second' from my deque entry and return that function.

 Before someone says, RTFM, I am reading the accumulators docs but
generally find boost a little difficult to get started with. Waiting
for a good book in English teaching boost with some real life examples
or a cookbook styled book, I learn best through cookbook styled books!

thanks,
-dhruva

-- 
Contents reflect my personal views only!

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