$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost]  [msm] Message queue and copy constructed events
From: Michael.Herchel_at_[hidden]
Date: 2010-06-14 12:02:27
Hi Christopher,
in case we use message queueing in our state machines (which we actually 
have to because otherwise the pseudo exit state behaviour will not work 
correctly) our events have to implement a copy constructor because there 
is a possibility that some of them are queued. We do not want that events 
get copied because they are very big and it certainly decreases our 
performance.
Could you not just store pointers to events so that the events do not get 
copy constructed again?
Our understanding of the queuing implementation is that the event instance 
is valid as long as the outer most process_event() is not returned to the 
caller. In that case it is not a problem to just store those pointers.
We also could use shared pointers as events and so only the shared 
pointers get copy constructed. But this would mean that we have to put all 
our events into shared pointers which also decreases performance and it 
would look like strange passing shared pointer as reference to the 
process_event() method.
Do you have another idea in order to overcome this?
At the moment, we can not think of a proper solution for deferred events. 
In that case there would be no other solution than copy deferred events.
Anyway, we would like to have a mechanism in order to influence the queue 
implentation and change it to a user definied implementation.
Would it be possible to pass the queue type as an optional template 
argument to the state machine?
This would the make state machine even more flexible and one does not have 
to use std::queue.
Regards,
Michael