当前位置: 首页>>代码示例>>C++>>正文


C++ getState函数代码示例

本文整理汇总了C++中getState函数的典型用法代码示例。如果您正苦于以下问题:C++ getState函数的具体用法?C++ getState怎么用?C++ getState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getState

/********************************************************************

  Declaration:  
  Call: 
  Input:
  Returns:
  	  
*********************************************************************/ 
void CommPort::SetByteSize(const DataBits nDataBits)
{
  getState();// GetCommState(m_hCom, &m_dcb);
	m_dcb.ByteSize = nDataBits;
  setState();// SetCommState(m_hCom, &m_dcb); 
}
开发者ID:MakSim345,项目名称:MS-VC08,代码行数:14,代码来源:commport.cpp

示例2: isDead

bool Creep::isDead()
{
    return FlagUtil::isFlagSet(getState(), SET_TO_REMOVE) || FlagUtil::isFlagSet(getState(), DEAD) || FlagUtil::isFlagSet(getState(), DEPLOYING) || FlagUtil::isFlagSet(getState(), GOAL_REACHED);
}
开发者ID:bradparks,项目名称:insectoid-defense,代码行数:4,代码来源:Creep.cpp

示例3: getState

void Animation::logic(){
    if (getState().position < frames.size()){
        if (frames[getState().position]->time != -1){
            getState().ticks += 1;
            if (getState().ticks >= frames[getState().position]->time){
                getState().ticks = 0;
                getState().virtual_ticks = 0;
                if (getState().position < frames.size() - 1){
                    getState().position += 1;
                } else {
		    if (!playOnce){
			getState().position = loopPosition;
                        getState().looped = true;
		    }
                }
            }
        } else {
            getState().virtual_ticks += 1;
        }
    }
}
开发者ID:marstau,项目名称:shinsango,代码行数:21,代码来源:mugen_animation.cpp

示例4: getBER

int eDVBFrontendStatus::getBER() const
{
	if (!frontend || getState() == iDVBFrontend_ENUMS::stateTuning) return 0;
	return frontend->readFrontendData(iFrontendInformation_ENUMS::bitErrorRate);
}
开发者ID:christophecvr,项目名称:enigma2,代码行数:5,代码来源:frontendparms.cpp

示例5: Gen

    Gen()
    {
        getState().copy(State);

        pure_init();
    }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:6,代码来源:test0022.MersenneTwister.cpp

示例6: getState

ompl::control::ProductGraph::State *ompl::control::ProductGraph::getState(const State *parent,
                                                                          const base::State *cs) const
{
    return getState(parent, decomp_->locateRegion(cs));
}
开发者ID:ompl,项目名称:ompl,代码行数:5,代码来源:ProductGraph.cpp

示例7: getState

_string CWebUser::getName() const
{
	_string ret = getState(STATE_NAME);
	return ret.empty() ? guestName : ret;
}
开发者ID:djvibegga,项目名称:yii-cws,代码行数:5,代码来源:CWebUser.cpp

示例8: getConnector

int ProxyConn::processResp()
{
    HttpExtConnector *pHEC = getConnector();
    if (!pHEC)
    {
        errno = ECONNRESET;
        return LS_FAIL;
    }
    int len = 0;
    int ret = 0;
    int &respState = pHEC->getRespState();
    if (!(respState & 0xff))
    {
        char *p = HttpResourceManager::getGlobalBuf();
        const char *pBuf = p;
        if (m_iSsl)
            len = m_ssl.read(p, 1460);
        else
            len = ExtConn::read(p, 1460);

        if (len > 0)
        {
            int copy = len;
            if (m_iRespHeaderRecv + copy > 4095)
                copy = 4095 - m_iRespHeaderRecv;
            //memmove( &m_achRespBuf[ m_iRespHeaderRecv ], pBuf, copy );
            m_iRespHeaderRecv += copy;
            m_iRespRecv += len;
            LS_DBG_L(this, "Read Response %d bytes", len);
            //debug code
            //::write( 1, pBuf, len );

            ret = pHEC->parseHeader(pBuf, len, 1);
            switch (ret)
            {
            case -2:
                LS_WARN(this, "Invalid Http response header, retry!");
                //debug code
                //::write( 1, pBuf, len );
                errno = ECONNRESET;
            case -1:
                return LS_FAIL;
            }
        }
        else
            return len;
        if (respState & 0xff)
        {
            //debug code
            //::write(1, HttpResourceManager::getGlobalBuf(),
            //        pBuf - HttpResourceManager::getGlobalBuf() );
            HttpReq *pReq = pHEC->getHttpSession()->getReq();
            if (pReq->noRespBody())
            {
                incReqProcessed();
                if (len > 0)
                    abort();
                else if (respState & HEC_RESP_CONN_CLOSE)
                    setState(CLOSING);
                else if (getState() == ABORT)
                    setState(PROCESSING);

                setInProcess(0);
                pHEC->endResponse(0, 0);
                return 0;
            }

            m_iRespBodySize = pHEC->getHttpSession()->getResp()->getContentLen();
            LS_DBG_L(this, "Response body size of proxy reply is %d",
                     m_iRespBodySize);
            if (m_iRespBodySize == LSI_RSP_BODY_SIZE_CHUNKED)
                setupChunkIS();
            else if (!(respState & HEC_RESP_CONT_LEN))
                m_iRespBodySize = INT_MAX;

            m_pBufBegin = pBuf;
            m_pBufEnd = pBuf + len;
            LS_DBG_M(this, "Process Response body %d bytes", len);
            return readRespBody();
        }
    }
    else
        return readRespBody();
    return 0;
}
开发者ID:52M,项目名称:openlitespeed,代码行数:85,代码来源:proxyconn.cpp

