#define TrivialEvent(T) struct T : boost::statechart::event<T> { \ T() : boost::statechart::event< T >() {} \ void print(std::ostream *out) const { \ *out << #T; \ } \ };
TrivialEvent(Initialize) TrivialEvent(AdvMap)
struct Initial;
struct RecoveryMachine : boost::statechart::state_machine< RecoveryMachine, Initial > {};
struct Reset;
struct Initial : boost::statechart::state< Initial, RecoveryMachine> { typedef boost::mpl::list < boost::statechart::transition<Initialize, Reset>> reactions; explicit Initial(my_context ctx) : my_base(ctx) { std::cout << "Hello, Initial!\n"; } };
struct Primary; struct Reset : boost::statechart::state<Reset, Initial, Primary> { explicit Reset(my_context ctx): my_base(ctx) { std::cout << "Hello, Reset!\n"; }
typedef boost::mpl::list<boost::statechart::custom_reaction<AdvMap>> reactions;
boost::statechart::result react(const AdvMap &advmap) { std::cout << "discard event AdMap!" << std::endl; return discard_event(); } };
struct Peering; struct Primary : boost::statechart::state< Primary, Reset, Peering> { explicit Primary(my_context ctx): my_base(ctx) { std::cout << "Hello, Primary!\n"; }
};
struct GetInfo; struct Peering : boost::statechart::state< Peering, Primary, GetInfo> { explicit Peering(my_context ctx): my_base(ctx) { std::cout << "now is peering" << std::endl; } void exit();
typedef boost::mpl::list<boost::statechart::custom_reaction<AdvMap>> reactions;
boost::statechart::result react(const AdvMap &advmap) { return forward_event(); } };
struct GetInfo : boost::statechart::state<GetInfo, Peering> { explicit GetInfo(my_context ctx): my_base(ctx) { std::cout << "Hello, GetInfo!\n"; } };
int main(int argc, char *argv[]) { RecoveryMachine machine; machine.initiate(); machine.process_event(AdvMap());
return 0; }