Exemple #1
0
Boolean IMDB::SetRecord(const String &strRecordName,
                        const Record &recSrc,
                        Boolean bCreate,
                        Boolean bAll)
{
  MapStrRec::iterator iter = m_mpRecords.find(strRecordName);
  if(iter == m_mpRecords.end())
    {
      if(!bCreate) 
      {
      	return FALSE;
      }
      m_mpRecords[strRecordName] = recSrc.Map();			// !!! not right
    }
  else
    {
      MapStringToField &mpDest = iter->second;

      if(bAll)
        {
          Record::const_iterator it = recSrc.begin();
          while(it != recSrc.end()) { mpDest.insert(*it); it++; }
        }
      else
        {
          SetOfStrings::const_iterator itDirty;
          itDirty = recSrc.GetFirstDirty();
          while(itDirty != recSrc.GetLastDirty())
            {
              String str = *itDirty;
              Record::const_iterator itSrcField = recSrc.find(*itDirty);
              if(itSrcField != recSrc.end())
              {
                  mpDest.insert(*itSrcField);
              }
              else
                {
                  MapStringToField::iterator it =
                    mpDest.find(*itDirty);
                  mpDest.erase(it);
                }
              ++itDirty;
            }
        }
    }

  return TRUE;
}
// Use stack tracker to work out what the caller was for ComObject release,
// and tabulate each type of release.
void ProfileD3DResourceRelease( uint64 t )
{
	if ( !g_doProfileD3DResourceRelease )
		return;

	std::string callerName = StackTracker::getStackItem( 0 );
	Record::iterator ri = record.find( callerName );

	if ( ri != record.end() )
	{
		ri->second.first += t;
		ri->second.second += 1;
	}
	else
	{
		record[ callerName ] = std::make_pair(t,1);
	}
}