• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
StarBlockFactory Class Reference

#include <starblockfactory.h>

Public Member Functions

 ~StarBlockFactory ()
 
int freeAll ()
 
int freeUnused ()
 
StarBlock * getBlock ()
 
int getBlockCount ()
 
bool markFirst (StarBlock *block)
 
bool markNext (StarBlock *after, StarBlock *block)
 
void printStructure ()
 

Static Public Member Functions

static StarBlockFactory * Instance ()
 

Public Attributes

quint32 drawID
 

Detailed Description

A factory that creates StarBlocks and recycles them in an LRU Cache.

Author
Akarsh Simha
Version
0.1

Definition at line 32 of file starblockfactory.h.

Constructor & Destructor Documentation

StarBlockFactory::~StarBlockFactory ( )

Destructor Deletes the linked list that maintains the Cache, sets the pointer to NULL.

Definition at line 43 of file starblockfactory.cpp.

Member Function Documentation

int StarBlockFactory::freeAll ( )
inline

Frees all StarBlocks that are in the cache.

Returns
The number of StarBlocks freed

Definition at line 86 of file starblockfactory.h.

int StarBlockFactory::freeUnused ( )

Frees all StarBlocks that are not used in this draw cycle.

Returns
The number of StarBlocks freed

Definition at line 270 of file starblockfactory.cpp.

StarBlock * StarBlockFactory::getBlock ( )

Return a StarBlock available for use.

This method first checks if there are any cached StarBlocks that are not in use. If such a StarBlock is found, it returns the same for use. Else it freshly allocates a StarBlock and returns the same. It also moves the StarBlock to the front, marking it as the most recently used. If the StarBlock had a parent StarBlockList, this method detaches the StarBlock from the StarBlockList

Returns
A StarBlock that is available for use

Definition at line 49 of file starblockfactory.cpp.

int StarBlockFactory::getBlockCount ( )
inline

Returns the number of StarBlocks currently produced.

Returns
Number of StarBlocks currently allocated

Definition at line 80 of file starblockfactory.h.

StarBlockFactory * StarBlockFactory::Instance ( )
static

Definition at line 29 of file starblockfactory.cpp.

bool StarBlockFactory::markFirst ( StarBlock *  block)

Mark a StarBlock as most recently used and sync its drawID with the current drawID.

Returns
true on success, false if the StarBlock supplied was not on our list at all

Definition at line 79 of file starblockfactory.cpp.

bool StarBlockFactory::markNext ( StarBlock *  after,
StarBlock *  block 
)

Rank a given StarBlock after another given StarBlock in the LRU list and sync its drawID with the current drawID.

Parameters
afterThe block after which 'block' should be put
blockThe block to mark for use
Returns
true on success, false on failure

Definition at line 117 of file starblockfactory.cpp.

void StarBlockFactory::printStructure ( )

Prints the structure of the cache, for debugging.

Definition at line 244 of file starblockfactory.cpp.

Member Data Documentation

quint32 StarBlockFactory::drawID

Definition at line 99 of file starblockfactory.h.


The documentation for this class was generated from the following files:
  • starblockfactory.h
  • starblockfactory.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:23 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal