[Kstars-devel] branches/kstars/summer/kdeedu/kstars/kstars/skycomponents
Akarsh Simha
akarshsimha at gmail.com
Sat Jun 21 03:39:15 CEST 2008
SVN commit 822673 by asimha:
Adding functions freeAll() and freeUnused() to StarBlockFactory for
testing.
CCMAIL: kstars-devel at kde.org
M +22 -0 starblockfactory.cpp
M +12 -0 starblockfactory.h
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starblockfactory.cpp #822672:822673
@@ -260,3 +260,25 @@
++index;
}while( cur != last );
}
+
+int StarBlockFactory::freeUnused() {
+ int i;
+ StarBlock *temp;
+
+ i = 0;
+ while( last != NULL && last->drawID == drawID && i != nBlocks ) {
+ temp = last->prev;
+ delete last;
+ last = temp;
+ i++;
+ }
+ if( last )
+ last->next = NULL;
+ else
+ first = NULL;
+
+ kDebug() << i << "StarBlocks freed from StarBlockFactory" << endl;
+
+ nBlocks -= i;
+ return i;
+}
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starblockfactory.h #822672:822673
@@ -91,6 +91,18 @@
inline int getBlockCount() { return nBlocks; }
/**
+ *@short Frees all StarBlocks that are in the cache
+ *@return The number of StarBlocks freed
+ */
+ inline int freeAll() { return deleteBlocks( nBlocks ); }
+
+ /**
+ *@short Frees all StarBlocks that are not used in this draw cycle
+ *@return The number of StarBlocks freed
+ */
+ int freeUnused();
+
+ /**
*@short Prints the structure of the cache, for debugging
*/
void printStructure();
More information about the Kstars-devel
mailing list