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


C++ Transition类代码示例

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


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

示例1: Q_ASSERT

void PropertyEditor::Private::setTargetState(const QString &label)
{
    Transition* transition = current<Transition>();
    Q_ASSERT(transition);
    if (transition) {
        State *targetState = ElementUtil::findState(transition->sourceState()->machine(), label);
        if (transition->targetState() != targetState) {
            ModifyTransitionCommand *command = new ModifyTransitionCommand(transition);
            command->setTargetState(targetState);
            m_commandController->undoStack()->push(command);
        }
    }
}
开发者ID:hermixy,项目名称:KDStateMachineEditor,代码行数:13,代码来源:propertyeditor.cpp

示例2: getTransitionLocally

	Transition* TransitionBase::getTransitionLocally(string transitionId) {
		vector<Transition*>::iterator i;
		Transition* transition;

		i = transitionSet->begin();
		while (i != transitionSet->end()) {
			transition = *i;
			if (transition->getId() == transitionId) {
				return transition;
			}
			++i;
		}
		return NULL;
	}
开发者ID:Gingar,项目名称:port,代码行数:14,代码来源:TransitionBase.cpp

示例3: process_messages

void Thread::run_one_step()
{
	process_messages();
	Net *net = process->get_net();
	if (net == NULL) {
		return;
	}
	Transition *tr = net->pick_active_transition();
	if (tr == NULL) {
		return;
	}
	tr->set_active(false);
	tr->full_fire(this, net);
}
开发者ID:DiPi22,项目名称:kaira,代码行数:14,代码来源:thread.cpp

示例4: time

void Simulation::PrintStatistics()
{
    Log->Write("\nRooms Egress Time:");
    Log->Write("==================");
    Log->Write("id\tcaption\tegress time (s)");

    for (const auto& it:_building->GetAllRooms()) {
        auto&& room = it.second;
        if (room->GetCaption()!="outside")
            Log->Write("%d\t%s\t%.2f", room->GetID(), room->GetCaption().c_str(), room->GetEgressTime());
    }

    Log->Write("\nUsage of Exits");
    Log->Write("==========");
    for (const auto& itr : _building->GetAllTransitions()) {
        Transition* goal = itr.second;
        if (goal->GetDoorUsage()) {
            Log->Write(
                    "\nExit ID [%d] used by [%d] pedestrians. Last passing time [%0.2f] s",
                    goal->GetID(), goal->GetDoorUsage(),
                    goal->GetLastPassingTime());

            string statsfile = _config->GetTrajectoriesFile()+"_flow_exit_id_"+to_string(goal->GetID())+".dat";
            Log->Write("More Information in the file: %s", statsfile.c_str());
            auto output = new FileHandler(statsfile.c_str());
            output->Write("#Flow at exit "+goal->GetCaption()+"( ID "+to_string(goal->GetID())+" )");
            output->Write("#Time (s)  cummulative number of agents \n");
            output->Write(goal->GetFlowCurve());
        }
    }
    Log->Write("\n");
}
开发者ID:JuPedSim,项目名称:jpscore,代码行数:32,代码来源:Simulation.cpp

示例5: transit

// Consider merging this funciton with nullInputTransit()
int Fsm::transit(MessageTuple* inMsg, vector<MessageTuple*>& outMsgs, bool& high_prob, int startIdx )
{
    State* cs = _states[_current];
    outMsgs.clear();

    // Go through the possible transitions, find that matches the message
    for( int tid = startIdx ; tid < cs->getNumTrans(); ++tid ) {
        Transition tr = cs->getTrans((int)tid);

        if( tr.getFromMachineId() == inMsg->subjectId() && tr.getInputMessageId() == inMsg->destMsgId() ) {
            // Matching found. Get all the outLabels
            for( size_t oid = 0 ; oid < tr.getNumOutLabels() ; ++oid ) {
                OutLabel lbl = tr.getOutLabel(oid);
                MessageTuple* out = new FsmMessage(tr.getFromMachineId(), lbl.first,
                                tr.getInputMessageId(), lbl.second, _macLookup->toInt(this->_name)) ;
                outMsgs.push_back(out);
            }

            // Change state
            State* next = cs->getNextState((int)tid);
            _current = next->getID();
            
            if( tr.isHigh() )
                high_prob = true;
            else
                high_prob = false;
            
            return tid+1;
        }
    }

    // The function will get to this line when no more matching transition is found
    return -1;
}
开发者ID:skiegyt,项目名称:prob_verify,代码行数:35,代码来源:fsm.cpp

