proland::GraphProducer::GraphCache Class Reference

Cache that manages the precomputed Graphs (including root Graph). More...

#include <GraphProducer.h>

Inherits Object.

List of all members.

Public Member Functions

 GraphCache (GraphPtr root, string graphName, ptr< ResourceManager > manager, bool loadSubgraphs=false)
 Creates a new GraphCache.
 ~GraphCache ()
 Deletes this GraphCache.
GraphPtr getTile (TileCache::Tile::Id tileId)
 Returns the graph corresponding to a precomputed Tile.
void add (TileCache::Tile::Id id, GraphPtr graph)
 Adds a graph to the cache and save it to the disk.

Private Attributes

bool loadSubgraphs
 Determines whether to load subgraphs or not.
string graphName
 The name of the file from which we loaded the root Graph.
ptr< ResourceManager > manager
 The resource manager used to load .graph files.
map< TileCache::Tile::Id,
GraphPtr > 
graphs
 Maps Tile Ids with Graphs.

Detailed Description

Cache that manages the precomputed Graphs (including root Graph).

It can load directly from the disk every tiles at a given level. If the file doesn't exist, the tile will be created from the root Graph (in GraphProducer::doCreateTile()) and then stored in cache and saved to disk.


Constructor & Destructor Documentation

proland::GraphProducer::GraphCache::GraphCache ( GraphPtr  root,
string  graphName,
ptr< ResourceManager >  manager,
bool  loadSubgraphs = false 
)

Creates a new GraphCache.

Parameters:
root the root Graph.
graphName the name of the file from which we loaded the root Graph. This is used to load and save the Graphs at level GraphProducer::precomputedLevel, if different from 0.
manager the resource manager that will load the .graph files.
loadSubgraphs whether to load subgraphs or not.
proland::GraphProducer::GraphCache::~GraphCache (  ) 

Deletes this GraphCache.


Member Function Documentation

void proland::GraphProducer::GraphCache::add ( TileCache::Tile::Id  id,
GraphPtr  graph 
)

Adds a graph to the cache and save it to the disk.

Parameters:
id the id of the tile to add.
graph the corresponding Graph.
GraphPtr proland::GraphProducer::GraphCache::getTile ( TileCache::Tile::Id  tileId  ) 

Returns the graph corresponding to a precomputed Tile.

If it's in cache, it just returns it. If not, it checks if it can load and return it. If it's not available, returns NULL. It will then be recomputed from the root Tile in GraphProducer, added to the cache, and saved on the disk.

Parameters:
tileId the id of the tile to load.
Returns:
the corresponding Graph.

Member Data Documentation

The name of the file from which we loaded the root Graph.

This is used to load and save the Graphs at level GraphProducer::precomputedLevel, if different from 0.

map<TileCache::Tile::Id, GraphPtr> proland::GraphProducer::GraphCache::graphs [private]

Maps Tile Ids with Graphs.

Determines whether to load subgraphs or not.

ptr<ResourceManager> proland::GraphProducer::GraphCache::manager [private]

The resource manager used to load .graph files.


Generated on Sat May 12 09:42:48 2012 for proland by  doxygen 1.6.1