alaCarte Maps
Renderer for OpenStreetMap tiles
RequestManager Class Reference

#include <request_manager.hpp>

Inheritance diagram for RequestManager:


class  RunningQueue
 This file is part of alaCarte. More...

Public Member Functions

 RequestManager (const shared_ptr< Configuration > &config, const shared_ptr< Geodata > &data, const shared_ptr< Renderer > &renderer, const shared_ptr< Cache > &cache, const shared_ptr< StylesheetManager > &ssm)
 Constructs a new RequestManager with the given parameters. More...
 ~RequestManager ()
 Stops the io_service, joins all Threads and destructs the RequestManager. More...
void stop ()
 stops all jobs More...
TESTABLE void enqueue (const shared_ptr< HttpRequest > &r)
 Enqueues the HttpRequest. More...
TESTABLE void enqueue (const shared_ptr< MetaIdentifier > &ti)
 Enqueues the TileIdentifier. More...
TESTABLE shared_ptr< GeodatagetGeodata () const
 Returns the Geodata. More...
TESTABLE shared_ptr< StylesheetManagergetStylesheetManager () const
 Returns the StylesheetManager. More...
TESTABLE shared_ptr< CachegetCache () const
 Returns the Cache. More...
TESTABLE shared_ptr< RenderergetRenderer () const
 Returns the Renderer. More...

Private Member Functions

void processNextRequest ()
 Selects the next Job and runs it process Method. More...
bool nextUserRequest ()
 Selects the next Job and runs it process Method. More...
bool nextPreRenderRequest ()

Private Attributes

shared_ptr< Geodatadata
shared_ptr< Rendererrenderer
shared_ptr< Cachecache
shared_ptr< StylesheetManagerssm
shared_ptr< Configurationconfig
boost::asio::io_service jobPool
boost::asio::io_service::work preventStop
std::vector< shared_ptr< boost::thread > > workers
std::queue< shared_ptr< RenderCanvasFactory > > factories
boost::mutex factoriesMutex
boost::mutex userRJMutex
boost::mutex preRJMutex
std::queue< shared_ptr< HttpRequest > > userRequests
std::queue< shared_ptr< MetaIdentifier > > preRenderRequests
scoped_ptr< RunningQueuerunning
unsigned int currentPrerenderingThreads
std::chrono::system_clock::time_point prerender_start
std::chrono::system_clock::time_point prerender_stop

Detailed Description

Definition at line 42 of file request_manager.hpp.

Constructor & Destructor Documentation

RequestManager::RequestManager ( const shared_ptr< Configuration > &  config,
const shared_ptr< Geodata > &  data,
const shared_ptr< Renderer > &  renderer,
const shared_ptr< Cache > &  cache,
const shared_ptr< StylesheetManager > &  ssm 

Constructs a new RequestManager with the given parameters.

And creates worker Threads.

configThe Configuration, e.g. for the amount of threads.
dataThe Geodata
rendererThe Renderer
cacheThe Cache
ssmThe StylesheetManager

Definition at line 83 of file request_manager.cpp.

RequestManager::~RequestManager ( )

Stops the io_service, joins all Threads and destructs the RequestManager.

Definition at line 114 of file request_manager.cpp.

Member Function Documentation

void RequestManager::enqueue ( const shared_ptr< HttpRequest > &  r)

Enqueues the HttpRequest.

rThe HttpRequest which should be processed.

Definition at line 138 of file request_manager.cpp.

void RequestManager::enqueue ( const shared_ptr< MetaIdentifier > &  ti)

Enqueues the TileIdentifier.

tiThe MetaIdentifier which identifies the Tile which should be renderer.

Definition at line 157 of file request_manager.cpp.

shared_ptr< Cache > RequestManager::getCache ( ) const

Returns the Cache.

The Cache

Definition at line 325 of file request_manager.cpp.

shared_ptr< Geodata > RequestManager::getGeodata ( ) const

Returns the Geodata.

The Geodata

Definition at line 303 of file request_manager.cpp.

shared_ptr< Renderer > RequestManager::getRenderer ( ) const

Returns the Renderer.

The Renderer

Definition at line 336 of file request_manager.cpp.

shared_ptr< StylesheetManager > RequestManager::getStylesheetManager ( ) const

Returns the StylesheetManager.

The StylesheetManager

Definition at line 314 of file request_manager.cpp.

bool RequestManager::nextPreRenderRequest ( )

Definition at line 242 of file request_manager.cpp.

bool RequestManager::nextUserRequest ( )

Selects the next Job and runs it process Method.

true if a request was processed

Definition at line 180 of file request_manager.cpp.

void RequestManager::processNextRequest ( )

Selects the next Job and runs it process Method.

Definition at line 169 of file request_manager.cpp.

void RequestManager::stop ( )

stops all jobs

Definition at line 123 of file request_manager.cpp.

Member Data Documentation

shared_ptr<Cache> RequestManager::cache

Definition at line 65 of file request_manager.hpp.

shared_ptr<Configuration> RequestManager::config

Definition at line 67 of file request_manager.hpp.

unsigned int RequestManager::currentPrerenderingThreads

Definition at line 85 of file request_manager.hpp.

shared_ptr<Geodata> RequestManager::data

Definition at line 63 of file request_manager.hpp.

std::queue<shared_ptr<RenderCanvasFactory> > RequestManager::factories

Definition at line 73 of file request_manager.hpp.

boost::mutex RequestManager::factoriesMutex

Definition at line 74 of file request_manager.hpp.

boost::asio::io_service RequestManager::jobPool

Definition at line 69 of file request_manager.hpp.

std::chrono::system_clock::time_point RequestManager::prerender_start

Definition at line 87 of file request_manager.hpp.

std::chrono::system_clock::time_point RequestManager::prerender_stop

Definition at line 87 of file request_manager.hpp.

std::queue< shared_ptr<MetaIdentifier> > RequestManager::preRenderRequests

Definition at line 79 of file request_manager.hpp.

boost::mutex RequestManager::preRJMutex

Definition at line 77 of file request_manager.hpp.

boost::asio::io_service::work RequestManager::preventStop

Definition at line 70 of file request_manager.hpp.

shared_ptr<Renderer> RequestManager::renderer

Definition at line 64 of file request_manager.hpp.

scoped_ptr<RunningQueue> RequestManager::running

Definition at line 82 of file request_manager.hpp.

shared_ptr<StylesheetManager> RequestManager::ssm

Definition at line 66 of file request_manager.hpp.

std::queue< shared_ptr<HttpRequest> > RequestManager::userRequests

Definition at line 78 of file request_manager.hpp.

boost::mutex RequestManager::userRJMutex

Definition at line 76 of file request_manager.hpp.

std::vector< shared_ptr<boost::thread> > RequestManager::workers

Definition at line 71 of file request_manager.hpp.

The documentation for this class was generated from the following files: