Beispiel #1
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		CloseInOnEnemyWhileFiringWeapon
//
// Description:	Transitions the behaviors state
//
// Parameters:	coverCombatStates_t state -- The state to transition to
//
// Returns:		None
//--------------------------------------------------------------
void CloseInOnEnemyWhileFiringWeapon::transitionToState( CIWFStates_t state )
{
	switch( state )
		{
		case CIWF_APPROACH_SETUP_APPROACH:
			setupStateSetupApproach();
			setInternalState( state , "CIWF_APPROACH_SETUP_APPROACH" );
		break;

		case CIWF_APPROACH_FIRE:
			setupStateApproachFire();
			setInternalState( state , "CIWF_APPROACH_FIRE" );
		break;

		case CIWF_APPROACH_FIRE_PAUSE:
			setupStateApproachFirePause();
			setInternalState( state , "CIWF_APPROACH_FIRE_PAUSE" );
		break;

		case CIWF_SUCCESS:
			setInternalState( state , "CIWF_SUCCESS" );
		break;

		case CIWF_FAILED:
			setInternalState( state , "CIWF_FAILED" );
		break;
		}
}
Beispiel #2
0
//----------------------------------------------------------------------------
void ctkExampleDicomAppLogic::onCancelProgress()
{
  //release all resources
  onReleaseResources();
  //update state
  setInternalState(ctkDicomAppHosting::IDLE);
  getHostInterface()->notifyStateChanged(ctkDicomAppHosting::IDLE);
}
Beispiel #3
0
//----------------------------------------------------------------------------
void ctkExampleDicomAppLogic::onExitHostedApp()
{
  //useless move, but correct:
  setInternalState(ctkDicomAppHosting::EXIT);
  getHostInterface()->notifyStateChanged(ctkDicomAppHosting::EXIT);
  qDebug() << "Exiting";
  //die
  qApp->exit(0);
}
object_ptr<ContentWidget> Memento::createWidget(
		QWidget *parent,
		not_null<Controller*> controller,
		const QRect &geometry) {
	auto result = object_ptr<Widget>(
		parent,
		controller);
	result->setInternalState(geometry, this);
	return std::move(result);
}
Beispiel #5
0
//----------------------------------------------------------------------------
void ctkExampleDicomAppLogic::onSuspendProgress()
{
  //release resources it can reclame later to resume work
  ui.LoadDataButton->setEnabled(false);
  //notify state changed
  setInternalState(ctkDicomAppHosting::SUSPENDED);
  getHostInterface()->notifyStateChanged(ctkDicomAppHosting::SUSPENDED);
  //we're rolling
  //do something else normally, but this is an example
}
Beispiel #6
0
//----------------------------------------------------------------------------
void ctkExampleDicomAppLogic::onStartProgress()
{
  setInternalState(ctkDicomAppHosting::INPROGRESS);

  // we need to create the button before we receive data from
  // the host, which happens immediately after calling
  // getHostInterface()->notifyStateChanged
  do_something(); 

  getHostInterface()->notifyStateChanged(ctkDicomAppHosting::INPROGRESS);
}
Beispiel #7
0
//----------------------------------------------------------------------------
void ctkExampleDicomAppLogic::onResumeProgress()
{
  //reclame all resources.

  //notify state changed
  setInternalState(ctkDicomAppHosting::INPROGRESS);
  getHostInterface()->notifyStateChanged(ctkDicomAppHosting::INPROGRESS);
  //we're rolling
  //do something else normally, but this is an example
  ui.LoadDataButton->setEnabled(true);
}
Beispiel #8
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		StationaryFireCombat
//
// Description:	Transitions the behaviors state
//
// Parameters:	coverCombatStates_t state -- The state to transition to
//
// Returns:		None
//--------------------------------------------------------------
void StationaryFireCombat::transitionToState( StationaryFireStates_t state )
{	
	switch ( state )
		{	
		case STATIONARY_FIRE_AIM:
			setupStateAim();
			setInternalState( state , "STATIONARY_FIRE_AIM" );
		break;

		case STATIONARY_FIRE_PRE_FIRE:
			setupStatePreFire();
			setInternalState( state , "STATIONARY_FIRE_PRE_FIRE" );
		break;

		case STATIONARY_FIRE_ATTACK:
			setupStateAttack();
			setInternalState( state , "STATIONARY_FIRE_ATTACK" );
		break;

		case STATIONARY_FIRE_POST_FIRE:
			setupStatePostFire();
			setInternalState( state , "STATIONARY_FIRE_POST_FIRE" );
		break;

		case STATIONARY_FIRE_SUCCESS:
			setInternalState( state , "STATIONARY_FIRE_SUCCESS" );
		break;

		case STATIONARY_FIRE_FAILED:
			setInternalState( state , "SUPPRESSION_FIRE_FAILED" );
		break;
		}
	
}
Beispiel #9
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		TorsoAimAndFireWeapon
//
// Description:	Transitions the behaviors state
//
// Parameters:	coverCombatStates_t state -- The state to transition to
//
// Returns:		None
//--------------------------------------------------------------
void TorsoAimAndFireWeapon::transitionToState( TorsoAimAndFireStates_t state )
{	
	switch ( state )
		{	
		case TORSO_AIM_AND_FIRE_AIM:
			setupStateAim();
			setInternalState( state , "TORSO_AIM_AND_FIRE_AIM" );
		break;

		case TORSO_AIM_AND_FIRE_PRE_FIRE:
			setupStatePreFire();
			setInternalState( state , "TORSO_AIM_AND_FIRE_PRE_FIRE" );
		break;

		case TORSO_AIM_AND_FIRE_ATTACK:
			setupStateAttack();
			setInternalState( state , "TORSO_AIM_AND_FIRE_ATTACK" );
		break;

		case TORSO_AIM_AND_FIRE_POST_FIRE:
			setupStatePostFire();
			setInternalState( state , "TORSO_AIM_AND_FIRE_POST_FIRE" );
		break;

		case TORSO_AIM_AND_FIRE_SUCCESS:
			setInternalState( state , "TORSO_AIM_AND_FIRE_SUCCESS" );
		break;

		case TORSO_AIM_AND_FIRE_FAILED:
			setInternalState( state , "TORSO_AIM_AND_FIRE_FAILED" );
		break;
		}
	
}
Beispiel #10
0
void WatchEntity::transitionToState( watchEntityStates_t state )
{
	switch ( state )
		{
		case WATCH_HOLD:
			setupStateHold();
			setInternalState( state , "WATCH_HOLD" );
		break;

		case WATCH_ROTATE:
			setupStateRotate();
			setInternalState( state , "WATCH_ROTATE" );
		break;

		case WATCH_SUCCESS:			
			setInternalState( state , "WATCH_SUCCESS" );
		break;

		case WATCH_FAILED:
			setInternalState( state , "WATCH_FAILED" );
		break;		
		}
}
Beispiel #11
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		GotoCurrentHelperNode
//
// Description:	Transitions the behaviors state
//
// Parameters:	coverCombatStates_t state -- The state to transition to
//
// Returns:		None
//--------------------------------------------------------------
void GotoCurrentHelperNode::transitionToState( GotoHelperNodeStates_t state )
{	
	switch ( state )
		{	
		case GOTO_HNODE_FIND_NODE:
			setupStateFindNode();
			setInternalState( state , "GOTO_HNODE_FIND_NODE" );
		break;

		case GOTO_HNODE_MOVE_TO_NODE:
			setupStateMoveToNode();
			setInternalState( state , "GOTO_HNODE_MOVE_TO_NODE" );
		break;

		case GOTO_HNODE_SUCCESS:
			setInternalState( state , "GOTO_HNODE_SUCCESS" );
		break;

		case GOTO_HNODE_FAILED:
			setInternalState( state , "GOTO_HNODE_FAILED" );
		break;
		}
	
}
EDMA_Status EDMA_mapBaseAddress(void **pvirtAddr)
{
    Int sharedMemId = -1;
    if (NULL == state) {
#ifdef xdc_target__os_Linux
        state = ( EDMA_State *)SHM_getObj(EXAMPLE_gate, sizeof(EDMA_State),
                EDMA_LOCKID, &setInternalState, &sharedMemId);
#else
        state = &myState;
        setInternalState(state);
        sharedMemId = 0;
#endif
        state->sharedMemId = sharedMemId;
    }
    *pvirtAddr = (void **)(state->edma).edmaAddressSpace;
    return (EDMA_OK);
}
Beispiel #13
0
static void getInternalState()
{
#ifdef xdc_target__os_Linux
    Int sharedMemId = -1;

    _resmanInternalState = (IRESMAN_HDVICP_InternalState *)SHM_getObj(gate,
            sizeof(IRESMAN_HDVICP_InternalState), _HDVICP_LOCKID,
            &setInternalState, &sharedMemId);
    _resmanInternalState->sharedMemId = sharedMemId;
#else
    __FAR__ static IRESMAN_HDVICP_InternalState _HDVICP_internalState;

    _resmanInternalState = (IRESMAN_HDVICP_InternalState *)
            &_HDVICP_internalState;
    setInternalState(_resmanInternalState);
    _resmanInternalState->sharedMemId = 0;
#endif
}
int EDMA_init(void)
{
    Int sharedMemId;

#ifdef xdc_target__os_Linux
    state = ( EDMA_State *)SHM_getObj(EXAMPLE_gate, sizeof(EDMA_State),
            EDMA_LOCKID, &setInternalState, &sharedMemId);
#else
    state = &myState;
    setInternalState(state);
    sharedMemId = 0;
#endif

    state->refCount++;

    if (NULL != state) {
        state->sharedMemId = sharedMemId;
    }

    return (1);
}
static void getInternalState()
{
    Int sharedMemId = -1;
#ifdef xdc_target__os_Linux

    rmanInternalState = (RMAN_InternalState *)SHM_getObj(gate,
            sizeof(RMAN_InternalState) + (ti_sdo_fc_rman_RMAN_MAXALGS *
            sizeof(RMAN_VtableEntry)), (key_t)_RMAN_LOCKID,
            &setInternalState, &sharedMemId);

    algresVTable = (RMAN_VtableEntry *)((unsigned int)rmanInternalState +
            (unsigned int) (rmanInternalState->info.vTableOffset));
#else
    rmanInternalState = (RMAN_InternalState *)
            &_RMAN_internalState;
    algresVTable = (RMAN_VtableEntry *)(malloc(ti_sdo_fc_rman_RMAN_MAXALGS *
            sizeof(RMAN_VtableEntry)));
    setInternalState(rmanInternalState);
    sharedMemId = 0;
#endif
    rmanInternalState->info.sharedMemId = sharedMemId;
    rmanInternalState->info.refCount++;
}
EDMA_Status EDMA_getResource(int devId, int *tcc, int *channel, int *param,
                             int nParams)
{
    EDMA_Status status = EDMA_ENOCHANNEL;
    Bool found = FALSE;
    Int j = 0;
    Int temp = -1;
    Int sharedMemId;
    if (NULL == state) {
#ifdef xdc_target__os_Linux
        state = ( EDMA_State *)SHM_getObj(EXAMPLE_gate, sizeof(EDMA_State),
                EDMA_LOCKID, &setInternalState, &sharedMemId);
#else
        state = (EDMA_State *)&myState;
        setInternalState(state);
        sharedMemId = 0;
#endif
        state->sharedMemId = sharedMemId;
    }

    switch (devId) {

        case EDMA_EDMAANY:

            while (state->symIndex < 64) {
                if ((state->edmaArr[state->symIndex] == 0) &&
                        (state->paramArr[state->symIndex] == 0) &&
                        (state->tccArr[state->symIndex] == 0)) {
                    *channel = state->symIndex;
                    *param   = state->symIndex;
                    *tcc     = state->symIndex;
                    state->edmaArr[state->symIndex] = 1;
                    state->paramArr[state->symIndex] = 1;
                    state->tccArr[state->symIndex] = 1;
                    status = EDMA_OK;
                    state->symIndex++;
                    break;
                }
                else {
                    state->symIndex++;
                }
           }
           break;

       case EDMA_QDMAANY:

        while (state->tccQdmaIndex != state->symIndex) {

            if (*tcc != EDMA_TCCANY) {
                temp = state->tccQdmaIndex;
                state->tccQdmaIndex = *tcc;
            }

            if (state->tccArr[state->tccQdmaIndex] == 0) {

                while ((state->qdmaIndex < 8) &&
                        (state->qdmaArr[state->qdmaIndex] == 1)) {
                    state->qdmaIndex++;
                }

                while ((state->paramAnyIndex < 512) && (state->paramArr[state->paramAnyIndex] == 1)){
                    state->paramAnyIndex++;
                }

                if ((1 == state->qdmaArr[state->qdmaIndex]) ||
                        (1 == state->paramArr[state->paramAnyIndex])) {
                    break;
                }

                *channel = EDMA_QDMA0 + state->qdmaIndex;
                *param   = state->paramAnyIndex;
                *tcc     = state->tccQdmaIndex;
                state->qdmaArr[state->qdmaIndex] = 1;
                state->paramArr[state->paramAnyIndex] = 1;
                state->tccArr[state->tccQdmaIndex] = 1;
                state->qdmaIndex++;
                state->tccQdmaIndex--;
                state->paramAnyIndex++;
                status = EDMA_OK;

                if (temp != -1) {
                    state->tccQdmaIndex = temp;
                }
                break;
            }
            else {
                if (*tcc != EDMA_TCCANY) {
                    break;
                }
                state->tccQdmaIndex--;
            }
       }
       if (temp != -1) {
           state->tccQdmaIndex = temp;
       }
       break;
       case EDMA_PARAMANY:
            while ((state->paramAnyIndex < 512) && (state->paramArr[state->paramAnyIndex] == 1)) {
                state->paramAnyIndex++;
            }
            if (state->paramAnyIndex + nParams < 512) {
                for (j = 0; j < nParams; j++) {
                    state->paramArr[state->paramAnyIndex+j] = 1;
                }
                *param = state->paramAnyIndex;
                state->paramAnyIndex += nParams;
                status = EDMA_OK;
                break;
            }
        break;
       default:
            if (devId < 64) {
                /* Requested and EDMA channel */
                if ((state->edmaArr[devId] == 0) &&
                        (state->paramArr[devId] == 0) &&
                        (state->tccArr[devId] == 0)) {
                    *channel = devId;
                    *param   = devId;
                    *tcc     = devId;
                    state->edmaArr[devId] = 1;
                    state->paramArr[devId] = 1;
                    state->tccArr[devId] = 1;
                    status = EDMA_OK;
                    break;
                }
            }
            else if (devId < 512) {
                /* Requested a PARAM channel */
                for (j = 0; j < nParams; j++) {
                    if (state->paramArr[devId+j] == 0) {
                        found = TRUE;
                        state->paramArr[devId + j] = 1;
                    }
                    else {
                        found = FALSE;
                        break;
                    }
                }
                if (found) {
                    *param = devId;
                    status = EDMA_OK;
                }
            }
            else if (devId <= EDMA_QDMA7) {
                if (state->qdmaArr[devId-EDMA_QDMA0] == 0) {
                    state->qdmaArr[devId-EDMA_QDMA0] = 1;
                    *channel = devId-EDMA_QDMA0;
                }

                while (state->tccQdmaIndex != state->symIndex) {

                    if (state->tccArr[state->tccQdmaIndex] == 0) {

                        while ((state->paramAnyIndex < 512) &&
                                    (state->paramArr[state->paramAnyIndex] == 1)) {
                                state->paramAnyIndex++;
                        }

                        if (1 == state->paramArr[state->paramAnyIndex]) {
                            break;
                        }

                        *param   = state->paramAnyIndex;
                        *tcc     = state->tccQdmaIndex;
                        state->paramArr[state->paramAnyIndex] = 1;
                        state->tccArr[state->tccQdmaIndex] = 1;
                        state->tccQdmaIndex--;
                        state->paramAnyIndex++;
                        status = EDMA_OK;
                        break;
                    }
                    else {
                        state->tccQdmaIndex--;
                    }
                }
            }
        }
        return (status);
}
Beispiel #17
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		Work
//
// Description:	Transitions Internal State
//
// Parameters:	workStates_t state
//
// Returns:		None
//--------------------------------------------------------------
void Work::transitionToState ( workStates_t state )
{
	switch ( state )
		{
		case WORK_FIND_NODE:
			setupStateFindNode();
			setInternalState( state , "WORK_FIND_NODE" );
		break;

		case WORK_MOVE_TO_NODE:
			setupStateMoveToNode();
			setInternalState( state , "WORK_MOVE_TO_NODE" );
		break;

		case WORK_AT_NODE:
			setupStateAtNode();
			setInternalState( state , "WORK_AT_NODE" );
		break;

		case WORK_ANIMATE_WAIT_ON_TIME:
			setupStateAnimateWaitOnTime();
			setInternalState( state , "WORK_ANIMATE_WAIT_ON_TIME" );
		break;

		case WORK_ANIMATE_WAIT_ON_ANIM:
			setupStateAnimateWaitOnAnim();
			setInternalState( state , "WORK_ANIMATE_WAIT_ON_ANIM" );
		break;

		case WORK_ANIMATE_WAIT_ON_SIGNAL:
			setupStateAnimateWaitOnSignal();
			setInternalState( state , "WORK_ANIMATE_WAIT_ON_SIGNAL" );
		break;

		case WORK_ANIMATE_CONSTANT:
			setupStateAnimateConstant();
			setInternalState( state , "WORK_ANIMATE_CONSTANT" );
		break;

		case WORK_ANIMATE_LIST_WAIT_ON_TIME:
			setupStateAnimateListWaitOnTime();
			setInternalState( state , "WORK_ANIMATE_LIST_WAIT_ON_TIME" );
		break;

		case WORK_ANIMATE_LIST_WAIT_ON_ANIM:
			setupStateAnimateListWaitOnAnim();
			setInternalState( state , "WORK_ANIMATE_LIST_WAIT_ON_ANIM" );
		break;

		case WORK_ANIMATE_LIST_WAIT_ON_SIGNAL:
			setupStateAnimateListWaitOnSignal();
			setInternalState( state , "WORK_ANIMATE_LIST_WAIT_ON_SIGNAL" );
		break;

		case WORK_SELECT_ANIM_MODE:
			setInternalState( state, "WORK_SELECT_ANIM_MODE," );
		break;

		case WORK_SUCCESSFUL:
			setInternalState( state , "WORK_SUCCESSFUL" );
		break;

		case WORK_FAILED:
			setInternalState( state , "WORK_FAILED" );
		break;
		}

}
Beispiel #18
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		CorridorCombatWithRangedWeapon
//
// Description:	Transitions the behaviors state
//
// Parameters:	coverCombatStates_t state -- The state to transition to
//
// Returns:		None
//--------------------------------------------------------------
void CorridorCombatWithRangedWeapon::transitionToState( corridorCombatStates_t state )
{
	switch ( state )
	{
	case CORRIDORCOMBAT_WRW_FINDNODE:
		setupStateFindNode();	
		setInternalState( state , "CORRIDORCOMBAT_WRW_FINDNODE" );
	break;

	case CORRIDORCOMBAT_WRW_MOVETONODE:
		setupStateMoveToNode();	
		setInternalState( state , "CORRIDORCOMBAT_WRW_MOVETONODE" );
	break;

	case CORRIDORCOMBAT_WRW_BACKPEDAL:
		setupStateBackPedal();
		setInternalState( state , "CORRIDORCOMBAT_WRW_BACKPEDAL" );
	break;

	case CORRIDORCOMBAT_WRW_FINDBETTERNODE:
		setupStateFindBetterNode();
		setInternalState( state , "CORRIDORCOMBAT_WRW_FINDBETTERNODE" );
	break;

	case CORRIDORCOMBAT_WRW_MOVETOBETTERNODE:
		setupStateMoveToBetterNode();
		setInternalState( state , "CORRIDORCOMBAT_WRW_MOVETOBETTERNODE" );
	break;

	case CORRIDORCOMBAT_WRW_CHANGEPOSTURE_DUCK:
		setupStateChangePostureDuck();
		setInternalState( state , "CORRIDORCOMBAT_WRW_CHANGEPOSTURE_DUCK" );
	break;

	case CORRIDORCOMBAT_WRW_CHANGEPOSTURE_STAND:
		setupStateChangePostureStand();
		setInternalState( state , "CORRIDORCOMBAT_WRW_CHANGEPOSTURE_STAND" );
	break;

	case CORRIDORCOMBAT_WRW_DUCKED:
		setupStateDucked();
		setInternalState( state , "CORRIDORCOMBAT_WRW_DUCKED" );
	break;

	case CORRIDORCOMBAT_WRW_DUCKED_FIRING:
		setupStateFireDucked();
		setInternalState( state , "CORRIDORCOMBAT_WRW_DUCKED_FIRING" );
	break;

	case CORRIDORCOMBAT_WRW_STAND:
		setupStateStanding();
		setInternalState( state , "CORRIDORCOMBAT_WRW_STAND" );
	break;

	case CORRIDORCOMBAT_WRW_STAND_FIRING:
		setupStateFireStanding();
		setInternalState( state , "CORRIDORCOMBAT_WRW_STAND_FIRING" );
	break;

	case CORRIDORCOMBAT_WRW_HOLD_POSITION:
		setupStateHoldPosition();
		setInternalState( state , "CORRIDORCOMBAT_WRW_HOLD_POSITION" );
	break;

	case CORRIDORCOMBAT_WRW_SUCCESS:
		setInternalState( state , "CORRIDORCOMBAT_WRW_SUCCESS" );
	break;

	case CORRIDORCOMBAT_WRW_FAILED:
		setInternalState( state , "CORRIDORCOMBAT_WRW_FAILED" );
	break;
	}
}
Beispiel #19
0
/*
 *  ======== RMP_create ========
 */
