Sirikata
|
00001 // Copyright (c) 2011 Sirikata Authors. All rights reserved. 00002 // Use of this source code is governed by a BSD-style license that can 00003 // be found in the LICENSE file. 00004 00005 #ifndef _SIRIKATA_OH_OBJECT_QUERY_PROCESSOR_HPP_ 00006 #define _SIRIKATA_OH_OBJECT_QUERY_PROCESSOR_HPP_ 00007 00008 #include <sirikata/oh/Platform.hpp> 00009 #include <sirikata/oh/HostedObject.hpp> 00010 #include <sirikata/core/service/Service.hpp> 00011 #include <sirikata/core/util/Factory.hpp> 00012 00013 #include <sirikata/pintoloc/BaseProxCommandable.hpp> 00014 00015 namespace Sirikata { 00016 00017 namespace Protocol { 00018 namespace Prox { 00019 class ProximityResults; 00020 } 00021 namespace Loc { 00022 class BulkLocationUpdate; 00023 } 00024 } 00025 00026 namespace OH { 00027 00044 class SIRIKATA_OH_EXPORT ObjectQueryProcessor : 00045 public Service, 00046 public Pinto::BaseProxCommandable 00047 { 00048 public: 00049 typedef HostedObject::SSTStreamPtr SSTStreamPtr; 00050 typedef HostedObject::SSTConnectionPtr SSTConnectionPtr; 00051 00052 ObjectQueryProcessor(Context* ctx); 00053 virtual ~ObjectQueryProcessor(); 00054 00055 // Connection/disconnection to track unrequested 00056 00062 virtual void presenceConnected(HostedObjectPtr ho, const SpaceObjectReference& sporef); 00067 virtual void presenceConnectedStream(HostedObjectPtr ho, const SpaceObjectReference& sporef, SSTStreamPtr strm); 00071 virtual void presenceDisconnected(HostedObjectPtr ho, const SpaceObjectReference& sporef); 00072 00073 00088 virtual String connectRequest(HostedObjectPtr ho, const SpaceObjectReference& sporef, const String& query); 00089 00095 virtual void updateQuery(HostedObjectPtr ho, const SpaceObjectReference& sporef, const String& new_query) = 0; 00096 00097 protected: 00104 void deliverProximityUpdate(HostedObjectPtr ho, const SpaceObjectReference& sporef, const Sirikata::Protocol::Prox::ProximityUpdate& update); 00105 00112 void deliverLocationUpdate(HostedObjectPtr ho, const SpaceObjectReference& sporef, const LocUpdate& lu); 00113 }; 00114 00115 00116 class SIRIKATA_OH_EXPORT ObjectQueryProcessorFactory 00117 : public AutoSingleton<ObjectQueryProcessorFactory>, 00118 public Factory2<ObjectQueryProcessor*, ObjectHostContext*, const String&> 00119 { 00120 public: 00121 static ObjectQueryProcessorFactory& getSingleton(); 00122 static void destroy(); 00123 }; 00124 00125 } // namespace OH 00126 } // namespace Sirikata 00127 00128 #endif //_SIRIKATA_OH_OBJECT_QUERY_PROCESSOR_HPP_