boolean CXMLStimulationScenarioPlayer::processClock(CMessageClock &rMessageClock) { uint64 l_ui64CurrentTime = rMessageClock.getTime(); IDynamicBoxContext * l_pDynamicBoxContext = getBoxAlgorithmContext()->getDynamicBoxContext(); if(!m_bEndOfAutomaton) { //actualize context m_pAutomatonContext->setCurrentTime(rMessageClock.getTime()); for(size_t i=0 ; i<m_oStimulationReceived.size() ; i++) { Automaton::CIdentifier l_oStimulationIdentifier = m_oStimulationReceived[i].first; m_pAutomatonContext->addReceivedEvent(l_oStimulationIdentifier); } //process m_bEndOfAutomaton = m_pAutomatonController->process(); const Automaton::CIdentifier * l_pSentEvents = m_pAutomatonContext->getSentEvents(); //set the number of stimulation to send m_pStimulationOutputWriterHelper->setStimulationCount(m_pAutomatonContext->getSentEventsCount()); //if there were stimulations if(l_pSentEvents) { //adds em for(uint32 i = 0 ; i<m_pAutomatonContext->getSentEventsCount() ; i++) { /* TODO check Stimulation date */ m_pStimulationOutputWriterHelper->setStimulation(i, l_pSentEvents[i], l_ui64CurrentTime); } } m_pStimulationOutputWriterHelper->writeBuffer(*m_pWriter); /* TODO check Stimulation date */ l_pDynamicBoxContext->markOutputAsReadyToSend(0, m_ui64PreviousActivationTime, l_ui64CurrentTime); m_pAutomatonContext->clearSentEvents(); //TODO clear all events?? or just used ones? m_pAutomatonContext->clearReceivedEvents(); } m_ui64PreviousActivationTime = l_ui64CurrentTime; getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess(); return true; }
boolean CBoxAlgorithmClock::processClock(CMessageClock& rMessageClock) { getLogManager() << m_eLogLevel << "Received clock message at time " << time64(rMessageClock.getTime()) << "\n"; getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess(); return true; }
boolean CGenericNetworkAcquisition::processClock(CMessageClock& rMessageClock) { m_ui64CurrentDate=rMessageClock.getTime(); // Checks if connection is correctly established if(!m_pConnectionClient->isConnected()) { // In case it is not, abort return false; } else { // Checks if connection has pending data if(m_pConnectionClient->isReadyToReceive()) { // Data are waiting, mark box algorithm as ready to go :) getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess(); } } return true; }