RMP_Handle RMP_create(RMP_Attrs *attrs)
{
    RMP_Obj         *handle = NULL;
    Int             shmId = -1;
    unsigned int    shmSize = 0;
    Void            * addr = NULL;
    RMM_Attrs       rmmAttrs;
    static Int shmCount = 0;

    /* Create a shared memory object RMP_Obj using the key and the lock
    Size of this will depend numResources and RMM_Obj etc  */

    Assert_isTrue(shmCount < RMMP_MAXINSTANCES, (Assert_Id)NULL);

    shmSize = sizeof(RMP_Obj) + sizeof(RMM_Obj) + sizeof(UInt32);
    shmSize = ALIGN32(shmSize);
    shmSize += (attrs->maxFreeListBlocks * sizeof(RMM_Header));
    shmSize = ALIGN32(shmSize);

#ifdef xdc_target__os_Linux
    addr = SHM_getObj((GateProcess_Handle_upCast)(attrs->gate), shmSize,
            (key_t)attrs->key, (SHM_InitFxn)&setInternalState, &shmId);
#else
    addr = (void *)malloc(shmSize);
    if (NULL != addr) {
        setInternalState(addr);
        shmId = 0;
    }
#endif

    if (shmId != -1) {
        handle = (RMP_Obj *)addr;

        if (0 == handle->refCount) {
            /* RMM_create has to happen */
            rmmAttrs.segid = shmCount;          /* Use shmCount as segId */
            rmmAttrs.base = attrs->base;
            rmmAttrs.length = attrs->length;
            rmmAttrs.maxFreeListBlocks = attrs->maxFreeListBlocks;
            /* My alloc fxn will use the sharedMem address to increment an
               offset pointer */

            rmmAttrs.allocFxn = shmAlloc;
            rmmAttrs.freeFxn = shmFree;

            /* Store the shmCount in the  SHM_Obj part of the handle */
            handle->shmCount = shmCount;
            shmCount++;
        }

        /* Successful acquisition of shared Mem object, so store in array
           for use by allocFxn */
        shmAddrs[handle->shmCount] = (unsigned int)addr;
        shmIndex[handle->shmCount] = sizeof(RMP_Obj); /* Change this to work for
                the allocFxn */

        if (handle->refCount == 0) {
            /* Whatever the RMM_create returns, store that as an offset from
               shmBase */
            handle->rmmOffset = OFFSET(handle, RMM_create(&rmmAttrs));
        }
        handle->refCount++;

        /* Store the sharedMemId in the RMP_Obj */
        handle->sharedMemId = shmId;
    }

    return (handle);
}
Beispiel #20
0
//--------------------------------------------------------------
// Name:		transitionToState()
// Class:		GeneralCombatWithRangedWeapon
//
// Description:	Transitions the behaviors state
//
// Parameters:	coverCombatStates_t state -- The state to transition to
//
// Returns:		None
//--------------------------------------------------------------
void GeneralCombatWithRangedWeapon::transitionToState( generalCombatStates_t state )
{
	
	switch ( state )
	{
	case GC_WRW_CHANGE_POSTURE_TO_ADVANCE:
		setupStateChangePostureToAdvance();
		setInternalState( state , "GC_WRW_CHANGE_POSTURE_TO_ADVANCE" );
	break;

	case GC_WRW_CHANGE_POSTURE_TO_RETREAT:
		setupStateChangePostureToRetreat();
		setInternalState( state , "GC_WRW_CHANGE_POSTURE_TO_RETREAT" );
	break;

	case GC_WRW_ADVANCE:
		setupStateAdvance();
		setInternalState( state , "GC_WRW_ADVANCE" );
	break;

	case GC_WRW_ADVANCE_FIRING:
		setupStateAdvanceFiring();
		setInternalState( state , "GC_WRW_ADVANCE_FIRING" );
	break;

	case GC_WRW_RETREAT:
		setupStateRetreat();
		setInternalState( state , "GC_WRW_RETREAT" );
	break;

	case GC_WRW_RETREAT_FIRING:
		setupStateRetreatFiring();
		setInternalState( state , "GC_WRW_RETREAT_FIRING" );
	break;

	case GC_WRW_STRAFE:
		setupStateStrafe();
		setInternalState( state , "GC_WRW_STRAFE" );
	break;

	case GC_WRW_CHANGE_POSTURE_DUCK:
		setupStateChangePostureDuck();
		setInternalState( state , "GC_WRW_CHANGE_POSTURE_DUCK" );
	break;

	case GC_WRW_DUCKED:
		setupStateDucked();
		setInternalState( state , "GC_WRW_DUCKED" );
	break;

	case GC_WRW_DUCKED_FIRING:
		setupStateDuckedFiring();
		setInternalState( state , "GC_WRW_DUCKED_FIRING" );
	break;

	case GC_WRW_CHANGE_POSTURE_STAND:
		setupStateChangePostureStand();
		setInternalState( state , "GC_WRW_CHANGE_POSTURE_STAND" );
	break;

	case GC_WRW_STAND:
		setupStateStand();
		setInternalState( state , "GC_WRW_STAND" );
	break;

	case GC_WRW_STAND_FIRING:
		setupStateStandFiring();
		setInternalState( state , "GC_WRW_STAND_FIRING" );
	break;

	case GC_WRW_FAILED:
		setInternalState( state , "GC_WRW_FAILED" );
	break;
	}
	
}
/*
 *  ======== SMGRMP_create ========
 */
