void gen_data_config_add_report_step( gen_data_config_type * config , int report_step) { if (config->dynamic) { if (!gen_data_config_has_report_step( config , report_step)) { int_vector_append( config->active_report_steps , report_step ); int_vector_sort( config->active_report_steps ); } } }
void obs_vector_install_node(obs_vector_type * obs_vector , int index , void * node) { obs_vector_assert_node_type( obs_vector , node ); { if (vector_iget_const( obs_vector->nodes , index ) == NULL) { obs_vector->num_active++; int_vector_append( obs_vector->step_list , index ); int_vector_sort( obs_vector->step_list ); } vector_iset_owned_ref( obs_vector->nodes , index , node , obs_vector->freef ); } }
void test_contains_sorted() { int_vector_type * int_vector = int_vector_alloc( 0 , 100); int_vector_append( int_vector , 99 ); int_vector_append( int_vector , 89 ); int_vector_append( int_vector , 79 ); int_vector_append( int_vector , 109 ); int_vector_sort( int_vector ); test_assert_false( int_vector_contains( int_vector , 0 )); test_assert_false( int_vector_contains( int_vector , 100 )); test_assert_true( int_vector_contains( int_vector , 89 )); test_assert_true( int_vector_contains( int_vector , 109 )); }
void int_vector_select_unique(int_vector_type * vector) { int_vector_assert_writable( vector ); if (vector->size > 0) { int_vector_type * copy = int_vector_alloc_copy( vector ); int_vector_sort( copy ); int_vector_reset( vector ); { int i; int previous_value = int_vector_iget( copy , 0); int_vector_append( vector , previous_value); for (i=1; i < copy->size; i++) { int value = int_vector_iget( copy , i ); if (value != previous_value) int_vector_append( vector , value); previous_value = value; } } int_vector_free( copy ); } }
bool string_util_update_active_list( const char * range_string , int_vector_type * active_list ) { int_vector_sort( active_list ); { bool_vector_type * mask = alloc_mask( active_list ); bool valid = false; if (string_util_update_active_mask( range_string , mask )) { int_vector_reset( active_list ); { int i; for (i=0; i < bool_vector_size(mask); i++) { bool active = bool_vector_iget( mask , i ); if (active) int_vector_append( active_list , i ); } } valid = true; } bool_vector_free( mask ); return valid; } }
void test_empty() { int_vector_type * vec = int_vector_alloc(0,0); int_vector_sort( vec ); int_vector_select_unique( vec ); int_vector_free( vec ); }