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
#include
#include
#include
#include
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 {};
struct StateA : sc::simple_state
{
typedef sc::transition reactions;
};
struct StateB : sc::simple_state
{
typedef sc::transition
reactions;
};
struct StateA1 : sc::simple_state
{
typedef sc::transition reactions;
};
struct StateA2 : sc::simple_state
{
typedef sc::transition 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@autozone.com