SMGRMP_Handle SMGRMP_create(SMGRMP_Attrs *attrs)
{
    SMGRMP_Obj         *handle;
    Int             shmId = -1;
    unsigned int    shmSize = 0;
    Void            * addr;
    SMGR_Attrs       smgrAttrs;

    /* Create a shared memory object SMGRMP_Obj using the key and the lock 
    Size of this will depend numResources and SMGR_Obj etc  */
   
    GT_assert(CURTRACE, shmCount < SMGRMP_MAXINSTANCES); 

    shmSize = sizeof(SMGRMP_Obj) + sizeof(SMGR_Obj) + sizeof(UInt32); 
    shmSize = ALIGN32(shmSize);
    shmSize += (sizeof(SMGR_Counter) * attrs->numResources);
    shmSize = ALIGN32(shmSize);

#ifdef xdc_target__os_Linux
    addr = SHM_getObj(attrs->lock, shmSize, (key_t)attrs->key, 
            (SHM_InitFxn)&setInternalState, &shmId);
#else
    addr = (void *)malloc(shmSize);
    setInternalState(addr);
    shmId = 0;
#endif

    if (shmId != -1) {

       handle = (SMGRMP_Obj *)addr;

        /* This will return a unique object for each key, and the same object
           for different processes */
        if (0 == handle->refCount) {

            /* SMGR_create has to happen */ 
            smgrAttrs.segid = shmCount;          /* Use shmCount as segId */ 
            smgrAttrs.numResources = attrs->numResources;
            smgrAttrs.numScratchGroups = attrs->numScratchGroups;
            smgrAttrs.allocFxn = shmAlloc;
            smgrAttrs.freeFxn = shmFree;

            /* Store the shmCount in the  SHM_Obj part of the handle */
            handle->shmCount = shmCount;
            shmCount++;
            shmTotal++;
        }
        /* Successful acquisition of shared Mem object, so store in array
           for use by alloc/free functions */ 
        shmAddrs[handle->shmCount] = (unsigned int)addr;
        shmIndex[handle->shmCount] = sizeof(SMGRMP_Obj); /* Change this to 
                                                            work for the alloFxn
                                                          */
        if (handle->refCount == 0) {

            /* Whatever the SMGR_create returns, store that as an offset from 
               shmBase */
            handle->smgrOffset = OFFSET(handle, SMGR_create(&smgrAttrs));
        }

        handle->refCount++;
        /* Store the sharedMemId in the SMGRMP_Obj */ 
        handle->sharedMemId = shmId;
        return (handle);
    }
    else {
        return (NULL);
    }
}