Sirikata
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
Sirikata::Transfer::TransferMediator Class Reference

#include <TransferMediator.hpp>

Inheritance diagram for Sirikata::Transfer::TransferMediator:
Collaboration diagram for Sirikata::Transfer::TransferMediator:

List of all members.

Classes

class  AggregateRequest
class  PoolWorker
struct  tagID
struct  tagPriority

Public Member Functions

 TransferMediator ()
 ~TransferMediator ()
void registerContext (Context *ctx)
 Register this Context with the TransferMediator.
template<typename TPoolType >
std::tr1::shared_ptr< TPoolType > registerClient (const std::string &clientID)
 Used to register a client that has a pool of requests it needs serviced by the transfer mediator.
void cleanup ()

Static Public Member Functions

static TransferMediatorgetSingleton ()
static void destroy ()

Private Types

typedef multi_index_container
< std::tr1::shared_ptr
< AggregateRequest >
, indexed_by< hashed_unique
< tag< tagID >, const_mem_fun
< AggregateRequest, const
std::string
&,&AggregateRequest::getIdentifier >
>, ordered_non_unique< tag
< tagPriority >, member
< AggregateRequest, Priority,&AggregateRequest::mPriority >
, std::greater< Priority > > > > 
AggregateList
typedef AggregateList::index
< tagID >::type 
AggregateListByID
typedef AggregateList::index
< tagPriority >::type 
AggregateListByPriority
typedef std::map< std::string,
std::tr1::shared_ptr
< PoolWorker > > 
PoolType

Private Member Functions

void mediatorThread ()
void execute_finished (std::tr1::shared_ptr< TransferRequest > req, std::string id)
void checkQueue ()
void registerPool (TransferPoolPtr pool)
void commandListRequests (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid)

Static Private Member Functions

static std::tr1::shared_ptr
< TransferRequest
getRequest (std::tr1::shared_ptr< TransferPool > pool)

Private Attributes

boost::mutex mAggMutex
AggregateList mAggregateList
PoolType mPools
boost::shared_mutex mPoolMutex
bool mCleanup
uint32 mNumOutstanding
ThreadmThread
PriorityAggregationAlgorithmmAggregationAlgorithm

Friends

class PoolWorker

Member Typedef Documentation

typedef multi_index_container< std::tr1::shared_ptr<AggregateRequest>, indexed_by< hashed_unique<tag<tagID>, const_mem_fun<AggregateRequest,const std::string &,&AggregateRequest::getIdentifier> >, ordered_non_unique<tag<tagPriority>, member<AggregateRequest,Priority,&AggregateRequest::mPriority>, std::greater<Priority> > > > Sirikata::Transfer::TransferMediator::AggregateList [private]
typedef AggregateList::index<tagID>::type Sirikata::Transfer::TransferMediator::AggregateListByID [private]
typedef AggregateList::index<tagPriority>::type Sirikata::Transfer::TransferMediator::AggregateListByPriority [private]
typedef std::map<std::string, std::tr1::shared_ptr<PoolWorker> > Sirikata::Transfer::TransferMediator::PoolType [private]

Constructor & Destructor Documentation

Sirikata::Transfer::TransferMediator::TransferMediator ( )
Sirikata::Transfer::TransferMediator::~TransferMediator ( )

Member Function Documentation

void Sirikata::Transfer::TransferMediator::checkQueue ( ) [private]
void Sirikata::Transfer::TransferMediator::cleanup ( )
void Sirikata::Transfer::TransferMediator::commandListRequests ( const Command::Command cmd,
Command::Commander cmdr,
Command::CommandID  cmdid 
) [private]
void Sirikata::Transfer::TransferMediator::destroy ( ) [static]

Reimplemented from Sirikata::AutoSingleton< TransferMediator >.

References destroy.

Referenced by main().

void Sirikata::Transfer::TransferMediator::execute_finished ( std::tr1::shared_ptr< TransferRequest req,
std::string  id 
) [private]
static std::tr1::shared_ptr<TransferRequest> Sirikata::Transfer::TransferMediator::getRequest ( std::tr1::shared_ptr< TransferPool pool) [inline, static, private]
TransferMediator & Sirikata::Transfer::TransferMediator::getSingleton ( ) [static]
void Sirikata::Transfer::TransferMediator::mediatorThread ( ) [private]

Ewen and I weren't able to identify why the below call caused a deadlock on the shared space hosted on sns30 (could not reproduce on other machines). With the below line, in gdb, with bulletphysics on, and servermap-options set to port 6880, we'd get 4 calls to checkQueue, followed by no follow up calls. Not sure what to say.

template<typename TPoolType >
std::tr1::shared_ptr<TPoolType> Sirikata::Transfer::TransferMediator::registerClient ( const std::string &  clientID) [inline]

Used to register a client that has a pool of requests it needs serviced by the transfer mediator.

Parameters:
clientIDShould be a string that uniquely identifies the client

Referenced by Sirikata::AggregateManager::AggregateManager(), Sirikata::BulletPhysicsService::BulletPhysicsService(), Sirikata::Graphics::OgreRenderer::initialize(), Sirikata::SDL::AudioSimulation::iStart(), Sirikata::JS::JSObjectScriptManager::JSObjectScriptManager(), and Sirikata::ObjectHost::ObjectHost().

void Sirikata::Transfer::TransferMediator::registerContext ( Context ctx)

Register this Context with the TransferMediator.

This is a workaround to the fact that TransferMediator is a Singleton. Currently this registers a few commands through the Commander interface

References Sirikata::Context::commander(), commandListRequests(), and Sirikata::Command::Commander::registerCommand().

Referenced by main().

void Sirikata::Transfer::TransferMediator::registerPool ( TransferPoolPtr  pool) [private]

Friends And Related Function Documentation

friend class PoolWorker [friend]

Member Data Documentation

boost::shared_mutex Sirikata::Transfer::TransferMediator::mPoolMutex [private]

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