本文整理汇总了C++中Q_ACTION_CAST函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_ACTION_CAST函数的具体用法?C++ Q_ACTION_CAST怎么用?C++ Q_ACTION_CAST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_ACTION_CAST函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Mine2_exploding
/* ${AOs::Mine2::SM::used::exploding} */
static QState Mine2_exploding(Mine2 * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Mine2::SM::used::exploding::TIME_TICK} */
case TIME_TICK_SIG: {
/* ${AOs::Mine2::SM::used::exploding::TIME_TICK::[stillonscreen?]} */
if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15U)) {
ObjectImageEvt *oie;
++me->exp_ctr; /* advance the explosion counter */
me->x -= GAME_SPEED_X; /* move explosion by 1 step */
/* tell the Game to render the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->x = me->x + 1U; /* x of explosion */
oie->y = (int8_t)((int)me->y - 4 + 2); /* y of explosion */
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
status_ = QM_HANDLED();
}
/* ${AOs::Mine2::SM::used::exploding::TIME_TICK::[else]} */
else {
static struct {
QMState const *target;
QActionHandler act[2];
} const tatbl_ = { /* transition-action table */
&Mine2_unused_s, /* target state */
{
Q_ACTION_CAST(&Mine2_used_x), /* exit */
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
}
break;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:36,代码来源:mine2.c
示例2: Mine2_used
/* ${AOs::Mine2::SM::used} */
static QState Mine2_used(Mine2 * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Mine2::SM::used::MINE_RECYCLE} */
case MINE_RECYCLE_SIG: {
static struct {
QMState const *target;
QActionHandler act[2];
} const tatbl_ = { /* transition-action table */
&Mine2_unused_s, /* target state */
{
Q_ACTION_CAST(&Mine2_used_x), /* exit */
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
break;
}
default: {
status_ = QM_SUPER();
break;
}
}
return status_;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:26,代码来源:mine2.c
示例3: Calc_int1
/* ${SMs::Calc::SM::on::operand1::int1} */
static QState Calc_int1(Calc * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${SMs::Calc::SM::on::operand1::int1::POINT} */
case POINT_SIG: {
static struct {
QMState const *target;
QActionHandler act[3];
} const tatbl_ = { /* transition-action table */
&Calc_frac1_s, /* target state */
{
Q_ACTION_CAST(&Calc_int1_x), /* exit */
Q_ACTION_CAST(&Calc_frac1_e), /* entry */
Q_ACTION_CAST(0) /* zero terminator */
}
};
BSP_insert((int)'.');
status_ = QM_TRAN(&tatbl_);
break;
}
/* ${SMs::Calc::SM::on::operand1::int1::DIGIT_0, DIGIT_1_9} */
case DIGIT_0_SIG: /* intentionally fall through */
case DIGIT_1_9_SIG: {
BSP_insert(Q_EVT_CAST(CalcEvt)->key_code);
status_ = QM_HANDLED();
break;
}
default: {
status_ = QM_SUPER();
break;
}
}
(void)me; /* avoid compiler warning in case 'me' is not used */
return status_;
}
开发者ID:KnightSch,项目名称:qpc,代码行数:36,代码来源:calc.c
示例4: Calc_begin
/* ${SMs::Calc::SM::on::ready::begin} */
static QState Calc_begin(Calc * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${SMs::Calc::SM::on::ready::begin::OPER} */
case OPER_SIG: {
/* ${SMs::Calc::SM::on::ready::begin::OPER::[e->key=='-']} */
if (Q_EVT_CAST(CalcEvt)->key_code == KEY_MINUS) {
static struct {
QMState const *target;
QActionHandler act[4];
} const tatbl_ = { /* transition-action table */
&Calc_negated1_s, /* target state */
{
Q_ACTION_CAST(&Calc_begin_x), /* exit */
Q_ACTION_CAST(&Calc_ready_x), /* exit */
Q_ACTION_CAST(&Calc_negated1_e), /* entry */
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
}
/* ${SMs::Calc::SM::on::ready::begin::OPER::[else]} */
else {
status_ = QM_HANDLED();
}
break;
}
default: {
status_ = QM_SUPER();
break;
}
}
(void)me; /* avoid compiler warning in case 'me' is not used */
return status_;
}
开发者ID:KnightSch,项目名称:qpc,代码行数:36,代码来源:calc.c
示例5: Ship_parked
/* ${AOs::Ship::SM::active::parked} */
static QState Ship_parked(Ship * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Ship::SM::active::parked::TAKE_OFF} */
case TAKE_OFF_SIG: {
static struct {
QMState const *target;
QActionHandler act[2];
} const tatbl_ = { /* transition-action table */
&Ship_flying_s, /* target state */
{
Q_ACTION_CAST(&Ship_flying_e), /* entry */
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
break;
}
default: {
status_ = QM_SUPER();
break;
}
}
return status_;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:26,代码来源:ship.c
示例6: switch
// ${AOs::Mine2::SM::used::exploding}
QP::QState Mine2::exploding(Mine2 * const me, QP::QEvt const * const e) {
QP::QState status_;
switch (e->sig) {
// ${AOs::Mine2::SM::used::exploding::TIME_TICK}
case TIME_TICK_SIG: {
// ${AOs::Mine2::SM::used::exploding::TIME_TICK::[stillonscreen?]}
if ((me->m_x >= GAME_SPEED_X) && (me->m_exp_ctr < 15)) {
++me->m_exp_ctr; // advance the explosion counter
me->m_x -= GAME_SPEED_X; // move explosion by 1 step
// tell the Game to render the current stage of Explosion
ObjectImageEvt *oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->x = me->m_x + 1U; // x of explosion
oie->y = (int8_t)((int)me->m_y - 4 + 2); // y of explosion
oie->bmp = EXPLOSION0_BMP + (me->m_exp_ctr >> 2);
AO_Tunnel->POST(oie, me);
status_ = QM_HANDLED();
}
// ${AOs::Mine2::SM::used::exploding::TIME_TICK::[else]}
else {
static struct {
QP::QMState const *target;
QP::QActionHandler act[2];
} const tatbl_ = { // transition-action table
&unused_s,
{
Q_ACTION_CAST(&used_x), // exit
Q_ACTION_CAST(0) // zero terminator
}
};
status_ = QM_TRAN(&tatbl_);
}
break;
}
开发者ID:alisonjoe,项目名称:qpcpp,代码行数:35,代码来源:mine2.cpp
示例7: Ship_initial
/*${AOs::Ship::SM} .........................................................*/
static QState Ship_initial(Ship * const me, QEvt const * const e) {
static struct {
QMState const *target;
QActionHandler act[2];
} const tatbl_ = { /* transition-action table */
&Ship_active_s, /* target state */
{
Q_ACTION_CAST(&Ship_active_i), /* init.tran. */
Q_ACTION_CAST(0) /* zero terminator */
}
};
/* ${AOs::Ship::SM::initial} */
(void)e; /* avoid the compiler warning 'usused parameter' */
QActive_subscribe((QActive *)me, TIME_TICK_SIG);
QActive_subscribe((QActive *)me, PLAYER_TRIGGER_SIG);
/* object dictionaries... */
QS_OBJ_DICTIONARY(&l_ship);
/* function dictionaries for Ship HSM... */
QS_FUN_DICTIONARY(&Ship_initial);
QS_FUN_DICTIONARY(&Ship_active);
QS_FUN_DICTIONARY(&Ship_parked);
QS_FUN_DICTIONARY(&Ship_flying);
QS_FUN_DICTIONARY(&Ship_exploding);
/* local signals... */
QS_SIG_DICTIONARY(PLAYER_SHIP_MOVE_SIG, &l_ship);
QS_SIG_DICTIONARY(TAKE_OFF_SIG, &l_ship);
QS_SIG_DICTIONARY(HIT_WALL_SIG, &l_ship);
QS_SIG_DICTIONARY(HIT_MINE_SIG, &l_ship);
QS_SIG_DICTIONARY(DESTROYED_MINE_SIG, &l_ship);
return QM_TRAN_INIT(&tatbl_);
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:32,代码来源:ship.c
示例8: Philo_eating
/* ${AOs::Philo::SM::eating} */
static QState Philo_eating(Philo * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Philo::SM::eating::TIMEOUT} */
case TIMEOUT_SIG: {
static struct {
QMState const *target;
QActionHandler act[3];
} const tatbl_ = { /* transition-action table */
&Philo_thinking_s, /* target state */
{
Q_ACTION_CAST(&Philo_eating_x), /* exit */
Q_ACTION_CAST(&Philo_thinking_e), /* entry */
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
break;
}
/* ${AOs::Philo::SM::eating::EAT, DONE} */
case EAT_SIG: /* intentionally fall through */
case DONE_SIG: {
/* EAT or DONE must be for other Philos than this one */
Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me));
status_ = QM_HANDLED();
break;
}
default: {
status_ = QM_SUPER();
break;
}
}
return status_;
}
开发者ID:sesamemucho,项目名称:qsm_study,代码行数:35,代码来源:philo.c
示例9: switch
// ${AOs::Table::SM::active::paused}
QP::QState Table::paused(Table * const me, QP::QEvt const * const e) {
QP::QState status_;
switch (e->sig) {
// ${AOs::Table::SM::active::paused::PAUSE}
case PAUSE_SIG: {
static struct {
QP::QMState const *target;
QP::QActionHandler act[3];
} const tatbl_ = { // transition-action table
&serving_s,
{
Q_ACTION_CAST(&paused_x), // exit
Q_ACTION_CAST(&serving_e), // entry
Q_ACTION_CAST(0) // zero terminator
}
};
status_ = QM_TRAN(&tatbl_);
break;
}
// ${AOs::Table::SM::active::paused::HUNGRY}
case HUNGRY_SIG: {
uint8_t n = Q_EVT_CAST(TableEvt)->philoNum;
// philo ID must be in range and he must be not hungry
Q_ASSERT((n < N_PHILO) && (!me->m_isHungry[n]));
me->m_isHungry[n] = true;
BSP_displayPhilStat(n, HUNGRY);
status_ = QM_HANDLED();
break;
}
// ${AOs::Table::SM::active::paused::DONE}
case DONE_SIG: {
uint8_t n = Q_EVT_CAST(TableEvt)->philoNum;
// phil ID must be in range and he must be not hungry
Q_ASSERT((n < N_PHILO) && (!me->m_isHungry[n]));
BSP_displayPhilStat(n, THINKING);
uint8_t m = LEFT(n);
/* both forks of Phil[n] must be used */
Q_ASSERT((me->m_fork[n] == USED) && (me->m_fork[m] == USED));
me->m_fork[m] = FREE;
me->m_fork[n] = FREE;
status_ = QM_HANDLED();
break;
}
default: {
status_ = QM_SUPER();
break;
}
}
return status_;
}
开发者ID:alisonjoe,项目名称:qpcpp,代码行数:53,代码来源:table.cpp
示例10: Calc_ready_i
/* ${SMs::Calc::SM::on::ready::initial} */
static QState Calc_ready_i(Calc * const me) {
static struct {
QMState const *target;
QActionHandler act[2];
} const tatbl_ = { /* transition-action table */
&Calc_begin_s, /* target state */
{
Q_ACTION_CAST(&Calc_begin_e), /* entry */
Q_ACTION_CAST(0) /* zero terminator */
}
};
/* ${SMs::Calc::SM::on::ready::initial} */
BSP_message("ready-INIT;");
return QM_TRAN_INIT(&tatbl_);
}
开发者ID:KnightSch,项目名称:qpc,代码行数:16,代码来源:calc.c
示例11: Ship_exploding
/* ${AOs::Ship::SM::active::exploding} */
static QState Ship_exploding(Ship * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Ship::SM::active::exploding::TIME_TICK} */
case TIME_TICK_SIG: {
/* ${AOs::Ship::SM::active::exploding::TIME_TICK::[me->exp_ctr<1~]} */
if (me->exp_ctr < 15U) {
ObjectImageEvt *oie;
++me->exp_ctr;
/* tell the Tunnel to draw the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
oie->x = me->x; /* x of explosion */
oie->y = (int8_t)((int)me->y - 4U + SHIP_HEIGHT);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
status_ = QM_HANDLED();
}
/* ${AOs::Ship::SM::active::exploding::TIME_TICK::[else]} */
else {
static QMTranActTable const tatbl_ = { /* transition-action table */
&Ship_parked_s,
{
Q_ACTION_CAST(0) /* zero terminator */
}
};
ScoreEvt *gameOver = Q_NEW(ScoreEvt, GAME_OVER_SIG);
gameOver->score = me->score;
QACTIVE_POST(AO_Tunnel, (QEvt *)gameOver, me);
status_ = QM_TRAN(&tatbl_);
}
break;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:33,代码来源:ship.c
注:本文中的Q_ACTION_CAST函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论