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

A LocationUpdatePolicy which always sends a location update message to all subscribers on any position update. More...

#include <AlwaysLocationUpdatePolicy.hpp>

Inheritance diagram for Sirikata::AlwaysLocationUpdatePolicy:
Collaboration diagram for Sirikata::AlwaysLocationUpdatePolicy:

List of all members.

Classes

struct  SubscriberIndex
struct  SubscriberInfo
struct  UpdateInfo

Public Member Functions

 AlwaysLocationUpdatePolicy (SpaceContext *ctx, const String &args)
virtual ~AlwaysLocationUpdatePolicy ()
virtual void start ()
virtual void stop ()
virtual void subscribe (ServerID remote, const UUID &uuid, SeqNoPtr seqno)
 Subscribe remote for updates about uuid.
virtual void subscribe (ServerID remote, const UUID &uuid, ProxIndexID index_id, SeqNoPtr seqno)
 Subscribe remote for updates about uuid.
virtual void unsubscribe (ServerID remote, const UUID &uuid)
 Unsubscribe remote for updates about uuid.
virtual void unsubscribe (ServerID remote, const UUID &uuid, ProxIndexID index_id)
 Unsubscribe remote for updates about uuid.
virtual void unsubscribe (ServerID remote)
 Unsubscribe remote for updates about all objects across all indices.
virtual void subscribe (const OHDP::NodeID &remote, const UUID &uuid)
 Subscribe remote for updates about uuid.
virtual void subscribe (const OHDP::NodeID &remote, const UUID &uuid, ProxIndexID index_id)
 Subscribe remote for updates about uuid.
virtual void unsubscribe (const OHDP::NodeID &remote, const UUID &uuid)
 Unsubscribe remote for updates about uuid.
virtual void unsubscribe (const OHDP::NodeID &remote, const UUID &uuid, ProxIndexID index_id)
 Unsubscribe remote for updates about uuid.
virtual void unsubscribe (const OHDP::NodeID &remote)
 Unsubscribe remote for updates about all objects across all indices.
virtual void subscribe (const UUID &remote, const UUID &uuid)
 Subscribe remote for updates about uuid.
virtual void subscribe (const UUID &remote, const UUID &uuid, ProxIndexID index_id)
 Subscribe remote for updates about uuid.
virtual void unsubscribe (const UUID &remote, const UUID &uuid)
 Unsubscribe remote for updates about uuid.
virtual void unsubscribe (const UUID &remote, const UUID &uuid, ProxIndexID index_id)
 Unsubscribe remote for updates about uuid.
virtual void unsubscribe (const UUID &remote)
 Unsubscribe remote for updates about all objects across all indices.
virtual void localObjectAdded (const UUID &uuid, bool agg, const TimedMotionVector3f &loc, const TimedMotionQuaternion &orient, const AggregateBoundingInfo &bounds, const String &mesh, const String &physics)
virtual void localObjectRemoved (const UUID &uuid, bool agg)
virtual void localLocationUpdated (const UUID &uuid, bool agg, const TimedMotionVector3f &newval)
virtual void localOrientationUpdated (const UUID &uuid, bool agg, const TimedMotionQuaternion &newval)
virtual void localBoundsUpdated (const UUID &uuid, bool agg, const AggregateBoundingInfo &newval)
virtual void localMeshUpdated (const UUID &uuid, bool agg, const String &newval)
virtual void localPhysicsUpdated (const UUID &uuid, bool agg, const String &newval)
virtual void replicaObjectAdded (const UUID &uuid, const TimedMotionVector3f &loc, const TimedMotionQuaternion &orient, const AggregateBoundingInfo &bounds, const String &mesh, const String &physics)
virtual void replicaObjectRemoved (const UUID &uuid)
virtual void replicaLocationUpdated (const UUID &uuid, const TimedMotionVector3f &newval)
virtual void replicaOrientationUpdated (const UUID &uuid, const TimedMotionQuaternion &newval)
virtual void replicaBoundsUpdated (const UUID &uuid, const AggregateBoundingInfo &newval)
virtual void replicaMeshUpdated (const UUID &uuid, const String &newval)
virtual void replicaPhysicsUpdated (const UUID &uuid, const String &newval)
virtual void service ()

Private Types

typedef std::set< UUIDUUIDSet
typedef std::set< ProxIndexIDProxIndexSet
typedef std::map< UUID,
ProxIndexSet
ObjectIndexesMap
typedef std::tr1::shared_ptr
< SubscriberInfo
SubscriberInfoPtr
typedef SubscriberIndex< ServerID > ServerSubscriberIndex
typedef SubscriberIndex
< OHDP::NodeID
OHSubscriberIndex
typedef SubscriberIndex< UUIDObjectSubscriberIndex

