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_LIBCORE_OHDP_SERVICE_HPP_ 00006 #define _SIRIKATA_LIBCORE_OHDP_SERVICE_HPP_ 00007 00008 #include <sirikata/core/ohdp/Defs.hpp> 00009 #include <sirikata/core/xdp/Port.hpp> 00010 00011 namespace Sirikata { 00012 namespace OHDP { 00013 00014 typedef Sirikata::XDP::Port<Endpoint> Port; 00015 00025 class SIRIKATA_EXPORT Service { 00026 public: 00027 typedef Endpoint::MessageHandler MessageHandler; 00028 00029 virtual ~Service() {} 00030 00040 virtual Port* bindOHDPPort(const SpaceID& space, const NodeID& node, PortID port) = 0; 00041 00046 Port* bindOHDPPort(const SpaceID& space, PortID port) { 00047 return bindOHDPPort(space, NodeID::self(), port); 00048 } 00049 00054 Port* bindOHDPPort(PortID port) { 00055 return bindOHDPPort(SpaceID::null(), NodeID::self(), port); 00056 } 00057 00065 virtual Port* bindOHDPPort(const SpaceID& space, const NodeID& node) = 0; 00066 00068 virtual PortID unusedOHDPPort(const SpaceID& space, const NodeID& node) = 0; 00069 00076 virtual void registerDefaultOHDPHandler(const MessageHandler& cb) = 0; 00077 00078 }; // class Service 00079 00080 } // namespace OHDP 00081 } // namespace Sirikata 00082 00083 #endif //_SIRIKATA_LIBCORE_OHDP_SERVICE_HPP_