Ejemplo n.º 1
0
 sc::result react( const EvCheckCtorArgs & ev )
 {
   BOOST_REQUIRE( ev.expectedArgs_ == outermost_context().CtorArgs() );
   outermost_context_type & machine = outermost_context();
   machine.my_scheduler().queue_event(
     machine.my_handle(), MakeEvent( new EvTerminate() ) );
   return discard_event();
 }
Ejemplo n.º 2
0
 sc::result DestroyMyself()
 {
   outermost_context_type & machine = outermost_context();
   machine.my_scheduler().destroy_processor( machine.my_handle() );
   machine.my_scheduler().terminate();
   return terminate();
 }
Ejemplo n.º 3
0
    sc::result react( const BallReturned & ballReturned )
    {
      outermost_context_type & machine = outermost_context();
      ++machine.TotalNoOfProcessedEvents();

      if ( noOfReturns_++ < machine.GetMaxNoOfReturns() )
      {
        ballReturned.returnToOpponent( pBallReturned_ );
        return discard_event();
      }
      else
      {
        ballReturned.abortGame();
        return DestroyMyself();
      }
    }
Ejemplo n.º 4
0
 Waiting( my_context ctx ) :
   my_base( ctx ),
   noOfReturns_( 0 ),
   pBallReturned_( new BallReturned() )
 {
   outermost_context_type & machine = outermost_context();
   // as we will always return the same event to the opponent, we construct
   // and fill it here so that we can reuse it over and over
   pBallReturned_->returnToOpponent = boost::bind(
     &MyScheduler::queue_event,
     &machine.my_scheduler(), machine.my_handle(), _1 );
   pBallReturned_->abortGame = boost::bind(
     &MyScheduler::queue_event,
     &machine.my_scheduler(), machine.my_handle(),
     MakeIntrusive( new GameAborted() ) );
 }
Ejemplo n.º 5
0
 sc::result react( const EvLeafDeferred & )
 {
   outermost_context().IncrementProcessedCount();
   return discard_event();
 }
Ejemplo n.º 6
0
 sc::result react( const sc::event_base & )
 {
   outermost_context().IncrementReactionCount();
   return discard_event();
 }
Ejemplo n.º 7
0
 sc::result react( const EvDiscardInD & )
 {
   outermost_context().Visited( *this );
   return forward_event();
 }