I've built a small test program with the statechart library. (See below)
It seems that the sequence of exit and entry actions invoked for a
transition are modeled according to the UML 1.5 specification. In other
words it models "external" transitions from the 2.0 spec. Is it
possible, or are there any plans to extend it, to model the more useful
local transitions from the 2.0 spec?
Tests with deep history produce a static assertion if you attempt to
transition to history of a containing state. UML 2.0 explicitly permits
this. Are there any plans to modify the library to permit this?
Yours,
Tim Milward
#include <iostream>
#include
#include
#include
#include
#include
using namespace std;
namespace sc = boost::statechart;
struct S0;
struct S00;
struct Machine : sc::state_machine< Machine, S0 >
{
Machine() { cout << "Machine()\n"; }
~Machine() { cout << "~Machine()\n"; }
};
struct E0 : sc::event< E0 >
{
E0() { cout << "E0()\n"; }
~E0() { cout << "~E0()\n"; }
};
struct E1 : sc::event< E1 >
{
E1() { cout << "E1()\n"; }
~E1() { cout << "~E1()\n"; }
};
struct S0 : sc::simple_state< S0, Machine, S00, sc::has_deep_history >
{
// this would comile fine
// typedef sc::transition > reactions; //
this invokes exit actions of S00 and S0 (an external transition)
typedef sc::transition reactions;
S0() { cout << "S0()\n"; }
virtual ~S0() { cout << "~S0()\n"; }
};
struct S00 : sc::simple_state< S00, S0 >
{
// this doesn't compile
// typedef sc::transition > reactions;
// this invokes exit actions of S00 only
typedef sc::transition reactions;
S00() { cout << "S00()\n"; }
virtual ~S00() { cout << "~S00()\n"; }
};
int main()
{
Machine m;
m.initiate();
m.process_event(E0());
m.process_event(E1());
return 1;
}