Sirikata
|
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>
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 | |
SpaceContext * | mContext |
LocationService * | mLocService |
CoordinateSegmentation * | mCSeg |
BoundingBoxList | mBoundingRegions |
ObjectInfoSet | mObjectInfo |
Network::IOStrand * | mStrand |
Network::IOTimerPtr | mTimer |
Time | mMinEventTime |
MigrationCallback | mCB |
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.
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] |
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.
ctx | SpaceContext for this simulation |
locservice | location service for this server |
cseg | coordinate segmentation used for this server |
cb | callback 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 | ( | ) |
void Sirikata::MigrationMonitor::changeNextEventTime | ( | ObjectInfo & | objinfo, |
const Time & | newt | ||
) | [static, private] |
References Sirikata::MigrationMonitor::ObjectInfo::nextEvent.
Referenced by handleLocalLocationUpdated(), handleUpdatedSegmentation(), and service().
Time Sirikata::MigrationMonitor::computeNextEventTime | ( | const UUID & | obj, |
const TimedMotionVector3f & | newloc | ||
) | [private] |
References Sirikata::LocationService::context(), inRegion(), mBoundingRegions, mLocService, Sirikata::TimedMotionVector< MotionVectorType >::position(), Sirikata::Context::simTime(), and Sirikata::TimedMotionVector< MotionVectorType >::velocity().
Referenced by handleLocalLocationUpdated(), handleLocalObjectAdded(), handleUpdatedSegmentation(), and service().
void Sirikata::MigrationMonitor::handleLocalLocationUpdated | ( | const UUID & | uuid, |
const TimedMotionVector3f & | newval | ||
) | [private] |
References changeNextEventTime(), computeNextEventTime(), mObjectInfo, and waitForNextEvent().
Referenced by localLocationUpdated().
void Sirikata::MigrationMonitor::handleLocalObjectAdded | ( | const UUID & | uuid, |
const TimedMotionVector3f & | loc, | ||
const AggregateBoundingInfo & | bounds | ||
) | [private] |
References computeNextEventTime(), mObjectInfo, and waitForNextEvent().
Referenced by localObjectAdded().
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] |
Reimplemented from Sirikata::LocationServiceListener.
References handleLocalLocationUpdated(), mStrand, and Sirikata::Network::IOStrand::post().
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] |
LocationServiceListener Interface.
Reimplemented from Sirikata::LocationServiceListener.
References handleLocalObjectAdded(), mStrand, and Sirikata::Network::IOStrand::post().
void Sirikata::MigrationMonitor::localObjectRemoved | ( | const UUID & | uuid, |
bool | agg | ||
) | [private, virtual] |
Reimplemented from Sirikata::LocationServiceListener.
References handleLocalObjectRemoved(), mStrand, and Sirikata::Network::IOStrand::post().
bool Sirikata::MigrationMonitor::onThisServer | ( | const Vector3f & | pos | ) | const |
References inRegion().
Referenced by Sirikata::Server::handleConnect().
void Sirikata::MigrationMonitor::service | ( | ) | [private] |
References changeNextEventTime(), computeNextEventTime(), Sirikata::LocationService::contains(), Sirikata::LocationService::context(), Sirikata::LocationService::currentPosition(), Sirikata::LocationService::location(), mCB, mCSeg, mLocService, mObjectInfo, Sirikata::CoordinateSegmentation::region(), Sirikata::Context::simTime(), and waitForNextEvent().
void Sirikata::MigrationMonitor::updatedSegmentation | ( | CoordinateSegmentation * | cseg, |
const std::vector< SegmentationInfo > & | new_segmentation | ||
) | [private, virtual] |
CoordinateSegmentation::Listener Interface.
Implements Sirikata::CoordinateSegmentation::Listener.
References handleUpdatedSegmentation(), mStrand, and Sirikata::Network::IOStrand::post().
void Sirikata::MigrationMonitor::waitForNextEvent | ( | ) | [private] |
BoundingBoxList Sirikata::MigrationMonitor::mBoundingRegions [private] |
Referenced by computeNextEventTime(), handleUpdatedSegmentation(), inRegion(), and MigrationMonitor().
Referenced by service().
SpaceContext* Sirikata::MigrationMonitor::mContext [private] |
Referenced by waitForNextEvent().
Referenced by MigrationMonitor(), service(), and ~MigrationMonitor().
Referenced by computeNextEventTime(), handleUpdatedSegmentation(), MigrationMonitor(), service(), and ~MigrationMonitor().
Referenced by waitForNextEvent().
Referenced by localLocationUpdated(), localObjectAdded(), localObjectRemoved(), and updatedSegmentation().
Referenced by waitForNextEvent().