Boost logo

Boost Users :

From: BRIDGES Dick (Dick.Bridges_at_[hidden])
Date: 2005-08-31 15:34:44

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Peter Petrov
> Sent: Tuesday, August 30, 2005 1:13 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [statechart] Can events carry data?
> BRIDGES Dick wrote:
> > Is there any provision for "event-local" storage? I'd like
> to create
> > events that carry data (e.g., timestamp, source, etc.) to be used by
> > reactions and transitions to update state-local storage.
> >
> > I didn't see anything like this in the documentation. Bad
> idea? Major
> > drawbacks? If it wouldn't be a problem, how might I go
> about doing it?
> struct MyEvent : public boost::statechart::event<MyEvent>
> {
> int myData;
> double myOtherData;
> MyClass myOtherOtherData;
> };
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Thank you for the example.

I'm still not clear on the requirements surrounding such an
instance. For example, the reference requires that
<code>new E(*pCE)</code> be well-formed and make "a copy of
pE". Does the current implementation work ok with
boost::shared_ptr? How about auto_ptr? If a data member
would normally require a deep copy, would I be better off
managing it external to the event object - or avoiding that
type of data altogether? How many copies are we talking
about here?

Any cautions and/or advise regarding the use of data members
in events would be appreciated.

Thanks again for the response.

Dick Bridges

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at