-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Peter Petrov Sent: Tuesday, August 30, 2005 1:13 PM To: boost-users@lists.boost.org 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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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. Regards, Dick Bridges