From ddcef600efc5ffe8af4f5e93d40db67de9d4c874 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 20 Dec 2006 07:31:45 +0000 Subject: [PATCH] To clarify algorithm of "SelectPrs3dToBeDeleted" function --- src/VISU_I/VISU_ColoredPrs3dCache_i.cc | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index b24b2e19..3447140e 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -157,23 +157,21 @@ namespace // by cleaning of active holder's presentation if( theActiveHolderEntry != "" ){ aHolderIter = theHolderMap.find( theActiveHolderEntry ); + if(aHolderIter == theHolderMap.end()) + return false; + const VISU::TLastVisitedPrsList& aPrsList = aHolderIter->second; + + // To prefere "move" action instead of destroy / create presentation + if(aPrsList.back()->GetMemorySize() >= theRequiredMemory) + return false; + VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIter = aPrsList.rbegin(); - VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIterEnd = aPrsList.rend(); + // Do not porcess first item to avoid of the device destruction + VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIterEnd = aPrsList.rend()++; for(; aPrsIter != aPrsIterEnd; aPrsIter++){ VISU::TPrs3dPtr aPrs3d = *aPrsIter; - // To avoid of device destruction - if(aPrs3d.GetPointer() == aPrsList.front().GetPointer()) - return false; - - CORBA::Float aMemory = aPrs3d->GetMemorySize(); - - // To prefere "move" action instead of destroy / create - if(aPrsIter == aPrsList.rbegin()) - if(aMemory >= theRequiredMemory) - return false; - - aGatheredMemory += aMemory; + aGatheredMemory += aPrs3d->GetMemorySize(); theColoredPrs3dHolderMap[theActiveHolderEntry].push_back(aPrs3d); if( aGatheredMemory > theRequiredMemory ) return true; -- 2.39.2