Private Member Functions

void reportStats ()
void tryCreateChildStream (const UUID &dest, ODPSST::Stream::Ptr parent_stream, std::string *msg, int count, const SubscriberInfoPtr &numOutstandingMessageCount)
void objectLocSubstreamCallback (int x, ODPSST::Stream::Ptr substream, const UUID &dest, ODPSST::Stream::Ptr parent_substream, std::string *msg, int count, const SubscriberInfoPtr &numOutstandingMessageCount)
void tryCreateChildStream (const OHDP::NodeID &dest, OHDPSST::Stream::Ptr parent_stream, std::string *msg, int count, const SubscriberInfoPtr &numOutstandingMessageCount)
void ohLocSubstreamCallback (int x, OHDPSST::Stream::Ptr substream, const OHDP::NodeID &dest, OHDPSST::Stream::Ptr parent_substream, std::string *msg, int count, const SubscriberInfoPtr &numOutstandingMessageCount)
bool validSubscriber (const UUID &dest)
bool validSubscriber (const OHDP::NodeID &dest)
bool validSubscriber (const ServerID &dest)
bool isSelfSubscriber (const UUID &sid, const UUID &observed)
bool isSelfSubscriber (const OHDP::NodeID &sid, const UUID &observed)
bool isSelfSubscriber (const ServerID &sid, const UUID &observed)
bool trySend (const UUID &dest, const Sirikata::Protocol::Loc::BulkLocationUpdate &blu, const SubscriberInfoPtr &numOutstandingMessageCount)
bool trySend (const OHDP::NodeID &dest, const Sirikata::Protocol::Loc::BulkLocationUpdate &blu, const SubscriberInfoPtr &numOutstandingMessageCount)
bool trySend (const ServerID &dest, const Sirikata::Protocol::Loc::BulkLocationUpdate &blu, const SubscriberInfoPtr &numOutstandingMessageCount)

Static Private Member Functions

static long numOutstandingMessages (const SubscriberInfoPtr &sub_info)

Private Attributes

Poller mStatsPoller
Time mLastStatsTime
const String mTimeSeriesServerUpdatesName
AtomicValue< uint32 > mServerUpdatesPerSecond
const String mTimeSeriesOHUpdatesName
AtomicValue< uint32 > mOHUpdatesPerSecond
const String mTimeSeriesObjectUpdatesName
AtomicValue< uint32 > mObjectUpdatesPerSecond
ServerSubscriberIndex mServerSubscriptions
OHSubscriberIndex mOHSubscriptions
ObjectSubscriberIndex mObjectSubscriptions

Detailed Description

A LocationUpdatePolicy which always sends a location update message to all subscribers on any position update.


Member Typedef Documentation


Constructor & Destructor Documentation

Sirikata::AlwaysLocationUpdatePolicy::AlwaysLocationUpdatePolicy ( SpaceContext ctx,
const String &  args 
)
Sirikata::AlwaysLocationUpdatePolicy::~AlwaysLocationUpdatePolicy ( ) [virtual]

Member Function Documentation

