Sirikata
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
Sirikata::MigrationMonitor Class Reference

MigrationMonitor keeps track of objects that are currently on this server and determines when they have left the server, or more generally, when they should begin to migrate to another server. More...

#include <MigrationMonitor.hpp>

Inheritance diagram for Sirikata::MigrationMonitor:
Collaboration diagram for Sirikata::MigrationMonitor:

List of all members.

Classes

struct  nextevent
struct  ObjectInfo
struct  objid

Public Types

typedef std::tr1::function
< void(const UUID &)> 
MigrationCallback

Public Member Functions

 MigrationMonitor (SpaceContext *ctx, LocationService *locservice, CoordinateSegmentation *cseg, MigrationCallback cb)
 Create a new MigrationMonitor.
 ~MigrationMonitor ()
bool onThisServer (const Vector3f &pos) const

Private Types

typedef
boost::multi_index_container
< ObjectInfo,
boost::multi_index::indexed_by
< boost::multi_index::ordered_unique
< boost::multi_index::tag
< objid >
, BOOST_MULTI_INDEX_MEMBER(ObjectInfo,
UUID, objid) >
, boost::multi_index::ordered_non_unique
< boost::multi_index::tag
< nextevent >
, BOOST_MULTI_INDEX_MEMBER(ObjectInfo,
Time, nextEvent) > > > 
ObjectInfoSet
typedef ObjectInfoSet::index
< objid >::type 
ObjectInfoByID
typedef ObjectInfoSet::index
< nextevent >::type 
ObjectInfoByNextEvent

Private Member Functions

virtual void localObjectAdded (const UUID &uuid, bool agg, const TimedMotionVector3f &loc, const TimedMotionQuaternion &orient, const AggregateBoundingInfo &bounds, const String &mesh, const String &physics, const String &zernike)
 LocationServiceListener Interface.
virtual void localObjectRemoved (const UUID &uuid, bool agg)
virtual void localLocationUpdated (const UUID &uuid, bool agg, const TimedMotionVector3f &newval)
void handleLocalObjectAdded (const UUID &uuid, const TimedMotionVector3f &loc, const AggregateBoundingInfo &bounds)
void handleLocalObjectRemoved (const UUID &uuid)
void handleLocalLocationUpdated (const UUID &uuid, const TimedMotionVector3f &newval)
virtual void updatedSegmentation (CoordinateSegmentation *cseg, const std::vector< SegmentationInfo > &new_segmentation)
 CoordinateSegmentation::Listener Interface.
void handleUpdatedSegmentation (CoordinateSegmentation *cseg, const std::vector< SegmentationInfo > &new_segmentation)
void waitForNextEvent ()
void service ()
bool inRegion (const Vector3f &pos) const
Time computeNextEventTime (const UUID &obj, const TimedMotionVector3f &newloc)

Static Private Member Functions

static void changeNextEventTime (ObjectInfo &objinfo, const Time &newt)

Private Attributes

SpaceContextmContext
LocationServicemLocService
CoordinateSegmentationmCSeg
BoundingBoxList mBoundingRegions
ObjectInfoSet mObjectInfo
Network::IOStrandmStrand
Network::IOTimerPtr mTimer
Time mMinEventTime
MigrationCallback mCB

Detailed Description

MigrationMonitor keeps track of objects that are currently on this server and determines when they have left the server, or more generally, when they should begin to migrate to another server.


Member Typedef Documentation

typedef std::tr1::function<void(const UUID&)> Sirikata::MigrationMonitor::MigrationCallback
typedef ObjectInfoSet::index<objid>::type Sirikata::MigrationMonitor::ObjectInfoByID [private]
typedef ObjectInfoSet::index<nextevent>::type Sirikata::MigrationMonitor::ObjectInfoByNextEvent [private]
typedef boost::multi_index_container< ObjectInfo, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag<objid>, BOOST_MULTI_INDEX_MEMBER(ObjectInfo,UUID,objid) >, boost::multi_index::ordered_non_unique< boost::multi_index::tag<nextevent>, BOOST_MULTI_INDEX_MEMBER(ObjectInfo,Time,nextEvent) > > > Sirikata::MigrationMonitor::ObjectInfoSet [private]

Constructor & Destructor Documentation

Sirikata::MigrationMonitor::MigrationMonitor ( SpaceContext ctx,
LocationService locservice,
CoordinateSegmentation cseg,
MigrationCallback  cb 
)

Create a new MigrationMonitor.

The MigrationCallback is called any time a migration is detected. Note that it may be called from a thread other than the main thread, so it should be thread safe.

Parameters:
ctxSpaceContext for this simulation
locservicelocation service for this server
csegcoordinate segmentation used for this server
cbcallback to be invoked when a migration is detected

References Sirikata::CoordinateSegmentation::addListener(), Sirikata::LocationService::addListener(), Sirikata::LocationService::context(), Sirikata::SpaceContext::id(), mBoundingRegions, mCSeg, mLocService, and Sirikata::CoordinateSegmentation::serverRegion().

Sirikata::MigrationMonitor::~MigrationMonitor ( )

Member Function Documentation

void Sirikata::MigrationMonitor::changeNextEventTime ( ObjectInfo objinfo,
const Time newt 
) [static, private]
Time Sirikata::MigrationMonitor::computeNextEventTime ( const UUID obj,
const TimedMotionVector3f newloc 
) [private]
void Sirikata::MigrationMonitor::handleLocalLocationUpdated ( const UUID uuid,
const TimedMotionVector3f newval 
) [private]
void Sirikata::MigrationMonitor::handleLocalObjectAdded ( const UUID uuid,
const TimedMotionVector3f loc,
const AggregateBoundingInfo bounds 
) [private]
void Sirikata::MigrationMonitor::handleLocalObjectRemoved ( const UUID uuid) [private]

References mObjectInfo, and waitForNextEvent().

Referenced by localObjectRemoved().

void Sirikata::MigrationMonitor::handleUpdatedSegmentation ( CoordinateSegmentation cseg,
const std::vector< SegmentationInfo > &  new_segmentation 
) [private]
bool Sirikata::MigrationMonitor::inRegion ( const Vector3f &  pos) const [private]

References mBoundingRegions.

Referenced by computeNextEventTime(), and onThisServer().

void Sirikata::MigrationMonitor::localLocationUpdated ( const UUID uuid,
bool  agg,
const TimedMotionVector3f newval 
) [private, virtual]
void Sirikata::MigrationMonitor::localObjectAdded ( const UUID uuid,
bool  agg,
const TimedMotionVector3f loc,
const TimedMotionQuaternion orient,
const AggregateBoundingInfo bounds,
const String &  mesh,
const String &  phy,
const String &  zernike 
) [private, virtual]
void Sirikata::MigrationMonitor::localObjectRemoved ( const UUID uuid,
bool  agg 
) [private, virtual]
bool Sirikata::MigrationMonitor::onThisServer ( const Vector3f &  pos) const

References inRegion().

Referenced by Sirikata::Server::handleConnect().

void Sirikata::MigrationMonitor::service ( ) [private]
void Sirikata::MigrationMonitor::updatedSegmentation ( CoordinateSegmentation cseg,
const std::vector< SegmentationInfo > &  new_segmentation 
) [private, virtual]
void Sirikata::MigrationMonitor::waitForNextEvent ( ) [private]

Member Data Documentation

Referenced by service().

Referenced by waitForNextEvent().

Referenced by waitForNextEvent().

Referenced by waitForNextEvent().


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