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


C++ Alarm类代码示例

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


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

示例1: min

void Clock::AdvanceTime(float deltaSecs)
{
	deltaSecs = min(m_maximumDelta, deltaSecs);
	deltaSecs *= m_timeScale;
	if (m_paused) {
		deltaSecs = 0.f;
	}

	m_currentTime += deltaSecs;
	m_deltaSeconds = deltaSecs;

	for (auto it = m_children.begin(); it != m_children.end(); ++it) {
		Clock* childClock = *it;
		childClock->AdvanceTime(deltaSecs);
	}

	for (auto it = m_alarms.begin(); it != m_alarms.end();) {
		Alarm* alarm = it->second;
		alarm->elapsedTime += deltaSecs;

		if (alarm->elapsedTime >= alarm->timeToFire) {
			it = m_alarms.erase(it);
			alarm->onAlarmFire(alarm->name, alarm->alarmFunctionData);
		}
		else {
			++it;
		}
	}
}
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:29,代码来源:Clock.cpp

示例2: deviceRemoved

void DevicePluginDateTime::deviceRemoved(Device *device)
{
    // check if we still need the timer
    if (myDevices().count() == 0) {
        m_timer->stop();
    }

    // date
    if (device->deviceClassId() == todayDeviceClassId) {
        m_todayDevice = 0;
    }

    // alarm
    if (device->deviceClassId() == alarmDeviceClassId) {
        Alarm *alarm = m_alarms.take(device);
        alarm->deleteLater();
    }

    // countdown
    if (device->deviceClassId() == countdownDeviceClassId) {
        Countdown *countdown = m_countdowns.take(device);
        countdown->deleteLater();
    }

    startMonitoringAutoDevices();
}
开发者ID:tonnenpinguin,项目名称:guh,代码行数:26,代码来源:deviceplugindatetime.cpp

示例3: main

int main(int argc,char *argv[])
{
	QApplication app(argc,argv);
	Alarm alarm;
	alarm.show();
	return app.exec();
};
开发者ID:thddaniel,项目名称:QT,代码行数:7,代码来源:main.cpp

示例4: while

void Clock::AdvanceTime(double deltaTime)
{
	if(m_pause)
		return;

	if(deltaTime > m_maxDeltaTimeStep)
		deltaTime = m_maxDeltaTimeStep;

	std::vector<Clock*>::iterator clock_it = m_childClocks.begin();
	for( ; clock_it != m_childClocks.end(); ++clock_it)
	{
		Clock* currentClock = *clock_it;
		currentClock->AdvanceTime(deltaTime);
	}

	std::vector<Alarm*>::iterator alarm_it = m_alarms.begin();
	while(alarm_it != m_alarms.end())
	{
		Alarm* currentAlarm = *alarm_it;
		currentAlarm->AdvanceTime(deltaTime);
		if(currentAlarm->m_destroy)
		{
			alarm_it = m_alarms.erase(alarm_it);
			delete currentAlarm;
			currentAlarm = nullptr;
		}
		else
			++alarm_it;
	}

	m_currentTimeSeconds += deltaTime * m_timeScale;
	m_lastTimeStep = deltaTime;
}
开发者ID:rex19851031,项目名称:Engine,代码行数:33,代码来源:Clock.cpp

示例5: read_file

int
read_file(std::vector<Alarm> &alarms)
{
	std::vector<std::string> lines;

	if (read_lines(lines) != 0) {
		return -1;
	}

	for (const std::string &str : lines) {
		Alarm alarm;

		if (alarm.read_file_str(str.c_str()) != 0) {
			return -1;
		}

		try {
			alarms.push_back(alarm);
		}
		catch (...) {
			fputs("Error: unable to allocate memory\n", stderr);
			return -1;
		}
	}

	return 0;
}
开发者ID:joeljk13,项目名称:WinAlarm,代码行数:27,代码来源:file.cpp

示例6: get

