time::size_type time::seconds_from_midnight() const
    {
        if (*this == uninitialized())
            BOOST_THROW_EXCEPTION(std::logic_error("The time object is uninitialized."));

        return m_seconds_from_midnight;
    }
    time::hours_minutes_seconds_type time::hours_minutes_seconds() const
    {
        if (*this == uninitialized())
            BOOST_THROW_EXCEPTION(std::logic_error("The time object is uninitialized."));

        const size_type hours = m_seconds_from_midnight / (60 * 60);
        const size_type minutes = m_seconds_from_midnight / 60 - hours * 60;
        const size_type seconds = m_seconds_from_midnight - hours * 60 * 60 - minutes * 60;

        return hours_minutes_seconds_type{ hours, minutes, seconds };
    }
Esempio n. 3
0
void WorkerDataArray<T>::verify(uint active_threads) const {
  if (!_enabled) {
    return;
  }

  assert(active_threads <= _length, "Wrong number of active threads");
  for (uint i = 0; i < active_threads; i++) {
    assert(_data[i] != uninitialized(),
           "Invalid data for worker %u in '%s'", i, _title);
  }
  if (_thread_work_items != NULL) {
    _thread_work_items->verify(active_threads);
  }
}
Esempio n. 4
0
void Container::load(QXmlStreamReader &stream)
{
	Option *option;
	List::Container uninitialized(m_items);

	while (readNextStartElement(stream))
		if (option = uninitialized.value(stream.name()))
		{
			option->load(stream);
			uninitialized.remove(&option->id());
		}

	for (List::Container::const_iterator i = uninitialized.constBegin(), end = uninitialized.constEnd(); i != end; ++i)
		(*i)->loadDefault();
}
    time& time::operator+=(const time_span_type& time_span)
    {
        if (*this == uninitialized())
            return *this;

        typename time_span_type::difference_type seconds = m_seconds_from_midnight;
        while (seconds < -time_span.seconds())
            seconds += time_span_type::seconds_of_whole_day();
        seconds += time_span.seconds();
        seconds %= time_span_type::seconds_of_whole_day();
        assert(0 <= seconds && seconds < time_span_type::seconds_of_whole_day());

        time temp{ static_cast<size_type>(seconds) };
        boost::swap(temp, *this);
        return *this;
    }
void TrackingSystemIGSTKService::initializedSlot(bool value)
{
	if (value)
	{
		mState = Tool::tsINITIALIZED;
		reportSuccess("IGSTK Tracking Service is initialized.");
		emit stateChanged();
		emit initialized();
	}
	else
	{
		mState = Tool::tsCONFIGURED;
		report("IGSTK Tracking Service is uninitialized.");
		emit stateChanged();
		emit uninitialized();
	}
}
void TrackingSystemIGSTKService::deconfigure()
{
	if (!this->isConfigured())
		return;

	if (this->isInitialized())
	{
		connect(this, SIGNAL(uninitialized()), this, SLOT(deconfigureAfterUninitializedSlot()));
		this->uninitialize();
		return;
	}
	mTools.clear();

	this->destroyTrackerThread();

//	this->setActiveTool(this->getManualTool()->getUid());

	mState = Tool::tsNONE;
	emit deconfigured();
	emit stateChanged();
	report("IGSTK Tracking Service is deconfigured.");
}
 bool time::initialized() const
 {
     return *this != uninitialized();
 }
Esempio n. 9
0
Expr room() {
    return room( uninitialized() );
}
Esempio n. 10
0
void WorkerDataArray<T>::add(uint worker_i, T value) {
  assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  assert(_data[worker_i] != uninitialized(), "No data to add to for worker %d", worker_i);
  _data[worker_i] += value;
}
Esempio n. 11
0
T WorkerDataArray<T>::get(uint worker_i) const {
  assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  assert(_data[worker_i] != uninitialized(), "No data added for worker %d", worker_i);
  return _data[worker_i];
}
Esempio n. 12
0
void WorkerDataArray<T>::set(uint worker_i, T value) {
  assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  assert(_data[worker_i] == uninitialized(), "Overwriting data for worker %d in %s", worker_i, _title);
  _data[worker_i] = value;
}
Esempio n. 13
0
void WorkerDataArray<T>::reset() {
  set_all(uninitialized());
  if (_thread_work_items != NULL) {
    _thread_work_items->reset();
  }
}
void TrackingSystemIGSTKService::deconfigureAfterUninitializedSlot()
{
	disconnect(this, SIGNAL(uninitialized()), this, SLOT(deconfigureAfterUninitializedSlot()));
	this->deconfigure();
}