ServiceDefinition Class Reference

#include <Pt/Remoting/ServiceDefinition.h>

Remote service definition. More...

Inherits NonCopyable, and NonCopyable.

Inherited by ServiceDefinition.

Public Member Functions

 ServiceDefinition ()
 Constructor.
 
virtual ~ServiceDefinition ()
 Destructor.
 
template<typename A >
void registerActiveProcedure (const std::string &name, A *(*func)(Responder &))
 Registers a function as an asynchronous procedure. More...
 
template<typename A , class C >
void registerActiveProcedure (const std::string &name, C &obj, A *(C::*mth)(Responder &))
 Registers a member function as an asynchronous procedure. More...
 
template<typename A , class C >
void registerActiveProcedure (const std::string &name, C &obj, A *(C::*mth)(Responder &) const )
 Registers a const member function as an asynchronous procedure. More...
 
template<typename R , typename... ARGS>
void registerProcedure (const std::string &name, R(*func)(ARGS...))
 Registers a function as a synchronous procedure. More...
 
template<typename R , class C , typename... ARGS>
void registerProcedure (const std::string &name, C &obj, R(C::*mth)(ARGS...))
 Registers a member function as a synchronous procedure. More...
 
template<typename R , typename... ARGS>
void registerProcedure (const std::string &name, const Callable< R, ARGS...> &cb)
 Registers a generic callable as a synchronous procedure. More...
 

Detailed Description

The remote service provides a number of service procedures to its clients. Regular C++ functions or methods can be registered as service procedures, but in many cases a derived service simply registers member functions. The RPC requests are then dispatched according to the name of the registered procedures. The arguments and return values must be serializable, for example by supporting serialization to a SerializationInfo. The service supports synchronous and asynchronous procedures, where the latter ones are factories for ActiveProcedure objects.

Member Function Documentation

void registerProcedure ( const std::string &  name,
R(*)(ARGS...)  func 
)

Registers the function func as a service procedure named name. Functions with up to ten arguments are supported. The template parameter ARGS expands to the argument types of the funtcions signature.

void registerProcedure ( const std::string &  name,
C &  obj,
R(C::*)(ARGS...)  mth 
)

Registers the method mth of the object instance obj as a service procedure named name. Methods with up to ten arguments are supported. The template parameter ARGS expands to the argument types of the methods signature.

void registerProcedure ( const std::string &  name,
const Callable< R, ARGS...> &  cb 
)

Registers the callable cb as a service procedure named name. Callables with up to ten arguments are supported. The template parameter ARGS expands to the argument types of the signature.

void registerActiveProcedure ( const std::string &  name,
A *(*)(Responder &)  func 
)

Registers the function func as an asynchronous service procedure named name. Asynchronous service procedures return an instance of an ActiveProcedure created with default new. The Responder needs to be passed to the constructed ActiveProcedure.

void registerActiveProcedure ( const std::string &  name,
C &  obj,
A *(C::*)(Responder &)  mth 
)

Registers the method mth of the object instance obj as an asynchronous service procedure named name. Asynchronous service procedures return an instance of an ActiveProcedure created with default new. The Responder needs to be passed to the constructed ActiveProcedure.

void registerActiveProcedure ( const std::string &  name,
C &  obj,
A *(C::*)(Responder &) const  mth 
)

Registers the method mth of the object instance obj as an asynchronous service procedure named name. Asynchronous service procedures return an instance of an ActiveProcedure created with default new. The Responder needs to be passed to the constructed ActiveProcedure.