Parse the application's argv[] argument list and set cluster parameters accordingly.
MCO_RET sample_cluster_parse_opts( /*IN*/ int argc,
/*IN*/ char * argv[],
/*OUT*/ mco_cluster_params_t *cl_params,
/*OUT*/ mco_cluster_node_params_t *node_params,
/*IN*/ uint2 max_nodenum )
argc
argv
cl_params
mco_cluster_params_t struct to initialize.node_params
mco_cluster_node_params_t struct to initialize.max_nodenum
This function provides a simple method for initializing cluster parameters from the application's command
line arguments. It parses the list of arguments and sets the appropriate
mco_cluster_params_t and
mco_cluster_node_params_t elements.
MCO_S_OK
MCO_E_ILLEGAL_PARAM
#include <common.h> #include <commoncl.h> ... int main(int argc, char* argv[]) { MCO_RET rc; sample_memory_t dbmem; mco_runtime_start(); mco_cluster_init(); /* initialize and customize the cluster parameters */ mco_cluster_params_init(&cl_params); if (! sample_cluster_parse_opts(argc - 1, argv + 1, &cl_params, node_params, MCO_MAX_CLUSTER_SIZE)) { printf("Usage : \n\t%s [CLUSTER_OPTIONS] [<n_nodes>] <node_id>\nwhere node_id from 0 to (n_nodes - 1)\n", argv[0]); return 1; } sample_cluster_print_params(&cl_params); ... }