Sirikata
|
00001 // Copyright (c) 2012 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_MQ_OBJECT_QUERY_HANDLER_BASE_HPP_ 00006 #define _SIRIKATA_OH_MQ_OBJECT_QUERY_HANDLER_BASE_HPP_ 00007 00008 #include <sirikata/pintoloc/ReplicatedLocationServiceCache.hpp> 00009 #include <sirikata/oh/ObjectHostContext.hpp> 00010 00011 namespace Sirikata { 00012 namespace OH { 00013 namespace Manual { 00014 00015 class ManualObjectQueryProcessor; 00016 00020 class ObjectQueryHandlerBase : 00021 public Service, 00022 public Liveness 00023 { 00024 public: 00025 ObjectQueryHandlerBase(ObjectHostContext* ctx, ManualObjectQueryProcessor* parent, const OHDP::SpaceNodeID& space, Network::IOStrandPtr prox_strand); 00026 ~ObjectQueryHandlerBase(); 00027 00028 protected: 00029 00030 // BOTH Threads: These are read-only. 00031 00032 ObjectHostContext* mContext; 00033 const OHDP::SpaceNodeID mSpaceNodeID; 00034 00035 00036 // MAIN Thread: Utility methods that should only be called from the main 00037 // strand 00038 00039 ManualObjectQueryProcessor* mParent; 00040 00041 // Handle various events in the main thread that are triggered in the prox thread 00042 void handleAddObjectLocSubscription(Liveness::Token alive, const ObjectReference& subscriber, const ObjectReference& observed); 00043 void handleRemoveObjectLocSubscription(Liveness::Token alive, const ObjectReference& subscriber, const ObjectReference& observed); 00044 void handleRemoveAllObjectLocSubscription(Liveness::Token alive, const ObjectReference& subscriber); 00045 00046 // PROX Thread - Should only be accessed in methods used by the prox thread 00047 Network::IOStrandPtr mProxStrand; 00048 00049 }; // class ObjectQueryHandlerBase 00050 00051 } // namespace Manual 00052 } // namespace OH 00053 } // namespace Sirikata 00054 00055 #endif //_SIRIKATA_OH_MQ_OBJECT_QUERY_HANDLER_BASE_HPP_