RTOpPack: Extra C/C++ Code for Vector Reduction/Transformation Operators
Version of the Day
|
#include <RTOp.h>
Public Attributes | |
int(* | get_obj_type_num_entries )(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, int *num_values, int *num_indexes, int *num_chars) |
int(* | obj_create )(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj) |
int(* | obj_reinit )(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void *obj) |
int(* | obj_free )(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj) |
int(* | extract_state )(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void *obj, int num_values, RTOp_value_type value_data[], int num_indexes, RTOp_index_type index_data[], int num_chars, RTOp_char_type char_data[]) |
int(* | load_state )(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, 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[], void **obj) |
Vitual function table for manipulating a simple object and externalizing its structure.
The functions pointed to in this table create, initialize and destroy a simple object (some struct) and also the structure of the object. Functions are also declared for allowing the state of the objects to be externalized into a simple portable format. This virtual function pointer table is used for the object instance data for RTOp_RTOp objects and also for the manipulation of reduction objects. Since it is expected that the same type of structure can be used and reused in several different contexts, they all share this same virtual function table type.
The uses of these functions and the meanings of their arguments may depend on the context of where the vtbl is used.
int(* RTOp_obj_type_vtbl_t::get_obj_type_num_entries)(const struct RTOp_obj_type_vtbl_t *vtbl,const void *instance_data,int *num_values,int *num_indexes,int *num_chars) |
Returns the number of entries of each type of member that defines the externalized object state.
This function returns the number of entries of values, indexes and characters (see above) that defines the externalized object state.
When this vtbl is used to handle the instance data for an RTOp_RTOp
class, the function arguments have the following meaning:
vtbl
[in] Virtual function table for the operator's data vtbl. instance_data
[in] This is the instance data for the operator object RTOp_RTOp::obj_data
num_values
[out] Number of RTOp_value_type
members in the object. num_indexes
[out] Number of RTOp_index_type
members in the object. num_chars
[out] Number of RTOp_char_type
members in the object. When this vtbl is used to handle the reduction object the function arguments have the following meaning:
vtbl
[in] Virtual function table for the reduction objects vtbl. instance_data
[in] This is the instance data for the operator object RTOp_RTOp::obj_data
num_values
[out] Number of RTOp_value_type
members in the reduction object. num_indexes
[out] Number of RTOp_index_type
members in the reduction object. num_chars
[out] Number of RTOp_char_type
members in the reduction object. If the object is NULL
and contains no data, the num_values = 0
, num_indexes = 0
and num_chars = 0
on return.
0
if successful and !=0
otherwise. int(* RTOp_obj_type_vtbl_t::obj_create)(const struct RTOp_obj_type_vtbl_t *vtbl,const void *instance_data,void **obj) |
Create (dynamically) an object of this type.
When this vtbl is used to handle the instance data for an RTOp_RTOp
class, the function arguments have the following meaning:
vtbl
[in] Virtual function table for the operator's data vtbl. instance_data
[in] This is ignored obj
[out] *obj
points to the allocated state data to RTOp_RTOp::obj_data
. When this vtbl is used to handle the reduction target object for an RTOp_RTOp
class, the function arguments have the following meaning:
vtbl
[in] Virtual function table for the reduction objects vtbl. instance_data
[in] This is the instance data from RTOp_RTOp::obj_data
obj
[out] The allocated reduction object for the RTOp_RTOp:
operator object. If the object is NULL
and contains no data, then *obj == NULL
on return.
0
if successful and !=0
otherwise. int(* RTOp_obj_type_vtbl_t::obj_reinit)(const struct RTOp_obj_type_vtbl_t *vtbl,const void *instance_data,void *obj) |
Reinitialize an object of this type.
If get_obj_type_num_entries(ob,...)
returns num_values = 0
, num_indexes = 0
and num_chars = 0
then this function does nothing and obj
must be set to NULL
if called.
When this vtbl is used to handle the instance data for a RTOp_RTOp
class, this function is optional. This function could be used in a reinitialization function for the RTOp_RTOp
object to reinitialize the object's instance data obj_data
. Or, the pointer to this function could be left as NULL since the client of the operator object can never directly call this function.
vtbl
[in] Virtual function table for the operator's data vtbl. instance_data
[in] Could be data passed into a reinitilaization function or more likely it is just ignored. obj
[in/out] The reinitialized object instance data. When this vtbl is used to handle the reduction object for an RTOp_RTOp
class, the function arguments have the following meaning:
vtbl
[in] Virtual function table for the reduction object's vtbl. instance_data
[in] This is the instance data from RTOp_RTOp::obj_data
obj
[in/out] The target object in reinitialized so some reasonable value, ready to participate in a reduction operation. 0
if successful and !=0
otherwise. int(* RTOp_obj_type_vtbl_t::obj_free)(const struct RTOp_obj_type_vtbl_t *vtbl,const void *instance_data,void **obj) |
Destroy an object of this type.
If get_obj_type_num_entries(ob,...)
returns num_values = 0
, num_indexes = 0
and num_chars = 0
then this function does nothing and obj
must be set to NULL
if called.
When this vtbl is used to handle the instance data for an RTOp_RTOp
class, this function is optional. This function could be used in a destructor function for the RTOp_RTOp
class to free the object's instance data obj_data
. Or, the pointer to this function could be left as NULL since the client of the operator object can never directly call this function.
vtbl
[in] Virtual function table for the operator's data vtbl. instance_data
[in] This is completely ignored and is not needed for anything. obj
[in/out] The instance data from RTOp_RTOp::obj_data
or RTOp_TransOp::obj_data
to be freed and set to NULL
on output. When this vtbl is used to handle the reduction object for an RTOp_RTOp
class, the function arguments have the following meaning:
vtbl
[in] Virtual function table for the reduction object's vtbl. instance_data
[in] This is the instance data from RTOp_RTOp::obj_data
obj
[in/out] The target object to be destroyed and set to RTOp_REDUCT_OBJ_NULL
on output. 0
if successful and !=0
otherwise. int(* RTOp_obj_type_vtbl_t::extract_state)(const struct RTOp_obj_type_vtbl_t *vtbl,const void *instance_data,void *obj,int num_values,RTOp_value_type value_data[],int num_indexes,RTOp_index_type index_data[],int num_chars,RTOp_char_type char_data[]) |
Externalize the state of the object to a portable format.
This function must be called on an initalized object. It is very important that these data contain all the information needed to perform the reduction operation using the externalized MPI compatilble operator function returned from RTOp_get_reduct_op<tt>(...) when this is used for a reduction object used in a reduction operation.
vtbl | [in] this Virtual function table (or NULL). |
instance_data | [in] Points to the instance data for the RTOp operator object (or NULL). |
obj | [in[ Reduction object to be externalized. |
num_values | [in] Value returned from get_obj_type_num_entries(...) . |
value_data | [out] Array (size num_values ) of floating point data. |
num_indexes | [in] Value returned from get_obj_type_num_entries(...) . |
index_data | [out] Array (size num_indexes ) of integral data. |
num_chars | [in] Value returned from get_obj_type_num_entries(...) . |
char_data | [out] Array (size num_chars ) of character data. |
0
if successful, !=0
otherwise. int(* RTOp_obj_type_vtbl_t::load_state)(const struct RTOp_obj_type_vtbl_t *vtbl,const void *instance_data,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[],void **obj) |
Load the state of the object from a portable format.
This function can be called on an already constructed object (*instance_data != NULL
) or a NULL object (*instance_data == NULL
).
vtbl | [in] this Virtual function table (or NULL). |
instance_data | [in] Points to the instance data for the RTOp operator object (or NULL). |
num_values | [in] Value returned from get_obj_type_num_entries(...) . |
value_data | [in] Array (size num_values ) of floating point data. |
num_indexes | [in] Value returned from get_obj_type_num_entries(...) . |
index_data | [in] Array (size num_indexes ) of integral data. |
num_chars | [in] Value returned from get_obj_type_num_entries(...) . |
char_data | [in] Array (size num_chars ) of character data. |
obj | [in/out] On input if *obj != NULL then it will be assumed that this is an initialized object and it will be internally type casted into an expected type. If the current object pointed to by *obj has insufficient size to load the given state or *obj == NULL on input then free(*obj) will be called and then *obj = malloc(...) will be called to allocate the proper size object. Therefore, on output, the pointer *obj may be changed from its initial value if need be. |
0
if successful, !=0
otherwise.