Esempio n. 1
0
void Clock::rebuild()
{
	Element* ticke = Id( 2 )();
	for ( unsigned int i = 0; i < Tick::maxTicks; ++i ) {
		ticks_[i].setIndex( i );
		ticks_[i].setElement( ticke );
	}

	tickPtr_.clear();
	tickMgr_.clear();
	for( unsigned int i = 0; i < ticks_.size(); ++i ) {
		addTick( &( ticks_[i] ) ); // This fills in only ticks that are used
	}
	if ( tickPtr_.size() == 0 ) { // Nothing happening in any of the ticks.
		isDirty_ = false;
		return;
	}

	// Here we put in current time so we can resume after changing a 
	// dt. Given that we are rebuilding and cannot
	// assume anything about prior dt, we do the simple thing and put
	// all the tickMgrs at the current time.
	for( vector< TickMgr >::iterator i = tickMgr_.begin(); 
		i != tickMgr_.end(); ++i ) {
		i->setNextTime( currentTime_ + i->getDt() );
	}

	sort( tickPtr_.begin(), tickPtr_.end() );
	dt_ = tickPtr_[0].mgr()->getDt();

	isDirty_ = false;
}
Esempio n. 2
0
void
RemapHistogramLine::addTick(float frc)
{
  float d = m_tickMaxKey-m_tickMinKey;
  uint tk = m_tickMinKey + d*frc;

  if (m_ticksOriginal.contains(tk))
    {
      QMessageBox::information(0, "Error",
			       "A marker already exists at this place");
      return;
    }

  QList<uint> keys = m_ticks.keys();
  if (tk <= keys[0] ||
      tk >= keys[keys.size()-1])
    {
      QMessageBox::information(0, "Error",
			       "Cannot add point beyond the ends");
      return;
    }
  
  
  // add the tick
  m_ticks[tk] = tk;
  m_ticksOriginal[tk] = tk;
  m_activeTick = tk;

  int tkn = -1;
  // now get the previous tick and relative proportions
  for(int k=0; k<keys.size(); k++)
    {
      if (keys[k] < tk)
	tkn = k;
      else
	break;
    }
  int tickNumber = tkn+1;

  emit addTick(tickNumber);
}
Esempio n. 3
0
/*
** ===================================================================
**     Event       :  TI1_OnInterrupt (module Events)
**
**     Component   :  TI1 [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void TI1_OnInterrupt(void)
{
  /**Just used for time-stamping*/
	addTick();
}