Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-23 14:42:20


Boris wrote:
> I had a quick look at the documentation of the Boost FSM library as I
> need to implement a simple protocol handler for a network application.
> The protocol handler sends and receives text messages and switches
> between various states. What I wonder is how I can pass for example a
> reference to a socket to a state so that the state can send a text
> message? There doesn't seem to be a way to acccess a state instance in a
> state machine?

You can pass any data to the state machine in events. You can also
access any state or its base class with a "get" method of the FSM.
However, in your case I would consider keeping the socket inside the FSM
in order to encapsulate all reaction specifics in the machine.


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