|
Boost Users : |
From: john.wismar_at_[hidden]
Date: 2005-09-06 17:21:59
I'm playing with the statechart library, in conjunction with Boost 1.33
and VC 7.1. I'm having trouble using the state history functionality; I
can't get it to compile, even taking into account the useful static
assertions that ought to be helping me. Can someone suggest what I might
be missing?
Here's a boiled down sample: there are 2 top-level states, StateA and
StateB. Event2 transitions between them. When in StateA, Event1
transitions between 2 sub-states, StateA1 and StateA2. When transitioning
from StateB to StateA, I want to use StateA's history to determine which
of StateA1 and Stae2 become active. From reading the tutorial,
references, and sample code, it looks like this should work:
////////////////////////////////////////////////////////////////////
#include <boost/statechart/event.hpp>
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
#include <boost/statechart/transition.hpp>
#include <boost/statechart/shallow_history.hpp>
namespace sc = boost::statechart;
//Events
struct Event1 : sc::event<Event1> {};
struct Event2 : sc::event<Event2> {};
//States
struct StateA;
struct StateA1;
struct StateA2;
struct StateB;
struct SCTest : sc::state_machine<SCTest, StateA> {};
struct StateA : sc::simple_state<StateA, SCTest, StateA1,
sc::has_shallow_history>
{
typedef sc::transition<Event2, StateB > reactions;
};
struct StateB : sc::simple_state<StateB, SCTest>
{
typedef sc::transition<Event2, sc::shallow_history<StateA> >
reactions;
};
struct StateA1 : sc::simple_state<StateA1, StateA>
{
typedef sc::transition<Event1, StateA2> reactions;
};
struct StateA2 : sc::simple_state<StateA2, StateA>
{
typedef sc::transition<Event1, StateA1> reactions;
};
int main(int argc, char* argv[])
{
SCTest test;
return 0;
}
This gives me the following error:
c:\boost\boost\statechart\shallow_history.hpp(34) : error C2027: use of
undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
with
[
x=false
]
<snip>
[
DefaultState=StateA
]
etc., and comments at that point in the statechart source direct me to:
"...pass either statechart::has_deep_history or
statechart::has_full_history as the last parameter of DefaultState's
context."
This doesn't seem to help, though. If I use has_deep_history or
has_full_history in StateA's definition, the errors do not go away.
Any help would be greatly appreciated!
--------------------------------
John Wismar
john.wismar_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net