Esempio n. 1
0
 virtual void on_run(void *outer_data, bool &continue_run)
 {
     ZCE_UNUSED_ARG(outer_data);
     switch (get_stage())
     {
     case FMS1_STAGE_1:
         std::cout << "FSM1 stage " << get_stage() << " start."<< std::endl;
         continue_run = true;
         set_stage(FMS1_STAGE_2);
         break;
     case FMS1_STAGE_2:
         std::cout << "FSM1 stage " << get_stage() << std::endl;
         continue_run = true;
         set_stage(FSM1_STAGE_3);
         break;
     case FSM1_STAGE_3:
         std::cout << "FSM1 stage " << get_stage() << std::endl;
         continue_run = true;
         set_stage(FSM1_STAGE_4);
         break;
     case FSM1_STAGE_4:
         std::cout << "FSM1 stage " << get_stage() << " end."<<std::endl;
         continue_run = false;
         break;
     default:
         //一个无法识别的状态
         ZCE_ASSERT(false);
         break;
     }
     return;
 }
Esempio n. 2
0
    static void static_test ()
    {
        static_assert(get_count(_state(0, 1234)) == 1234, "fail");
        static_assert(get_count(_state(1, 1234)) == 1234, "fail");
        static_assert(get_count(_state(2, 1234)) == 1234, "fail");
        static_assert(get_count(_state(3, 1234)) == 1234, "fail");
        static_assert(get_count(_state(4, 1234)) == 1234, "fail");

        static_assert(get_stage(_state(0, 1234)) ==
                      get_stage(_state(0, 5679)), "fail");
        static_assert(get_stage(_state(1, 1234)) ==
                      get_stage(_state(1, 5679)), "fail");
        static_assert(get_stage(_state(2, 1234)) ==
                      get_stage(_state(2, 5679)), "fail");
        static_assert(get_stage(_state(3, 1234)) ==
                      get_stage(_state(3, 5679)), "fail");

        static_assert(_state(0, 1234) != _state(1, 1234), "fail");
        static_assert(_state(0, 1234) != _state(2, 1234), "fail");
        static_assert(_state(0, 1234) != _state(3, 1234), "fail");
        static_assert(_state(0, 1234) != _state(4, 1234), "fail");
        static_assert(_state(1, 1234) != _state(2, 1234), "fail");
        static_assert(_state(1, 1234) != _state(3, 1234), "fail");
        static_assert(_state(1, 1234) != _state(4, 1234), "fail");
        static_assert(_state(2, 1234) != _state(3, 1234), "fail");
        static_assert(_state(2, 1234) != _state(4, 1234), "fail");
        static_assert(_state(3, 1234) != _state(4, 1234), "fail");
    }
Esempio n. 3
0
int main (int argc, char* argv[])
{
  stage stg = get_stage(3);
  render(stdout, stg);
  stage_show(stderr, stg);
  return 0;
}
Esempio n. 4
0
  printf(" *** testing scene *** \n");
  scene testsc = {c,ol2};
  printf("scene with bg (1,2,3) and sph,pst,sph:\n");
  scene_show(stdout,testsc);
  printf("\n *****\n");

  /* hit_test */
  printf(" *** testing hit_test *** \n");
  hit_test ht = {MISS,5.1,v,c,c,vv};
  hit_test htt = {HIT,2.5,v,c,c,vv};
  printf("missed at 5.1s at (1,2,3):\n");
  hit_test_show(stdout,ht);
  printf("\nhit at 2.5s at (1,2,3):\n%s\n",hit_test_tos(htt));
  printf(" *****\n");

  /* camera */
  printf(" *** testing camera *** \n");
  camera cam = {v,9,16};
  printf("camera 9 high and 16 wide at (1,2,3):\n");
  camera_show(stdout,cam);
  printf("\n *****\n");

  /* stage */
  stage stg = get_stage(10);
  printf("get_stage(10):\n");
  stage_show(stdout,stg);
  printf("\n *****\n");

  return 0;
}
Esempio n. 5
0
 stage_t load_stage () const
 {
     return get_stage(pair_.load(std::memory_order_acquire));
 }