Boost logo

Boost :

Subject: [boost] Boost MSM attribute sharing problem
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2017-06-28 16:15:50


>Hello everyone,
>
>I have an issue with* Boost MSM*.
>Using *Boost MSM eUML* I have created a
>state machine. Actually I created *HSM* (Hierarchical State Machine) or
>Composite State Machine as second name.
>And I faced with issue: How to
>share attributes between Parent State Machine and Sub-State Machines
>(or Child State Machine) ??
>
>I have not found an answer on this question ...
>Could anyone possibly help me ?
>
>*Thanks,*
>
>*Best RegardsDenis Kotov*

Hi Denis,

I think the best way is to have your attributes owned by the top-level
state machine, then passed to the composite as say, a pointer. The
top-level can call get_state, then set the attribute. For example, with
eUML, supposing you declared the attribute with
BOOST_MSM_EUML_DECLARE_ATTRIBUTE (or without for other front-ends):

get_state<Composite&>().get_attribute(some_attribute) = &top_attribute;

HTH,
Christophe


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