Facade::Facade(std::string const& key)
    : _controller(NULL)
    , _model(NULL)
    , _view(NULL)
{
    if (puremvc_facade_instance_map.find(key))
        throw std::runtime_error(MULTITON_MSG);
    initializeNotifier(key);
    puremvc_facade_instance_map.insert(key, this);
    initializeFacade();
}
Example #2
0
/**
 * Create a Notifier for timer event notification.
 * @param handler The handler is called at the notification time which is set
 * using StartSingle or StartPeriodic.
 */
Notifier::Notifier(TimerEventHandler handler, void *param) {
  if (handler == nullptr)
    wpi_setWPIErrorWithContext(NullParameter, "handler must not be nullptr");
  m_handler = handler;
  m_param = param;
  // do the first time intialization of static variables
  if (refcount.fetch_add(1) == 0) {
    int32_t status = 0;
    {
      std::lock_guard<priority_mutex> sync(halMutex);
      if (!m_notifier)
        m_notifier = initializeNotifier(ProcessQueue, nullptr, &status);
    }
    wpi_setErrorWithContext(status, getHALErrorMessage(status));
  }
}
Example #3
0
/**
 * Create a Notifier for timer event notification.
 * @param handler The handler is called at the notification time which is set
 * using StartSingle or StartPeriodic.
 */
Notifier::Notifier(TimerEventHandler handler, void *param)
{
	if (handler == NULL)
		wpi_setWPIErrorWithContext(NullParameter, "handler must not be NULL");
	m_handler = handler;
	m_param = param;
	m_periodic = false;
	m_expirationTime = 0;
	m_period = 0;
	m_nextEvent = NULL;
	m_queued = false;
	m_handlerSemaphore = initializeSemaphore(SEMAPHORE_FULL);
	{
		::std::unique_lock<ReentrantMutex> sync(queueSemaphore);
		// do the first time intialization of static variables
		if (refcount == 0)
		{
			int32_t status = 0;
			m_notifier = initializeNotifier(ProcessQueue, &status);
			wpi_setErrorWithContext(status, getHALErrorMessage(status));
		}
		refcount++;
	}
}