Sirikata
|
A simple implementation of ObjectQueryProcessor: it mostly acts as a pass through, only managing the coordination with the space server. More...
#include <SimpleObjectQueryProcessor.hpp>
Classes | |
struct | ObjectState |
Public Member Functions | |
SimpleObjectQueryProcessor (ObjectHostContext *ctx) | |
virtual | ~SimpleObjectQueryProcessor () |
virtual void | start () |
virtual void | stop () |
virtual void | presenceConnectedStream (HostedObjectPtr ho, const SpaceObjectReference &sporef, HostedObject::SSTStreamPtr strm) |
Invoked by the ObjectHost when an object's presence is connected to the space and the underlying stream has been fully established. | |
virtual void | presenceDisconnected (HostedObjectPtr ho, const SpaceObjectReference &sporef) |
Invoked by the ObjectHost when an object's presence has been disconnected from the space. | |
virtual void | updateQuery (HostedObjectPtr ho, const SpaceObjectReference &sporef, const String &new_query) |
Request an update to the query parameters for the specified presence. | |
virtual void | onOrphanLocUpdate (const LocUpdate &lu, const SpaceObjectReference &observer) |
Static Public Member Functions | |
static SimpleObjectQueryProcessor * | create (ObjectHostContext *ctx, const String &args) |
Private Types | |
typedef std::tr1::shared_ptr < ObjectState > | ObjectStatePtr |
typedef std::tr1::unordered_map < SpaceObjectReference, ObjectStatePtr, SpaceObjectReference::Hasher > | ObjectStateMap |
Private Member Functions | |
void | handleStop () |
void | handleProximitySubstream (const HostedObjectWPtr &weakSelf, const SpaceObjectReference &spaceobj, int err, SSTStreamPtr s) |
void | handleProximitySubstreamRead (const HostedObjectWPtr &weakSelf, const SpaceObjectReference &spaceobj, SSTStreamPtr s, String *prevdata, uint8 *buffer, int length) |
bool | handleProximityMessage (HostedObjectPtr self, const SpaceObjectReference &spaceobj, const std::string &payload) |
void | handleLocationSubstream (const HostedObjectWPtr &weakSelf, const SpaceObjectReference &spaceobj, int err, SSTStreamPtr s) |
void | handleLocationSubstreamRead (const HostedObjectWPtr &weakSelf, const SpaceObjectReference &spaceobj, SSTStreamPtr s, std::stringstream *prevdata, uint8 *buffer, int length) |
bool | handleLocationMessage (const HostedObjectPtr &self, const SpaceObjectReference &spaceobj, const std::string &paylod) |
virtual void | commandProperties (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid) |
virtual void | commandListHandlers (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid) |
virtual void | commandListNodes (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid) |
virtual void | commandListQueriers (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid) |
virtual void | commandForceRebuild (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid) |
virtual void | commandStats (const Command::Command &cmd, Command::Commander *cmdr, Command::CommandID cmdid) |
Private Attributes | |
ObjectHostContext * | mContext |
ObjectStateMap | mObjectStateMap |
A simple implementation of ObjectQueryProcessor: it mostly acts as a pass through, only managing the coordination with the space server.
Query updates are passed directly through and it only manages listening for new result streams and parsing the results.
typedef std::tr1::unordered_map<SpaceObjectReference, ObjectStatePtr, SpaceObjectReference::Hasher> Sirikata::OH::Simple::SimpleObjectQueryProcessor::ObjectStateMap [private] |
typedef std::tr1::shared_ptr<ObjectState> Sirikata::OH::Simple::SimpleObjectQueryProcessor::ObjectStatePtr [private] |
Sirikata::OH::Simple::SimpleObjectQueryProcessor::SimpleObjectQueryProcessor | ( | ObjectHostContext * | ctx | ) |
Referenced by create().
Sirikata::OH::Simple::SimpleObjectQueryProcessor::~SimpleObjectQueryProcessor | ( | ) | [virtual] |
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::commandForceRebuild | ( | const Command::Command & | cmd, |
Command::Commander * | cmdr, | ||
Command::CommandID | cmdid | ||
) | [private, virtual] |
References Sirikata::Command::EmptyResult(), and Sirikata::Command::Commander::result().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::commandListHandlers | ( | const Command::Command & | cmd, |
Command::Commander * | cmdr, | ||
Command::CommandID | cmdid | ||
) | [private, virtual] |
References Sirikata::Command::EmptyResult(), and Sirikata::Command::Commander::result().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::commandListNodes | ( | const Command::Command & | cmd, |
Command::Commander * | cmdr, | ||
Command::CommandID | cmdid | ||
) | [private, virtual] |
References Sirikata::Command::EmptyResult(), and Sirikata::Command::Commander::result().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::commandListQueriers | ( | const Command::Command & | cmd, |
Command::Commander * | cmdr, | ||
Command::CommandID | cmdid | ||
) | [private, virtual] |
References Sirikata::Command::EmptyResult(), and Sirikata::Command::Commander::result().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::commandProperties | ( | const Command::Command & | cmd, |
Command::Commander * | cmdr, | ||
Command::CommandID | cmdid | ||
) | [private, virtual] |
References Sirikata::Command::EmptyResult(), and Sirikata::Command::Commander::result().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::commandStats | ( | const Command::Command & | cmd, |
Command::Commander * | cmdr, | ||
Command::CommandID | cmdid | ||
) | [private, virtual] |
References Sirikata::Command::EmptyResult(), and Sirikata::Command::Commander::result().
SimpleObjectQueryProcessor * Sirikata::OH::Simple::SimpleObjectQueryProcessor::create | ( | ObjectHostContext * | ctx, |
const String & | args | ||
) | [static] |
References SimpleObjectQueryProcessor().
Referenced by init().
bool Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleLocationMessage | ( | const HostedObjectPtr & | self, |
const SpaceObjectReference & | spaceobj, | ||
const std::string & | paylod | ||
) | [private] |
References Sirikata::OH::ObjectQueryProcessor::deliverLocationUpdate(), mContext, mObjectStateMap, Sirikata::SpaceObjectReference::object(), Sirikata::ObjectHostContext::objectHost, SOQP_LOG, Sirikata::SpaceObjectReference::space(), and Sirikata::Logging::warn.
Referenced by handleLocationSubstreamRead().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleLocationSubstream | ( | const HostedObjectWPtr & | weakSelf, |
const SpaceObjectReference & | spaceobj, | ||
int | err, | ||
SSTStreamPtr | s | ||
) | [private] |
References handleLocationSubstreamRead().
Referenced by presenceConnectedStream().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleLocationSubstreamRead | ( | const HostedObjectWPtr & | weakSelf, |
const SpaceObjectReference & | spaceobj, | ||
SSTStreamPtr | s, | ||
std::stringstream * | prevdata, | ||
uint8 * | buffer, | ||
int | length | ||
) | [private] |
References Sirikata::Logging::detailed, handleLocationMessage(), and SOQP_LOG.
Referenced by handleLocationSubstream().
bool Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleProximityMessage | ( | HostedObjectPtr | self, |
const SpaceObjectReference & | spaceobj, | ||
const std::string & | payload | ||
) | [private] |
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleProximitySubstream | ( | const HostedObjectWPtr & | weakSelf, |
const SpaceObjectReference & | spaceobj, | ||
int | err, | ||
SSTStreamPtr | s | ||
) | [private] |
References handleProximitySubstreamRead().
Referenced by presenceConnectedStream().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleProximitySubstreamRead | ( | const HostedObjectWPtr & | weakSelf, |
const SpaceObjectReference & | spaceobj, | ||
SSTStreamPtr | s, | ||
String * | prevdata, | ||
uint8 * | buffer, | ||
int | length | ||
) | [private] |
References Sirikata::Logging::detailed, handleProximityMessage(), Sirikata::Network::Frame::parse(), and SOQP_LOG.
Referenced by handleProximitySubstream().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::handleStop | ( | ) | [private] |
References mObjectStateMap.
Referenced by stop().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::onOrphanLocUpdate | ( | const LocUpdate & | lu, |
const SpaceObjectReference & | observer | ||
) | [virtual] |
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::presenceConnectedStream | ( | HostedObjectPtr | ho, |
const SpaceObjectReference & | sporef, | ||
HostedObject::SSTStreamPtr | strm | ||
) | [virtual] |
Invoked by the ObjectHost when an object's presence is connected to the space and the underlying stream has been fully established.
Reimplemented from Sirikata::OH::ObjectQueryProcessor.
References handleLocationSubstream(), handleProximitySubstream(), mContext, mObjectStateMap, OBJECT_PORT_LOCATION, and OBJECT_PORT_PROXIMITY.
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::presenceDisconnected | ( | HostedObjectPtr | ho, |
const SpaceObjectReference & | sporef | ||
) | [virtual] |
Invoked by the ObjectHost when an object's presence has been disconnected from the space.
Reimplemented from Sirikata::OH::ObjectQueryProcessor.
References mObjectStateMap.
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::start | ( | ) | [virtual] |
Implements Sirikata::Service.
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::stop | ( | ) | [virtual] |
Implements Sirikata::Service.
References handleStop(), Sirikata::Context::mainStrand, mContext, and Sirikata::Network::IOStrand::post().
void Sirikata::OH::Simple::SimpleObjectQueryProcessor::updateQuery | ( | HostedObjectPtr | ho, |
const SpaceObjectReference & | sporef, | ||
const String & | new_query | ||
) | [virtual] |
Request an update to the query parameters for the specified presence.
ho | the HostedObject requesting the update |
sporef | the ID of the presence to update a query for |
new_query | the encoded, updated query |
Implements Sirikata::OH::ObjectQueryProcessor.
References Sirikata::ObjectHost::getSpaceStream(), mContext, Sirikata::SpaceObjectReference::object(), OBJECT_PORT_PROXIMITY, Sirikata::ObjectHostContext::objectHost, Sirikata::serializePBJMessage(), and Sirikata::SpaceObjectReference::space().
Referenced by handleLocationMessage(), presenceConnectedStream(), stop(), and updateQuery().