Sirikata
|
OHDP::Service is the interface provided by classes that are able to send OHDP messages. More...
#include <Service.hpp>
Public Types | |
typedef Endpoint::MessageHandler | MessageHandler |
Public Member Functions | |
virtual | ~Service () |
virtual Port * | bindOHDPPort (const SpaceID &space, const NodeID &node, PortID port)=0 |
Bind an OHDP port for use. | |
Port * | bindOHDPPort (const SpaceID &space, PortID port) |
Convenience form of OHDP port binding since only NodeID::self() is ever valid for binding a Port (the local endpoint in OHDP is always NodeID::self() i.e. | |
Port * | bindOHDPPort (PortID port) |
Convenience form of OHDP port binding for when the SpaceID and NodeID are ignored because there is only one choice (e.g. | |
virtual Port * | bindOHDPPort (const SpaceID &space, const NodeID &node)=0 |
Bind a random, unused OHDP port for use. | |
virtual PortID | unusedOHDPPort (const SpaceID &space, const NodeID &node)=0 |
Get a random, unused OHDP port. | |
virtual void | registerDefaultOHDPHandler (const MessageHandler &cb)=0 |
Register a handler for messages that arrive on unbound ports. |
OHDP::Service is the interface provided by classes that are able to send OHDP messages.
OHDP::Service mainly handles management of OHDP::Ports, which in turn allow sending and receiving of OHDP messages.
A Service allocates Ports and (behind the scenes) handles requests on the Ports, but once allocated the Port is owned by the allocator. The allocator is responsible for deleting all allocated Ports, even if the Service that generated them was destroyed.
virtual Sirikata::OHDP::Service::~Service | ( | ) | [inline, virtual] |
virtual Port* Sirikata::OHDP::Service::bindOHDPPort | ( | const SpaceID & | space, |
const NodeID & | node, | ||
PortID | port | ||
) | [pure virtual] |
Bind an OHDP port for use.
space | the Space to communicate via |
node | the node to communicate via |
port | the PortID to attempt to bind |
PortAllocationError | if the Service cannot allocate the port for some reason other than it already being allocated. |
Implemented in Sirikata::OHDP::DelegateService, and Sirikata::ObjectHost.
Referenced by Sirikata::TimeSyncClient::TimeSyncClient(), and Sirikata::TimeSyncServer::TimeSyncServer().
Convenience form of OHDP port binding since only NodeID::self() is ever valid for binding a Port (the local endpoint in OHDP is always NodeID::self() i.e.
0).
References Sirikata::OHDP::NodeID::self().
virtual Port* Sirikata::OHDP::Service::bindOHDPPort | ( | const SpaceID & | space, |
const NodeID & | node | ||
) | [pure virtual] |
Bind a random, unused OHDP port for use.
space | the Space to communicate via |
PortAllocationError | if the Service cannot allocate the port for some reason other than it already being allocated. |
Implemented in Sirikata::OHDP::DelegateService, and Sirikata::ObjectHost.
Convenience form of OHDP port binding for when the SpaceID and NodeID are ignored because there is only one choice (e.g.
on the space, where SpaceID is always null and NodeID is always self).
References Sirikata::SpaceID::null(), and Sirikata::OHDP::NodeID::self().
virtual void Sirikata::OHDP::Service::registerDefaultOHDPHandler | ( | const MessageHandler & | cb | ) | [pure virtual] |
Register a handler for messages that arrive on unbound ports.
By default there is no handler and such messages are ignored. Note that this handler will not be invoked for messages arriving at a bound port for which no handler has been registered.
cb | the handler for messages arriving at unbound ports |
Implemented in Sirikata::OHDP::DelegateService.
virtual PortID Sirikata::OHDP::Service::unusedOHDPPort | ( | const SpaceID & | space, |
const NodeID & | node | ||
) | [pure virtual] |
Get a random, unused OHDP port.
Implemented in Sirikata::OHDP::DelegateService, and Sirikata::ObjectHost.