proland::TileStorage Class Reference
[producer]

A shared storage to store tiles of the same kind. More...

#include <TileStorage.h>

Inheritance diagram for proland::TileStorage:
proland::CPUTileStorage< T > proland::GPUTileStorage proland::ObjectTileStorage

List of all members.

Classes

class  Slot
 A slot managed by a TileStorage. More...

Public Member Functions

 TileStorage (int tileSize, int capacity)
 Creates a new TileStorage.
virtual ~TileStorage ()
 Deletes this TileStorage.
SlotnewSlot ()
 Returns a free slot in the pool of slots managed by this TileStorage.
void deleteSlot (Slot *t)
 Notifies this storage that the given slot is free.
int getTileSize ()
 Returns the size of each tile.
int getCapacity ()
 Returns the total number of slots managed by this TileStorage.
int getFreeSlots ()
 Returns the number of slots in this TileStorage that are currently unused.

Protected Member Functions

 TileStorage ()
 Creates a new uninitialized TileStorage.
void init (int tileSize, int capacity)
 Initializes this TileStorage.

Protected Attributes

int tileSize
 The size of each tile.
int capacity
 The total number of slots managed by this TileStorage.
list< Slot * > freeSlots
 The currently free slots.

Detailed Description

A shared storage to store tiles of the same kind.

This abstract class defines the behavior of tile storages but does not provide any storage itself. The slots managed by a tile storage can be used to store any tile identified by its (level,tx,ty) coordinates. This means that a TileStorage::Slot can store the data of some tile at some moment, and then be reused to store the data of tile some time later. The mapping between tiles and TileStorage::Slot is not managed by the TileStorage itself, but by a TileCache. A TileStorage just keeps track of which slots in the pool are currently associated with a tile (i.e., store the data of a tile), and which are not. The first ones are called allocated slots, the others free slots.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::TileStorage::TileStorage ( int  tileSize,
int  capacity 
)

Creates a new TileStorage.

Parameters:
tileSize the size of each tile. For tiles made of raster data, this size is the tile width in pixels (the tile height is supposed equal to the tile width).
capacity the number of slots allocated and managed by this tile storage. This capacity is fixed and cannot change with time.
virtual proland::TileStorage::~TileStorage (  )  [virtual]

Deletes this TileStorage.

This deletes the data associated with all the slots managed by this tile storage.

proland::TileStorage::TileStorage (  )  [protected]

Creates a new uninitialized TileStorage.


Member Function Documentation

void proland::TileStorage::deleteSlot ( Slot t  ) 

Notifies this storage that the given slot is free.

The given slot can then be allocated to store a new tile, i.e., it can be returned by a subsequent call to newSlot.

Parameters:
t a slot that is no longer in use.
int proland::TileStorage::getCapacity (  ) 

Returns the total number of slots managed by this TileStorage.

This includes both unused and used tiles.

int proland::TileStorage::getFreeSlots (  ) 

Returns the number of slots in this TileStorage that are currently unused.

int proland::TileStorage::getTileSize (  ) 

Returns the size of each tile.

For tiles made of raster data, this size is the tile width in pixels (the tile height is supposed equal to the tile width).

void proland::TileStorage::init ( int  tileSize,
int  capacity 
) [protected]

Initializes this TileStorage.

Parameters:
tileSize the size of each tile. For tiles made of raster data, this size is the tile width in pixels (the tile height is supposed equal to the tile width).
capacity the number of slots allocated and managed by this tile storage. This capacity is fixed and cannot change with time.
Slot* proland::TileStorage::newSlot (  ) 

Returns a free slot in the pool of slots managed by this TileStorage.

Returns:
a free slot, or NULL if all tiles are currently allocated. The returned slot is then considered to be allocated, until it is released with deleteSlot.

Member Data Documentation

The total number of slots managed by this TileStorage.

This includes both unused and used tiles.

The currently free slots.

The size of each tile.

For tiles made of raster data, this size is the tile width in pixels (the tile height is supposed equal to the tile width).


Generated on Sat May 12 09:41:38 2012 for proland by  doxygen 1.6.1