rax_type_new_2

rax_type_t rax_type_new_2(e_rax_base_t base_type,
 void *extra_arg);
 

Create a new Rax composite type - a set type or a tuple type. If base_type is rax_e_base_oset, the extra_arg should contain the type of the set element. If base_type is rax_e_base_oset, the extra_arg should be a tuple field (of type rax_tfield_t). The extra_arg can also be NULL in this case.

Examples: 

// Create a set of numbers
//
rax_type_t type_number = rax_type_new_1(rax_e_base_number);
rax_type_t type_set_of_numbers = rax_type_new_2(rax_e_base_oset,type_number);
rax_type_drop(&type_number); // Remember to clean up;

// Create a set of tuples: {[#:id, $:name]}
//
rax_type_t type_number = rax_type_new_1(rax_e_base_number);
rax_type_t type_string = rax_type_new_1(rax_e_base_string);
rax_tfield_t tfield1 = rax_tfield_new(type_number, "id");
rax_tfield_t tfield2 = rax_tfield_new(type_string, "name");
rax_type_t type_tuple = rax_type_new_2(rax_e_base_tuple, NULL);
rax_type_tuple_add_tfield(&type_tuple, tfield1);
rax_type_tuple_add_tfield(&type_tuple, tfield2);
rax_type_t type_oset = rax_type_new_2(rax_e_base_oset, type_tuple);
// Clean up all the auxiliary values
rax_type_drop(&type_tuple);
rax_tfield_drop(&tfield1);
rax_tfield_drop(&tfield2);
rax_type_drop(&type_string);
rax_type_drop(&type_number);