示例9: assert

c_WaitableWaitHandle* c_GenMapWaitHandle::getChild() {
  assert(getState() == STATE_BLOCKED);
  return static_cast<c_WaitableWaitHandle*>(
      m_deps->iter_value(m_iterPos)->m_data.pobj);
}
开发者ID:hardfight,项目名称:hhvm,代码行数:5,代码来源:gen_map_wait_handle.cpp

示例10: loop

void loop(){
    api.getMyZRState(me);
    game.getItemLoc(target, 0);
    
    state = getState(target, me);
    
    switch (state) {
        case SPS:
            switch (game.getNumSPSHeld()) {
                case 3:
                    game.dropSPS();
                    origin[0] = 0.5f;
                    origin[1] = 0.0f;
                    origin[2] = 0.0f;
                    break;
                case 2:
                    api.setPositionTarget(origin);
                    if (distance(origin, me) <= .05) {
                        game.dropSPS();
                        
                        origin[0] = 0.0f;
                        origin[1] = 0.68f;
                        origin[2] = 0.0f;
                    }
                    
                    
                    break;
                case 1:
                    api.setPositionTarget(origin);
                    if (distance(origin, me) <= .05) game.dropSPS();
                    
                    break;
            }
            
            break;
        case GET_ITEM:
            //Find vector between bot and item
            mathVecSubtract(holder, target, me, 3);
            
            //magnitude of previous vector
            mag = mathVecMagnitude(holder, 3);
            
            //Face towards the item
            api.setAttitudeTarget(holder);
            
            //DEBUG(("Dist: %f", distance(target, me)));
            DEBUG(("Dist: %f", mag));
            
            //Scale down the vector so the endpoint is .170 units away from the item
            //scaleVect(holder, mag, 0.170f);
            //adjustGoal(holder, 0.170f);
            adjustGoal(target, 0.170f);
            
            //If in proximity
            /*if (mag <= .17 && mag >= .15) {
                DEBUG(("Stay"));
                api.setPositionTarget(me);
                game.dockItem();
            }*/
            if (distance(target, me) <= .17 && distance(target, me) >= .15) {
                DEBUG(("Stay"));
                DEBUG(("Close: %f", mag));
                api.setPositionTarget(me);
                game.dockItem();
            }
            //else if (mag <= .2 && mag > .17) {
                //api.setPositionTarget(target);
            //}
            else {
                //Full speed ahead
                //api.setVelocityTarget(holder);
                moveTo(holder);
            }
            
            break;
        case STAY:
            DEBUG(("Staying"));
            api.setPositionTarget(me);
            break;
        case FIND_ASSEMBLY:
            DEBUG(("Find Assembly"));
            
            //if (isFound) {
                if (game.getZone(myZone)) {
                    DEBUG(("%f, %f, %f, %f", myZone[0], myZone[1], myZone[2], myZone[3]));
                }
                
                mathVecSubtract(holder, me, myZone, 3);
                //isFound = false;
            //}
            
            //move to and point to the estimated zone
            api.setPositionTarget(myZone);
            scaleVect(holder, 1.0f, -1.0f);
            api.setAttitudeTarget(holder);
            
            if (mathVecMagnitude(holder, 3) <= .17) {
                DEBUG(("Gottem"));
                api.setPositionTarget(me);
                game.dropItem();
//.........这里部分代码省略.........
开发者ID:wertylop5,项目名称:Zero-Robotics,代码行数:101,代码来源:SPSgen.cpp

示例11: setState

void BooleanPropertyComponent::buttonClicked (Button*)
{
    setState (! getState());
}
开发者ID:AGenews,项目名称:GUI,代码行数:4,代码来源:juce_BooleanPropertyComponent.cpp

示例12: refresh

void BooleanPropertyComponent::refresh()
{
    button.setToggleState (getState(), false);
    button.setButtonText (button.getToggleState() ? onText : offText);
}
开发者ID:AGenews,项目名称:GUI,代码行数:5,代码来源:juce_BooleanPropertyComponent.cpp

示例13: shiftCube

void cube::shiftCube( char direction, bool orientation )
{
	/*
	 * shifts the contents of the cube in the given direction. out-of-bound locations
	 * will be ignored and set to 'off'
	 */
	cube *tmpCube = new cube;
	tmpCube->allOff();
	signed short int modifier;
	if(orientation == 1)
	{
		modifier = 1;
	}
	else
	{
		 modifier = -1;
	}
	byte t_x, t_y, t_z;
	for(byte i_x = 1; i_x <= 4; i_x++ )
	{
		for(byte i_y = 1; i_y <= 4; i_y++ )
		{
			for(byte i_z = 1; i_z <= 4; i_z++ )
			{
				if( getState( i_x, i_y, i_z ) == 1 )
				{
					switch(direction)
					{
					case 'x':
						t_x = i_x + modifier;
						if( t_x <= 0 || t_x > 4 ){
							continue;
						}
						t_y = i_y;
						t_z = i_z;
						break;
					case 'y':
						t_x = i_x;
						t_y = i_y + modifier;
						if( t_y <= 0 || t_y > 4 ){
							continue;
						}
						t_z = i_z;
						break;
					case 'z':
						t_x = i_x;
						t_y = i_y;
						t_z = i_z + modifier;
						if( t_z <= 0 || t_z > 4 ){
							continue;
						}
						break;
					default:
						continue;
						break;
					}
					tmpCube->setState( t_x, t_y, t_z, 1 );
				}
			}
		}
	}
	importData( tmpCube->_cube_state );
	delete tmpCube;
}
开发者ID:kristianhentschel,项目名称:arduino-led-cube-and-matrix,代码行数:64,代码来源:cube.cpp

示例14: get

void ompl::control::ProductGraph::buildGraph(State *start, const std::function<void(State *)> &initialize)
{
    graph_.clear();
    solutionStates_.clear();
    std::queue<State *> q;
    std::unordered_set<State *> processed;
    std::vector<int> regNeighbors;
    VertexIndexMap index = get(boost::vertex_index, graph_);

    GraphType::vertex_descriptor next = boost::add_vertex(graph_);
    startState_ = start;
    graph_[boost::vertex(next, graph_)] = startState_;
    stateToIndex_[startState_] = index[next];
    q.push(startState_);
    processed.insert(startState_);

    OMPL_INFORM("Building graph from start state (%u,%u,%u) with index %d", startState_->decompRegion,
                startState_->cosafeState, startState_->safeState, stateToIndex_[startState_]);

    while (!q.empty())
    {
        State *current = q.front();
        // Initialize each state using the supplied state initializer function
        initialize(current);
        q.pop();

        if (safety_->isAccepting(current->safeState) && cosafety_->isAccepting(current->cosafeState))
        {
            solutionStates_.push_back(current);
        }

        GraphType::vertex_descriptor v = boost::vertex(stateToIndex_[current], graph_);

        // enqueue each neighbor of current
        decomp_->getNeighbors(current->decompRegion, regNeighbors);
        for (const auto &r : regNeighbors)
        {
            State *nextState = getState(current, r);
            if (!nextState->isValid())
                continue;
            // if this state is newly discovered,
            // then we can dynamically allocate a copy of it
            // and add the new pointer to the graph.
            // either way, we need the pointer
            if (processed.find(nextState) == processed.end())
            {
                const GraphType::vertex_descriptor next = boost::add_vertex(graph_);
                stateToIndex_[nextState] = index[next];
                graph_[boost::vertex(next, graph_)] = nextState;
                q.push(nextState);
                processed.insert(nextState);
            }

            // whether or not the neighbor is newly discovered,
            // we still need to add the edge to the graph
            GraphType::edge_descriptor edge;
            bool ignore;
            boost::tie(edge, ignore) = boost::add_edge(v, boost::vertex(stateToIndex_[nextState], graph_), graph_);
            // graph_[edge].src = index[v];
            // graph_[edge].dest = stateToIndex_[nextState];
        }
        regNeighbors.clear();
    }
    if (solutionStates_.empty())
    {
        OMPL_ERROR("No solution path found in product graph.");
    }

    OMPL_INFORM("Number of decomposition regions: %u", decomp_->getNumRegions());
    OMPL_INFORM("Number of cosafety automaton states: %u", cosafety_->numStates());
    OMPL_INFORM("Number of safety automaton states: %u", safety_->numStates());
    OMPL_INFORM("Number of high-level states in abstraction graph: %u", boost::num_vertices(graph_));
}
开发者ID:ompl,项目名称:ompl,代码行数:73,代码来源:ProductGraph.cpp

示例15: actOnReceive

void EspNewIncomingConnectionStream::actOnReceive(IpcConnection *connection)
{
  // check for OS errors
  if (getState() == ERROR_STATE)
  {
    ex_assert(FALSE,"Error while receiving first message from client");
  }

  // check for protocol errors
  bool willPassTheAssertion = 
             (getType() == IPC_MSG_SQLESP_DATA_REQUEST OR
              getType() == IPC_MSG_SQLESP_CANCEL_REQUEST) AND
              getVersion() == CurrEspRequestMessageVersion AND
              moreObjects();
  if (!willPassTheAssertion)
  {
    char *doCatchBugCRx = getenv("ESP_BUGCATCHER_CR_NONUMBER");
    if (!doCatchBugCRx ||
        *doCatchBugCRx != '0')
    {
      connection->dumpAndStopOtherEnd(true, false);
      environment_->getControlConnection()->
        castToGuaReceiveControlConnection()->
        getConnection()->dumpAndStopOtherEnd(true, false);
    }
  }

  ex_assert((getType() == IPC_MSG_SQLESP_DATA_REQUEST OR
             getType() == IPC_MSG_SQLESP_CANCEL_REQUEST) AND
	    getVersion() == CurrEspRequestMessageVersion AND
	    moreObjects(),
	    "Invalid first message from client");

  // take a look at the type of the first object in the message
  IpcMessageObjType nextObjType = getNextObjType();
  switch (nextObjType)
  {
    case ESP_OPEN_HDR:
    case ESP_LATE_CANCEL_HDR:
      {
        ExFragKey key;
        Lng32 remoteInstNum;
        NABoolean isParallelExtract = false; 

        // peek at the message header to see for whom it is
        if (nextObjType == ESP_OPEN_HDR)
        {
          ExEspOpenReqHeader reqHdr((NAMemory *) NULL);
	   
	  *this >> reqHdr;
	  key = reqHdr.key_;
	  remoteInstNum = reqHdr.myInstanceNum_;
	  if (reqHdr.getOpenType() == ExEspOpenReqHeader::PARALLEL_EXTRACT) 
          {
            isParallelExtract = true;
	  }
	}
        else
	{
          // note that the late cancel request may or may not
	  // arrive as the first request (only in the former case
	  // will we reach here)
	  ExEspLateCancelReqHeader reqHdr((NAMemory *) NULL);
	   
	  *this >> reqHdr;
	  key = reqHdr.key_;
	  remoteInstNum = reqHdr.myInstanceNum_;
	}

        if (!isParallelExtract) 
        {
          ExFragInstanceHandle handle =
	    espFragInstanceDir_->findHandle(key);

	  if (handle != NullFragInstanceHandle)
	  {
            // the send bottom node # myInstanceNum of this downloaded fragment
            // is the true recipient of this open request
            ex_split_bottom_tcb * receivingTcb =
              espFragInstanceDir_->getTopTcb(handle);
            ex_send_bottom_tcb *receivingSendTcb =
              receivingTcb->getSendNode(remoteInstNum);

            // Check the connection for a co-located client, and if so,
            // tell the split bottom, because it may prefer this send 
            // bottom when using skew buster uniform distribution.
            if (espFragInstanceDir_->
                  getEnvironment()->
                  getMyOwnProcessId(IPC_DOM_GUA_PHANDLE).match(
                    connection->getOtherEnd().getNodeName(),
                    connection->getOtherEnd().getCpuNum()))
              receivingTcb->setLocalSendBottom(remoteInstNum);

            // Portability note for the code above: we pass IPC_DOM_GUA_PHANDLE
            // for IpcEnvironment::getMyOwnProcessId, even though that method
            // can be called with the default param (IpcNetworkDomain 
            // IPC_DOM_INVALID).  In fact it would  probably be better 
            // to call the object without specifying the IpcNetworkDomain so
            // that it can decide for itself what domain it is using.
            // But there is a problem with the Windows implementation
//.........这里部分代码省略.........
开发者ID:alchen99,项目名称:incubator-trafodion,代码行数:101,代码来源:ex_esp_main.cpp


注:本文中的getState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。