RTOpPack: Extra C/C++ Code for Vector Reduction/Transformation Operators  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Functions
Collaboration diagram for RTOp_Server.:

Functions

int RTOp_Server_add_op_name_vtbl (const char op_class_name[], const struct RTOp_RTOp_vtbl_t *op_class_vtbl)
 
int RTOp_Server_lookup_op_name (const struct RTOp_RTOp_vtbl_t *op_class_vtbl, char op_class_name[])
 
int RTOp_Server_construct_op (const char op_class_name[], int num_values, const RTOp_value_type value_data[], int num_indexes, const RTOp_index_type index_data[], int num_chars, const RTOp_char_type char_data[], struct RTOp_RTOp *op)
 
void RTOp_Server_dump (FILE *file)
 

Detailed Description

Singleton object that aids in the transport and reconstruction of reduction/transformation operators in a distributed environment.

This is a singleton object that must be initialized in every process in a distributed client/server application where reduction/transformation operators are used. This object can be used by a abstract vector implementation to transparently take a reduction/transformation operator object created by the client in one process, and then have this operator object transported over a network and be reconstructed in all of the processes where the operator needs to be applied. This object only supplies the basic functions for setting up the RTOp_Server object with operator class names and vtbl pointers, querying for an operator class name given its vtbl pointer and then reconstructing an operator object given its instance data and the name of its operator class.

This object is implemented as a singleton object since only one of these objects needs to be instantiated in each process.

Function Documentation

int RTOp_Server_add_op_name_vtbl ( const char  op_class_name[],
const struct RTOp_RTOp_vtbl_t op_class_vtbl 
)

Function for adding an operator class name and virtual function table pointer.

The user or client of an abstract vector is responsible for calling these functions to setup the RTOp_Server object with the names and vtbl pointers for each of the reduction/transformation operator classes that will be used with the abstract abstract vectors. This initialization must take place in each of the processes where these operators are used.

Several different unrelated clients of abstract vectors can call these functions for the operators they use. For example, an optimization algorithm and a nonlinear equation solver algorithm may both call these functions to initialize the RTOp_Server object for the reduction/transformation operator classes they use. It is very likely that many of these operator classes may be the same and this interface allows the same operator class to be added more than once with no harm. Unrelated client packages may however use the same name for different classes by accident in which case these function will flag the problem when they are added. Therefore, as long as careful names for operator classes are used, then several different client packages can coexist in the same program.

Preconditions:

  • strlen(op_class_name) <= RTOp_MAX_REDUCT_TRANS_OP_CLASS_NAME
  • op_class_vtbl != NULL
Parameters
op_class_name[in] Name (null terminated string) of the operator subclass. Should be unique from all other class names. This name must not be any longer than RTOp_MAX_REDUCT_TRANS_OP_CLASS_NAME.
op_class_vtbl[in] Pointer to the virtual function table for the operator subclass. This should also be unique from all other classes but there is no harm if it is not.
Returns
Returns 0 if the operator was successfully added. Returns >0 if the name op_class_name and pointer op_class_vtbl have already been added. Returns <0 if the pair could not be added due to some problem. If this function returns ::RTOp_SERVER_INCOMPATIBLE_OPS<tt> < 0 then the name op_class_name already exists but the pointer op_class_vtbl is not the same. If this function returns ::RTOp_SERVER_OP_NAME_TOO_LONG<tt> < 0 then op_class_name was longer than ::RTOp_MAX_REDUCT_TRANS_OP_CLASS_NAME.

Definition at line 453 of file RTOp.c.

int RTOp_Server_lookup_op_name ( const struct RTOp_RTOp_vtbl_t op_class_vtbl,
char  op_class_name[] 
)

Function for lookup up an operator class name given its vtbl pointer.

This function is used by a vector implementation to lookup the name of a reduction/transformation operator class given a pointer to its vtbl. This is needed in order to communicate the class name, along with the object instance data for an operator to other processes so that the operator object can be reconstructed and applied in these processes.

Parameters
op_class_vtbl[in] Pointer to the virtual function table for the operator subclass. This name must have been used in a previous call to RTOp_Server_add_op_name_vtbl(...)
op_class_name[out] Name (null terminated string) of the operator subclass. This array must contain at least RTOp_MAX_REDUCT_TRANS_OP_CLASS_NAME+1 entries that can be set. Note that there may be several names associated with a single op_class_vtbl. Which name is returned is implementation dependent.
Returns
Returns 0 if the operator class vtbl was successfully found. Returns <0 if vtbl could not be found.

Definition at line 472 of file RTOp.c.

int RTOp_Server_construct_op ( const char  op_class_name[],
int  num_values,
const RTOp_value_type  value_data[],
int  num_indexes,
const RTOp_index_type  index_data[],
int  num_chars,
const RTOp_char_type  char_data[],
struct RTOp_RTOp op 
)

Function for constructing an operator given its class name and instance data.

This function is used by the vector implementation to reconstruct reduction /transformation operators on remote processors where they need to be applied.

Parameters
op_class_name[in] Name (null terminated string) of the operator subclass. This name must have been used in a previous call to RTOp_Server_add_op_name_vtbl(...).
num_values[in] Returned from RTOp_extract_op_state<tt>(...)
value_data[in] Returned from RTOp_extract_op_state(...)
num_indexes[in] Returned from RTOp_extract_op_state(...)
index_data[in] Returned from RTOp_extract_op_state(...)
num_chars[in] Returned from RTOp_extract_op_state(...)
char_data[in] Returned from RTOp_extract_op_state(...)
op[out] On input, op->obj_data == NULL must be true. Constructed operator object. This object will be constructed using RTOp_load_op_state<tt>(...). To deallocate this object, use RTOp_free_op<tt>(...).
Returns
Returns >=0 if the operator object was successfully initialized. Returns <0 if the name op_class_name was not recognized.

Definition at line 484 of file RTOp.c.

void RTOp_Server_dump ( FILE *  file)

Dump the contents of the name/vtbl pairs for the reduction/transformation operator classes to a C stream (debugging purposes).

Definition at line 511 of file RTOp.c.