Beispiel #1
0
void Observable::RegisterObserver(Observer *obs)
{
  CSingleLock lock(m_obsCritSection);
  if (!IsObserving(*obs))
  {
    m_observers.push_back(obs);
  }
}
// ---------------------------------------------------------------------------
// CAccMonitor::StartObserving
// 
// Start Observing, other items commented in header file.
// ---------------------------------------------------------------------------
void CAccMonitorImpl::StartObservingL(
    MAccMonitorObserver* aObserver )
    {
    COM_TRACE_( "[AccFW:AccMonitor] CAccMonitorImpl::StartObservingL() - All Accessory connections" );
    
    TBool val = IsObserving();
    if( val )
        {
        User::Leave( KErrAlreadyExists );
        }
    else
        {
        iContainer->StartObservingL( aObserver );
        }
    
    COM_TRACE_( "[AccFW:AccMonitor] CAccMonitorImpl::StartObservingL() - All Accessory connections - return" );
    }
Beispiel #3
0
void Registry::Delete(Handle handle)
{
#ifdef KAI_USE_TRICOLOR
	// use Object::Delete
	(void)handle;
	throw;
#else

#ifdef KAI_DEBUG
	if (IsObserving(handle))
	{
		KAI_TRACE() << handle;
	}
#endif
	// if unknown handle, do nothing
	Instances::const_iterator instance = instances.find(handle);
	if (instance == instances.end())
		return;		

	// detach from parent
	if (instance->second)
	{
		StorageBase &storage = *instance->second;
		storage.SetColor(ObjectColor::White);
		storage.SetColorRecursive(ObjectColor::White);
		storage.GetClass()->Destroy(storage);
		//Detach(storage);
	}

	// remove from list of retained objects
	auto etained = retained_objects.find(handle);
	if (retained != retained_objects.end())
		retained_objects.erase(retained);

	// mark for pending collection
#ifndef KAI_USE_TRICOLOR
	deathrow.insert(handle);
#endif
#endif
}