bool Sirikata::AlwaysLocationUpdatePolicy::isSelfSubscriber ( const UUID sid,
const UUID observed 
) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::isSelfSubscriber ( const OHDP::NodeID sid,
const UUID observed 
) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::isSelfSubscriber ( const ServerID &  sid,
const UUID observed 
) [private]
void Sirikata::AlwaysLocationUpdatePolicy::localBoundsUpdated ( const UUID uuid,
bool  agg,
const AggregateBoundingInfo newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::localLocationUpdated ( const UUID uuid,
bool  agg,
const TimedMotionVector3f newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::localMeshUpdated ( const UUID uuid,
bool  agg,
const String &  newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::localObjectAdded ( const UUID uuid,
bool  agg,
const TimedMotionVector3f loc,
const TimedMotionQuaternion orient,
const AggregateBoundingInfo bounds,
const String &  mesh,
const String &  physics 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::localObjectRemoved ( const UUID uuid,
bool  agg 
) [virtual]

Reimplemented from Sirikata::LocationServiceListener.

void Sirikata::AlwaysLocationUpdatePolicy::localOrientationUpdated ( const UUID uuid,
bool  agg,
const TimedMotionQuaternion newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::localPhysicsUpdated ( const UUID uuid,
bool  agg,
const String &  newval 
) [virtual]
static long Sirikata::AlwaysLocationUpdatePolicy::numOutstandingMessages ( const SubscriberInfoPtr sub_info) [inline, static, private]
void Sirikata::AlwaysLocationUpdatePolicy::objectLocSubstreamCallback ( int  x,
ODPSST::Stream::Ptr  substream,
const UUID dest,
ODPSST::Stream::Ptr  parent_substream,
std::string *  msg,
int  count,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
void Sirikata::AlwaysLocationUpdatePolicy::ohLocSubstreamCallback ( int  x,
OHDPSST::Stream::Ptr  substream,
const OHDP::NodeID dest,
OHDPSST::Stream::Ptr  parent_substream,
std::string *  msg,
int  count,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
void Sirikata::AlwaysLocationUpdatePolicy::replicaBoundsUpdated ( const UUID uuid,
const AggregateBoundingInfo newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::replicaLocationUpdated ( const UUID uuid,
const TimedMotionVector3f newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::replicaMeshUpdated ( const UUID uuid,
const String &  newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::replicaObjectAdded ( const UUID uuid,
const TimedMotionVector3f loc,
const TimedMotionQuaternion orient,
const AggregateBoundingInfo bounds,
const String &  mesh,
const String &  physics 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::replicaObjectRemoved ( const UUID uuid) [virtual]

Reimplemented from Sirikata::LocationServiceListener.

void Sirikata::AlwaysLocationUpdatePolicy::replicaOrientationUpdated ( const UUID uuid,
const TimedMotionQuaternion newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::replicaPhysicsUpdated ( const UUID uuid,
const String &  newval 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::reportStats ( ) [private]
void Sirikata::AlwaysLocationUpdatePolicy::service ( ) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::start ( ) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::stop ( ) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::subscribe ( const OHDP::NodeID remote,
const UUID uuid 
) [virtual]

Subscribe remote for updates about uuid.

This version implicitly assumes only one index_id since it is omitted (index_id is only relevant for replicating multiple trees/indexes).

Implements Sirikata::LocationUpdatePolicy.

References Sirikata::LocationService::context(), Sirikata::ObjectHostSessionManager::getSession(), Sirikata::LocationUpdatePolicy::mLocService, mOHSubscriptions, Sirikata::SpaceContext::ohSessionManager(), Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::subscribe(), and validSubscriber().

void Sirikata::AlwaysLocationUpdatePolicy::subscribe ( const OHDP::NodeID remote,
const UUID uuid,
ProxIndexID  index_id 
) [virtual]

Subscribe remote for updates about uuid.

The index_id indicates the origin of the request and updates will continue until the same index_id has a corresponding unsubscribe call. In other words, if you call this method twice, it needs to be called twice with the same IDs before it stops sending updates. The index_id will be included in updates so the client knows what to update.

Implements Sirikata::LocationUpdatePolicy.

References Sirikata::LocationService::context(), Sirikata::ObjectHostSessionManager::getSession(), Sirikata::LocationUpdatePolicy::mLocService, mOHSubscriptions, Sirikata::SpaceContext::ohSessionManager(), Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::subscribe(), and validSubscriber().

void Sirikata::AlwaysLocationUpdatePolicy::subscribe ( ServerID  remote,
const UUID uuid,
ProxIndexID  index_id,
SeqNoPtr  seqNo 
) [virtual]

Subscribe remote for updates about uuid.

The index_id indicates the origin of the request and updates will continue until the same index_id has a corresponding unsubscribe call. In other words, if you call this method twice, it needs to be called twice with the same IDs before it stops sending updates. The index_id will be included in updates so the client knows what to update.

Use seqNo to generate sequence numbers to include in the updates to ensure correct ordering.

Implements Sirikata::LocationUpdatePolicy.

References mServerSubscriptions, Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::subscribe(), and validSubscriber().

void Sirikata::AlwaysLocationUpdatePolicy::subscribe ( ServerID  remote,
const UUID uuid,
SeqNoPtr  seqNo 
) [virtual]

Subscribe remote for updates about uuid.

This version implicitly assumes only one index_id since it is omitted (index_id is only relevant for replicating multiple trees/indexes).

Use seqNo to generate sequence numbers to include in the updates to ensure correct ordering.

Implements Sirikata::LocationUpdatePolicy.

References mServerSubscriptions, Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::subscribe(), and validSubscriber().

void Sirikata::AlwaysLocationUpdatePolicy::subscribe ( const UUID remote,
const UUID uuid 
) [virtual]
void Sirikata::AlwaysLocationUpdatePolicy::subscribe ( const UUID remote,
const UUID uuid,
ProxIndexID  index_id 
) [virtual]

Subscribe remote for updates about uuid.

The index_id indicates the origin of the request and updates will continue until the same index_id has a corresponding unsubscribe call. In other words, if you call this method twice, it needs to be called twice with the same IDs before it stops sending updates. The index_id will be included in updates so the client knows what to update.

Implements Sirikata::LocationUpdatePolicy.

References Sirikata::LocationService::context(), Sirikata::ObjectSession::getSeqNoPtr(), Sirikata::ObjectSessionManager::getSession(), Sirikata::LocationUpdatePolicy::mLocService, mObjectSubscriptions, Sirikata::SpaceContext::objectSessionManager(), Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::subscribe(), and validSubscriber().

void Sirikata::AlwaysLocationUpdatePolicy::tryCreateChildStream ( const OHDP::NodeID dest,
OHDPSST::Stream::Ptr  parent_stream,
std::string *  msg,
int  count,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
void Sirikata::AlwaysLocationUpdatePolicy::tryCreateChildStream ( const UUID dest,
ODPSST::Stream::Ptr  parent_stream,
std::string *  msg,
int  count,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::trySend ( const ServerID &  dest,
const Sirikata::Protocol::Loc::BulkLocationUpdate &  blu,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::trySend ( const UUID dest,
const Sirikata::Protocol::Loc::BulkLocationUpdate &  blu,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::trySend ( const OHDP::NodeID dest,
const Sirikata::Protocol::Loc::BulkLocationUpdate &  blu,
const SubscriberInfoPtr numOutstandingMessageCount 
) [private]
void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( ServerID  remote,
const UUID uuid 
) [virtual]

Unsubscribe remote for updates about uuid.

This version implicitly assumes only one index_id, i.e. that multiple tree replication is not being used.

Implements Sirikata::LocationUpdatePolicy.

References mServerSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( const OHDP::NodeID remote,
const UUID uuid,
ProxIndexID  index_id 
) [virtual]

Unsubscribe remote for updates about uuid.

The index_id indicates the origin of the request -- the unsubscription only applies for that index_id so if any other index_id's have unmatched subscribe calls, updates will still be sent for those indices.

Implements Sirikata::LocationUpdatePolicy.

References mOHSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( ServerID  remote,
const UUID uuid,
ProxIndexID  index_id 
) [virtual]

Unsubscribe remote for updates about uuid.

The index_id indicates the origin of the request -- the unsubscription only applies for that index_id so if any other index_id's have unmatched subscribe calls, updates will still be sent for those indices.

Implements Sirikata::LocationUpdatePolicy.

References mServerSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( const OHDP::NodeID remote,
const UUID uuid 
) [virtual]

Unsubscribe remote for updates about uuid.

This version implicitly assumes only one index_id, i.e. that multiple tree replication is not being used.

Implements Sirikata::LocationUpdatePolicy.

References mOHSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( const OHDP::NodeID remote) [virtual]

Unsubscribe remote for updates about all objects across all indices.

Implements Sirikata::LocationUpdatePolicy.

References mOHSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( const UUID remote,
const UUID uuid 
) [virtual]

Unsubscribe remote for updates about uuid.

This version implicitly assumes only one index_id, i.e. that multiple tree replication is not being used.

Implements Sirikata::LocationUpdatePolicy.

References mObjectSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( ServerID  remote) [virtual]

Unsubscribe remote for updates about all objects across all indices.

Implements Sirikata::LocationUpdatePolicy.

References mServerSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( const UUID remote) [virtual]

Unsubscribe remote for updates about all objects across all indices.

Implements Sirikata::LocationUpdatePolicy.

References mObjectSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

void Sirikata::AlwaysLocationUpdatePolicy::unsubscribe ( const UUID remote,
const UUID uuid,
ProxIndexID  index_id 
) [virtual]

Unsubscribe remote for updates about uuid.

The index_id indicates the origin of the request -- the unsubscription only applies for that index_id so if any other index_id's have unmatched subscribe calls, updates will still be sent for those indices.

Implements Sirikata::LocationUpdatePolicy.

References mObjectSubscriptions, and Sirikata::AlwaysLocationUpdatePolicy::SubscriberIndex< SubscriberType >::unsubscribe().

bool Sirikata::AlwaysLocationUpdatePolicy::validSubscriber ( const UUID dest) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::validSubscriber ( const OHDP::NodeID dest) [private]
bool Sirikata::AlwaysLocationUpdatePolicy::validSubscriber ( const ServerID &  dest) [private]

Member Data Documentation

Referenced by reportStats().

Referenced by reportStats().

Referenced by reportStats().

Referenced by reportStats().

Referenced by start(), and stop().

Referenced by reportStats().

Referenced by reportStats().

Referenced by reportStats().


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