void PVAlarm::get(Alarm & alarm) const
{
    if(pvSeverity.get()==NULL) {
        throw std::logic_error(notAttached);
    }
    alarm.setSeverity(AlarmSeverityFunc::getSeverity(pvSeverity->get()));
    alarm.setStatus(AlarmStatusFunc::getStatus(pvStatus->get()));
    alarm.setMessage(pvMessage->get());
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:9,代码来源:pvAlarm.cpp

示例7: while

void
Alarm::enable()
{
  Alarm* alarm = (Alarm*) s_queue.get_succ(); 
  while (alarm != (Alarm*) &s_queue) {
    int32_t diff = m_when - alarm->m_when;
    if (diff <= 0) break;
    alarm = (Alarm*) alarm->get_succ();
  }
  alarm->attach(this);
}
开发者ID:epatel,项目名称:Cosa,代码行数:11,代码来源:Alarm.cpp

示例8: UpdateItem

void ConfigurationDialog::UpdateItem(int index)
{
    Alarm *alarm = Alarm::s_Alarms[index];

    m_lAlarms->SetItem(index, ALARM_TYPE, alarm->Type());
    m_lAlarms->SetColumnWidth(ALARM_TYPE, wxLIST_AUTOSIZE);
    m_lAlarms->SetItem(index, ALARM_OPTIONS, alarm->Options());
    m_lAlarms->SetColumnWidth(ALARM_OPTIONS, wxLIST_AUTOSIZE);
    m_lAlarms->SetItem(index, ALARM_ACTION, alarm->Action());
    m_lAlarms->SetColumnWidth(ALARM_ACTION, wxLIST_AUTOSIZE);
}
开发者ID:Hakansv,项目名称:watchdog_pi,代码行数:11,代码来源:ConfigurationDialog.cpp

示例9: UpdateStatus

void WatchdogDialog::UpdateStatus(int index)
{
    Alarm *alarm = Alarm::s_Alarms[index];
    m_lStatus->SetItemImage(index, alarm->m_bEnabled ? 1 : 0);

//    m_lAlarms->SetItem(index, ALARM_ENABLED, alarm->m_bEnabled ? _T("X") : _T(""));
    m_lStatus->SetItem(index, ALARM_TYPE, alarm->Type());
    m_lStatus->SetItem(index, ALARM_STATUS, alarm->GetStatus());
    m_lStatus->SetItemTextColour(index, alarm->m_bFired ? *wxRED: *wxBLACK);
    m_lStatus->SetColumnWidth(ALARM_STATUS, wxLIST_AUTOSIZE);
}
开发者ID:bc38,项目名称:watchdog_pi,代码行数:11,代码来源:WatchdogDialog.cpp

示例10: set

bool PVAlarm::set(Alarm const & alarm)
{
    if(pvSeverity.get()==NULL) {
        throw std::logic_error(notAttached);
    }
    if(pvSeverity->isImmutable() || pvMessage->isImmutable()) return false;
    pvSeverity->put(alarm.getSeverity());
    pvStatus->put(alarm.getStatus());
    pvMessage->put(alarm.getMessage());
    return true;
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:11,代码来源:pvAlarm.cpp

示例11: while

void
Alarm::enable()
{
  // Enqueue the alarm in the schedule queue
  Alarm* alarm = (Alarm*) s_queue.get_succ();
  while (alarm != (Alarm*) &s_queue) {
    int32_t diff = m_when - alarm->m_when;
    if (UNLIKELY(diff <= 0)) break;
    alarm = (Alarm*) alarm->get_succ();
  }
  alarm->attach(this);
}
开发者ID:rrobinet,项目名称:Cosa,代码行数:12,代码来源:Alarm.cpp

示例12: Alarm_process

// It is safe to call this function again from inside a callback function
// that it called. It should not be called from multiple threads at once.
void
Alarm_process(void) {
    AlarmTime now;

    assert(alarmHeap != NULL);

    now = AlarmTime_nowMS();
    while (Heap_hasMore(alarmHeap)) {
        Alarm *alarm = (Alarm *) Heap_first(alarmHeap);

        if (now < alarm->time)
            break;

        Heap_pop(alarmHeap);
        alarm->callback(alarm->arg);
        Alarm_free(alarm);
    }
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例13: decodeText

void KCalResourceSlox::parseIncidenceAttribute( const QDomElement &e,
                                                Incidence *incidence )
{
  QString tag = e.tagName();
  QString text = decodeText( e.text() );
  if ( text.isEmpty() ) return;

  if ( tag == fieldName( IncidenceTitle ) ) {
    incidence->setSummary( text );
  } else if ( e.tagName() == fieldName( Description ) ) {
    incidence->setDescription( text );
  } else if ( tag == fieldName( Reminder ) ) {
    int minutes = text.toInt();
    if ( minutes != 0 ) {
      Alarm::List alarms = incidence->alarms();
      Alarm *alarm;
      if ( alarms.isEmpty() ) alarm = incidence->newAlarm();
      else alarm = alarms.first();
      if ( alarm->type() == Alarm::Invalid ) {
        alarm->setType( Alarm::Display );
      }
      Duration d( minutes * -60 );
      alarm->setStartOffset( d );
      alarm->setEnabled( true );
    } else {
      // 0 reminder -> disable alarm
      incidence->clearAlarms();
    }
  } else if ( tag == fieldName( CreatedBy ) ) {
    KABC::Addressee a;
    if ( mAccounts ) a = mAccounts->lookupUser( text );
    else kDebug() << "KCalResourceSlox: no accounts set";
    incidence->setOrganizer( Person( a.formattedName(), a.preferredEmail() ) );
  } else if ( tag == fieldName( Participants ) ) {
    parseMembersAttribute( e, incidence );
  } else if ( tag == "readrights" ) {
    parseReadRightsAttribute( e, incidence );
  } else if ( tag == fieldName( Categories ) ) {
    incidence->setCategories( text.split( QRegExp(",\\s*") ) );
  } else if ( tag == fieldName( LastModified ) && type() == "ox" ) {
    incidence->setCustomProperty( "SLOX", "LastModified", text );
  }
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:43,代码来源:kcalresourceslox.cpp

示例14: KDateTime

QStringList KOAlarmClient::dumpAlarms()
{
  KDateTime start = KDateTime( QDateTime::currentDateTime().date(),
                               QTime( 0, 0 ), KDateTime::LocalZone );
  KDateTime end = start.addDays( 1 ).addSecs( -1 );

  QStringList lst;
  // Don't translate, this is for debugging purposes.
  lst << QString( "AlarmDeamon::dumpAlarms() from " ) + start.toString() + " to " +
         end.toString();

  QList<Alarm *> alarms = mCalendar->alarms( start, end );
  QList<Alarm *>::ConstIterator it;
  for ( it = alarms.constBegin(); it != alarms.constEnd(); ++it ) {
    Alarm *a = *it;
    lst << QString( "  " ) + a->parent()->summary() + " (" + a->time().toString() + ')';
  }

  return lst;
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:20,代码来源:koalarmclient.cpp

示例15: cancel_sig

void Alarm::cancel_sig(unsigned seconds_left)
{
Alarm	*p;
Alarm	*alarm_chain=0;

	while ((p=first) != 0 && p->set_interval <= seconds_left)
			// Marginal case
	{
		p->Unlink();
		p->next=alarm_chain;
		alarm_chain=p;
	}

	for (p=first; p; p=p->next)
		p->set_interval -= seconds_left;

	while ((p=alarm_chain) != 0)
	{
		alarm_chain=p->next;
		p->handler();
	}
}
开发者ID:debdungeon,项目名称:qint,代码行数:22,代码来源:alarm.C


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