示例6: loop

//Transit from current state
int StateMachine::loop() {
    int current_state = this->current_state();
    for(int i=0; i < stored_transitions; i++) {
		Transition transition = this->transitions[i];
		if(transition.origin == current_state && transition.transition_function()) {
			this->set_current_state(transition.dest);
            current_state = transition.dest;
			return transition.dest;
		}
	}
    if (state_functions[current_state] != 0) {
		state_functions[current_state]();
	}
	return current_state;
}
开发者ID:hithwen,项目名称:statemachine,代码行数:16,代码来源:statemachine.cpp

示例7: addTransition

returnValue ShootingMethod::addTransition( const Transition& transition_ ){

    if( transition_.getNXA() != 0 ) return ACADOERROR( RET_TRANSITION_DEPENDS_ON_ALGEBRAIC_STATES );
    integrator[N-1]->setTransition( transition_ );

    return SUCCESSFUL_RETURN;
}
开发者ID:rtkg,项目名称:acado,代码行数:7,代码来源:shooting_method.cpp

示例8: Transition

void State::add_epsilon(State* dest)
{
        for (size_t i = 0; i < this->transitions.size(); i++) {
                if (this->transitions[i]->get_dest() == dest) {
                        return;
                }
        }

        Transition* t = new Transition(this->location, '\0', this, dest);
        t->set_epsilon(true);

        transitions.push_back(t);
        dest->add_incoming(t);

        return;
}
开发者ID:bemk,项目名称:Automaton,代码行数:16,代码来源:State.cpp

示例9: writeClip

void XMLizer::writeClip( QDomDocument &document, QDomNode &parent, Clip *clip )
{
	QDomElement n1 = document.createElement( "Clip" );
	parent.appendChild( n1 );

	if ( clip->getSpeed() != 1.0 )
		n1.setAttribute( "speed", QString::number( clip->getSpeed(), 'e', 17 ) );
	XMLizer::createText( document, n1, "Name", clip->sourcePath() );
	XMLizer::createDouble( document, n1, "PosInTrack", clip->position() );
	XMLizer::createDouble( document, n1, "StartTime", clip->start() );
	XMLizer::createDouble( document, n1, "Length", clip->length() );
	
	for ( int i = 0; i < clip->videoFilters.count(); ++i )
		XMLizer::writeFilter( document, n1, false, clip->videoFilters.at( i ) );
	
	for ( int i = 0; i < clip->audioFilters.count(); ++i )
		XMLizer::writeFilter( document, n1, true, clip->audioFilters.at( i ) );
	
	Transition *trans = clip->getTransition();
	if ( trans ) {
		QDomElement t = document.createElement( "Transition" );
		n1.appendChild( t );
		
		XMLizer::createDouble( document, t, "PosInTrack", trans->position() );
		XMLizer::createDouble( document, t, "Length", trans->length() );
		if ( !trans->getVideoFilter().isNull() )
			XMLizer::writeFilter( document, t, false, trans->getVideoFilter() );
		if ( !trans->getAudioFilter().isNull() )
			XMLizer::writeFilter( document, t, true, trans->getAudioFilter() );
	}
}
开发者ID:hftom,项目名称:MachinTruc,代码行数:31,代码来源:xmlizer.cpp

示例10: transitionIsCompatible

bool SimulatedState::transitionIsCompatible(const Transition& transition) const
{
	if (_currentState != transition.sourceStateIndex()) {
		return false;
	}

	if (tapes.size() != transition.numberOfTapes()) {
		return false;
	}

	for (int i = 0; i < transition.numberOfTapes(); ++i) {
		if (!transition.isCurrentTapeSymbolForTape(i, characterAtTapehead(i)) && (!_tm->anySymbolSymbolSet() || transition.currentTapeSymbolForTape(i) != _tm->anySymbolSymbol())) {
			return false;
		}
	}

	return true;
}
开发者ID:arminnh,项目名称:universal-turing-machine-simulator,代码行数:18,代码来源:TMSimulatedState.cpp

