S3FC project page S3FC home page

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

s3_rpc_client Class Template Reference

#include <s3_rpc.h>

Collaboration diagram for s3_rpc_client:

Collaboration graph
[legend]
List of all members.

Public Methods

 s3_rpc_client (const std::string &n_server_name)
 Initialising constructor: Instantiate an RPC client that invokes calls on a single RPC server instance. More...

 ~s3_rpc_client ()
 Destructor: disconnect from the postal system and clean up. More...

std::string call (const std::string &method)
 Remotely invoke a method accepting no arguments (void) on an instance controlled by an RPC server (with name name). More...

template<typename T_arg1> std::string call (const std::string &method, const T_arg1 &arg1)
 Remotely invoke a method accepting a single argument on an instance controlled by an RPC server (with name name). More...

template<typename T_arg1, typename T_arg2> std::string call (const std::string &method, const T_arg1 &arg1, const T_arg2 &arg2)
 Remotely invoke a method accepting two arguments on an instance controlled by an RPC server (with name name). More...


Protected Methods

std::string call_common (const std::string &method, const std::string &args)
 Assemble a method name and packed argument string into a message body and dispatch to the server. More...

void assert_method_args (const std::string &where, const std::string &method, unsigned int num_args)
 Test to ensure that a remote method with the specified name exists and that it accepts the specified number of parameters. More...


Protected Attributes

s3_message_box mb
 Message box that dispatches RPC requests. More...

std::string server_name
 Name of server which invokes RPC calls. More...

s3_rpc_type_common< T_obj
>::callmap_t 
cmap
 Map between function names and callers that invoke the functions. More...

template<typename T_obj>
class s3_rpc_client< T_obj >


Constructor & Destructor Documentation

template<typename T_obj>
s3_rpc_client< T_obj >::s3_rpc_client const std::string &    n_server_name
 

Initialising constructor: Instantiate an RPC client that invokes calls on a single RPC server instance.

Parameters:
n_server_name  Name of RPC server on which to invoke methods.

Definition at line 340 of file s3_rpc.tcc.

References s3_message_box::connect, mb, s3_rpc_common::rpc_random_client_name, and s3_message_box::set_name.

template<typename T_obj>
s3_rpc_client< T_obj >::~s3_rpc_client  
 

Destructor: disconnect from the postal system and clean up.

Definition at line 363 of file s3_rpc.tcc.

References s3_rpc_type_common::clear_callmap, cmap, s3_message_box::disconnect, and mb.


Member Function Documentation

template<typename T_obj>
void s3_rpc_client< T_obj >::assert_method_args const std::string &    where,
const std::string &    method,
unsigned int    num_args
[protected]
 

Test to ensure that a remote method with the specified name exists and that it accepts the specified number of parameters.

An exception is thrown if these conditions are not met.

Parameters:
where  Location where this function is invoked.
method  Name of the method (must exist in cmap).
num_args  Number of arguments (must match with value reported by cmap[method]).

Definition at line 418 of file s3_rpc.tcc.

References cmap.

Referenced by call.

template<typename T_obj>
template<typename T_arg1, typename T_arg2>
std::string s3_rpc_client< T_obj >::call const std::string &    method,
const T_arg1 &    arg1,
const T_arg2 &    arg2
 

Remotely invoke a method accepting two arguments on an instance controlled by an RPC server (with name name).

Parameters:
method  Method name (as it appears in the RPC server callmap).
arg1  First function argument.
arg2  Second function argument.

Definition at line 393 of file s3_rpc.tcc.

References assert_method_args, and call_common.

template<typename T_obj>
template<typename T_arg1>
std::string s3_rpc_client< T_obj >::call const std::string &    method,
const T_arg1 &    arg1
 

Remotely invoke a method accepting a single argument on an instance controlled by an RPC server (with name name).

Parameters:
method  Method name (as it appears in the RPC server callmap).
arg1  First function argument.

Definition at line 380 of file s3_rpc.tcc.

References assert_method_args, and call_common.

template<typename T_obj>
std::string s3_rpc_client< T_obj >::call const std::string &    method
 

Remotely invoke a method accepting no arguments (void) on an instance controlled by an RPC server (with name name).

Parameters:
method  Method name (as it appears in the RPC server callmap).

Definition at line 371 of file s3_rpc.tcc.

References assert_method_args, and call_common.

template<typename T_obj>
std::string s3_rpc_client< T_obj >::call_common const std::string &    method,
const std::string &    args
[protected]
 

Assemble a method name and packed argument string into a message body and dispatch to the server.

Definition at line 408 of file s3_rpc.tcc.

References s3_rpc_common::cmd_tag_call, mb, s3_message_box::send_msg, and server_name.

Referenced by call.


Member Data Documentation

template<typename T_obj>
s3_rpc_type_common<T_obj>::callmap_t s3_rpc_client::cmap [protected]
 

Map between function names and callers that invoke the functions.

Definition at line 319 of file s3_rpc.h.

Referenced by assert_method_args, and ~s3_rpc_client.

template<typename T_obj>
s3_message_box s3_rpc_client::mb [protected]
 

Message box that dispatches RPC requests.

Definition at line 311 of file s3_rpc.h.

Referenced by call_common, s3_rpc_client, and ~s3_rpc_client.

template<typename T_obj>
std::string s3_rpc_client::server_name [protected]
 

Name of server which invokes RPC calls.

Definition at line 315 of file s3_rpc.h.

Referenced by call_common.


The documentation for this class was generated from the following files:
Send comments to: s3fc@stonethree.com SourceForge Logo