bool TestGraphModify::check_arc_creation() { assert(SC_ADDR_IS_NOT_EMPTY(mGraphAddr)); sc_addr arc, v1, v2; // create if (sc_graph_create_vertex(mGraphAddr, &v1) != SC_RESULT_OK) return false; if (sc_graph_create_vertex(mGraphAddr, &v2) != SC_RESULT_OK) return false; if (sc_graph_create_arc(mGraphAddr, v1, v2, &arc) != SC_RESULT_OK) return false; // check if (sc_graph_check_arc(mGraphAddr, arc) != SC_RESULT_OK) return false; sc_iterator5 *it5 = sc_iterator5_f_a_f_a_f_new(v1, sc_type_arc_common | sc_type_const, v2, sc_type_arc_pos_const_perm, mGraphAddr); int count = 0; while (sc_iterator5_next(it5) == SC_TRUE) count++; sc_iterator5_free(it5); return count == 1; }
//scp_result searchElStr5_f_f_f_a_a(scp_operand *param1, scp_operand *param2, scp_operand *param3, scp_operand *param4, scp_operand *param5){} //scp_result searchElStr5_f_f_a_f_a(scp_operand *param1, scp_operand *param2, scp_operand *param3, scp_operand *param4, scp_operand *param5){} //scp_result searchElStr5_f_f_a_a_f(scp_operand *param1, scp_operand *param2, scp_operand *param3, scp_operand *param4, scp_operand *param5){} //scp_result searchElStr5_f_a_f_f_a(scp_operand *param1, scp_operand *param2, scp_operand *param3, scp_operand *param4, scp_operand *param5){} scp_result searchElStr5_f_a_f_a_f(scp_operand *param1, scp_operand *param2, scp_operand *param3, scp_operand *param4, scp_operand *param5) { sc_iterator5 *it = sc_iterator5_f_a_f_a_f_new(param1->addr, param2->element_type, param3->addr, param4->element_type, param5->addr); if (SC_TRUE == sc_iterator5_next(it)) { param2->addr = sc_iterator5_value(it, 1); param4->addr = sc_iterator5_value(it, 3); sc_iterator5_free(it); return SCP_RESULT_TRUE; } sc_iterator5_free(it); return SCP_RESULT_FALSE; }
sc_result search_incident_vertex_arc(sc_addr graph, sc_addr vertex, sc_addr_list **listArc) { sc_iterator3 *it3; sc_iterator5 *it5; sc_type arc_type; sc_addr sc_graph_keynode_rrel; if (sc_helper_check_arc(sc_graph_keynode_not_oriented_graph, graph, sc_type_arc_pos_const_perm)) { arc_type = sc_type_edge_common; sc_graph_keynode_rrel = sc_graph_keynode_rrel_edge; } else if (sc_helper_check_arc(sc_graph_keynode_oriented_graph, graph, sc_type_arc_pos_const_perm)) { arc_type = sc_type_arc_common; sc_graph_keynode_rrel = sc_graph_keynode_rrel_arc; } it3 = sc_iterator3_f_a_a_new(vertex, arc_type, sc_type_node); while(sc_iterator3_next(it3) == SC_TRUE) { it5 = sc_iterator5_f_a_f_a_f_new(graph, sc_type_arc_pos, it3->results[1], sc_type_arc_pos, sc_graph_keynode_rrel); while(sc_iterator5_next(it5) == SC_TRUE) { *listArc = sc_addr_list_append(*listArc); (*listArc)->value = it5->results[2]; } } sc_iterator5_free(it5); sc_iterator3_free(it3); return SC_RESULT_OK; }
template<> TIterator5<Addr, sc_type, Addr, sc_type, Addr>::TIterator5(MemoryContext const & context, Addr const & p1, sc_type const & p2, Addr const & p3, sc_type const & p4, Addr const & p5) { mIterator = sc_iterator5_f_a_f_a_f_new(context.getRealContext(), p1.mRealAddr, p2, p3.mRealAddr, p4, p5.mRealAddr); }
void search_typical_sc_neighborhood(sc_addr elem, sc_addr answer, sc_bool sys_off) { sc_iterator3 *it1, *it0; sc_iterator5 *it5; sc_bool found = SC_FALSE; // search for keynode_typical_sc_neighborhood it0 = sc_iterator3_a_a_f_new(sc_type_node | sc_type_const, sc_type_arc_pos_const_perm, elem); while (sc_iterator3_next(it0) == SC_TRUE) { if (SC_ADDR_IS_EQUAL(sc_iterator3_value(it0, 0), keynode_typical_sc_neighborhood)) { found = SC_TRUE; // iterate input arcs for elem it1 = sc_iterator3_f_a_a_new(elem, sc_type_arc_pos_const_perm, 0); while (sc_iterator3_next(it1) == SC_TRUE) { if (sys_off == SC_TRUE && (IS_SYSTEM_ELEMENT(sc_iterator3_value(it1, 1)) || IS_SYSTEM_ELEMENT(sc_iterator3_value(it1, 2)))) continue; appendIntoAnswer(answer, sc_iterator3_value(it1, 1)); appendIntoAnswer(answer, sc_iterator3_value(it1, 2)); } sc_iterator3_free(it1); appendIntoAnswer(answer, sc_iterator3_value(it0, 1)); appendIntoAnswer(answer, sc_iterator3_value(it0, 0)); continue; } if (sys_off == SC_TRUE && (IS_SYSTEM_ELEMENT(sc_iterator3_value(it0, 0)) || IS_SYSTEM_ELEMENT(sc_iterator3_value(it0, 1)))) continue; it5 = sc_iterator5_f_a_f_a_f_new(keynode_sc_neighborhood, sc_type_arc_common | sc_type_const, sc_iterator3_value(it0, 0), sc_type_arc_pos_const_perm, keynode_nrel_inclusion); if (sc_iterator5_next(it5) == SC_TRUE) { if (sys_off == SC_TRUE && (IS_SYSTEM_ELEMENT(sc_iterator5_value(it5, 1)) || IS_SYSTEM_ELEMENT(sc_iterator5_value(it5, 3)))) continue; appendIntoAnswer(answer, sc_iterator3_value(it0, 0)); appendIntoAnswer(answer, sc_iterator3_value(it0, 1)); appendIntoAnswer(answer, sc_iterator5_value(it5, 1)); appendIntoAnswer(answer, sc_iterator5_value(it5, 3)); } sc_iterator5_free(it5); } sc_iterator3_free(it0); if (found == SC_TRUE) { appendIntoAnswer(answer, keynode_typical_sc_neighborhood); } }
scp_iterator5 *scp_iterator5_new(sc_memory_context *context, scp_operand *param1, scp_operand *param2, scp_operand *param3, scp_operand *param4, scp_operand *param5) { sc_uint32 fixed1 = 0; sc_uint32 fixed3 = 0; sc_uint32 fixed5 = 0; long fixed = 0; if (param2->param_type == SCP_FIXED) { print_error("SCP ITERATOR 5 NEW", "Parameter 2 must have ASSIGN modifier"); return null_ptr; ; } if (param4->param_type == SCP_FIXED) { print_error("SCP ITERATOR 5 NEW", "Parameter 4 must have ASSIGN modifier"); return null_ptr; ; } if (param1->param_type == SCP_FIXED) { if (SC_FALSE == sc_memory_is_element(context, param1->addr)) { print_error("SCP ITERATOR 5 NEW", "Parameter 1 has modifier FIXED, but has not value"); return null_ptr; } fixed1 = 0x1; } if (param3->param_type == SCP_FIXED) { if (SC_FALSE == sc_memory_is_element(context, param3->addr)) { print_error("SCP ITERATOR 5 NEW", "Parameter 3 has modifier FIXED, but has not value"); return null_ptr; } fixed3 = 0x100; } if (param5->param_type == SCP_FIXED) { if (SC_FALSE == sc_memory_is_element(context, param5->addr)) { print_error("SCP ITERATOR 5 NEW", "Parameter 5 has modifier FIXED, but has not value"); return null_ptr; } fixed5 = 0x10000; } fixed = (fixed1 | fixed3 | fixed5); switch (fixed) { case 0x00001: return (scp_iterator5 *)sc_iterator5_f_a_a_a_a_new(context, param1->addr, param2->element_type, param3->element_type, param4->element_type, param5->element_type); case 0x00100: return (scp_iterator5 *)sc_iterator5_a_a_f_a_a_new(context, param1->element_type, param2->element_type, param3->addr, param4->element_type, param5->element_type); case 0x10001: return (scp_iterator5 *)sc_iterator5_f_a_a_a_f_new(context, param1->addr, param2->element_type, param3->element_type, param4->element_type, param5->addr); case 0x10100: return (scp_iterator5 *)sc_iterator5_a_a_f_a_f_new(context, param1->element_type, param2->element_type, param3->addr, param4->element_type, param5->addr); case 0x00101: return (scp_iterator5 *)sc_iterator5_f_a_f_a_a_new(context, param1->addr, param2->element_type, param3->addr, param4->element_type, param5->element_type); case 0x10101: return (scp_iterator5 *)sc_iterator5_f_a_f_a_f_new(context, param1->addr, param2->element_type, param3->addr, param4->element_type, param5->addr); default: print_error("SCP ITERATOR 5 NEW", "Unsupported parameter type combination"); return null_ptr; } }