示例11: start_transition

/**
 * @brief Starts a transition effect on this object.
 *
 * The transition will be automatically deleted when finished or stopped.
 * Any previous transition is stopped.
 *
 * @param transition The transition to start.
 * @param callback_ref A Lua registry ref to the function to call when
 * the transition finishes, or LUA_REFNIL.
 * @param lua_context The Lua world for the callback (or NULL).
 */
void Drawable::start_transition(Transition& transition,
    int callback_ref, LuaContext* lua_context) {

  stop_transition();

  this->transition = &transition;
  this->transition_callback_ref = callback_ref;
  this->lua_context = lua_context;
  transition.start();
}
开发者ID:xor-mind,项目名称:solarus,代码行数:21,代码来源:Drawable.cpp

示例12: IF_DEBUG

void StateMachineViewerWidgetNG::transitionAdded(const TransitionId transitionId, const StateId sourceId, const StateId targetId, const QString& label)
{
  if (m_idToTransitionMap.contains(transitionId))
    return;

  IF_DEBUG(qDebug() << "transitionAdded" << transitionId << label << sourceId << targetId);

  State* source = m_idToStateMap.value(sourceId);
  State* target = m_idToStateMap.value(targetId);
  if (!source || !target) {
    qDebug() << "Null source or target for transition:" <<  transitionId;
    return;
  }

  Transition* transition = new Transition(source);
  transition->setTargetState(target);
  transition->setLabel(label);
  m_idToTransitionMap[transitionId] = transition;
}
开发者ID:dfries,项目名称:GammaRay,代码行数:19,代码来源:statemachineviewerwidgetng.cpp

示例13: updateStateId

void State::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent) {
    if(mouseEvent->button() == Qt::LeftButton && dynamic_cast<GraphGraphicsScene* >(this->scene())->mode() == MODE::DELETE) {
        for(Transition *t : m_transitions) {
            t->removeSelf();

        }
        updateStateId(this->m_id);
        delete this;
    }
    else if(mouseEvent->button() == Qt::LeftButton && dynamic_cast<GraphGraphicsScene* >(this->scene())->mode() == MODE::TRANSITION) {
        Transition *transition = new Transition();
        transition->setFrom(this);
        transition->setTo(this);
        transition->setDrawMode(DRAW_SHAPE::NORMAL);
        transition->setFlag(true);
        this->scene()->addItem(transition);
        this->addTransiton(transition);
        instructionLab->addToInstructionlab(transition);
    }
}
开发者ID:Gandalph,项目名称:rs15-15,代码行数:20,代码来源:state.cpp

示例14:

  //
  // Notification
  //
  void Script::State::Notify(U32 message, U32 data)
  {
    // Ask the action to translate this notification
    if (action)
    {
      U32 translation = action->Notify(message, data);

      // Was the notification ignored ?
      if (translation != Status::Ignored)
      {
        // Find the transition
        Transition *transition = transitions.Find(translation);

        if (transition)
        {
          // Perform the transition
          transition->Perform(GetScript());
        }
      }
    }
  }
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:24,代码来源:strategic_script_state.cpp

示例15: view

/* Name: view
* Purpose: Prints out all of the transitions.
* Operation: This method is used to print out the value of the transition. 
	This is used by class Show_Command though the class Turing_Machine.
*/
void Transition_Function::view() const{

		// Display a empty set if it is empty.
	if (transitions.size() == 0){
		cout << "Delta = {}\n\n";
		return;
	}

	for (unsigned int i = 0; i < transitions.size(); i++){

		Transition Temp = transitions[i];
	
		cout << "Delta("
			<< Temp.Source_State()
			<< ", "
			<< Temp.Read_Character()
			<< ") = ("
			<< Temp.Destination_State()
			<< ", "
			<< Temp.Write_Character()
			<< ", "
			<< Temp.Move_Direction()
			<< ")\n";
	}

	cout << "\n";
}
开发者ID:SkullCrusher,项目名称:Rex-The-Biplane,代码行数:32,代码来源:Transition_Function.cpp


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