Boost logo

Boost :

Subject: Re: [boost] first steps to submitting - boost :: observers
From: Robert McInnis (r_mcinnis_at_[hidden])
Date: 2016-09-18 22:22:29


On Sunday, September 18, 2016 9:54 PM Gavin Lambert said:

> I'm not sure I'm parsing that explanation correctly, but Signals2 is a
generic
> thread-safe event-raising mechanism; it can thus be used to raise events
from a
> single instance or static class-based, as desired.
>
> Typically the observee/publisher provides the event/signal, but other
models can
> be possible with some finagling, if such is desired -- and it's fairly
straightforward
> to build hybrid patterns with it such as subscribing to a container to
indirectly
> subscribe to the container's contents (assuming that the container tracks
insert/remove actions).

One of the examples I provided was a stock feed/portfolio management
example.

The 'market' consisted of just 16 stock symbols and their associated market
price when I was
making the example.

1000 portfolios were generated with 5-16 buy orders initially pushed (assume
10 positions on average).
Any buy orders would also be tracked and would also force an update of the
associated portfolio.

I then generated 2000 random StockTicks and pushed them thru the market
individually, simulating a
ticker plant. This would trigger the necessary updates only to those
portfolios containing the stock, as
well as updating the overall portfolio value.

This example took about 20 minutes to code, with a few more minutes to tweak
the output to make it
more appealing.

How would you do that with the Signals2 object?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk