예제 #1
0
/** Copy a settings group with the given name from the second model to
 the first.  (i.e., the arguments are in memcpy order). 

 You probably won't need this often---just use \ref apop_model_copy.
 */
void apop_settings_copy_group(apop_model *outm, apop_model *inm, char *copyme){
    Apop_assert_n(inm->settings, "The input model (i.e., the second argument to this function) has no settings.");
    void *g =  apop_settings_get_grp(inm, copyme, 'f');
    int i;
    for (i=0; inm->settings[i].name[0] !='\0'; i++)//retrieve the index.
       if (!strcmp(copyme, inm->settings[i].name))
           break;
    void *gnew = (inm->settings[i].copy) 
                    ? ((void *(*)(void*))inm->settings[i].copy)(g)
                    : g;
    apop_settings_group_alloc(outm, copyme, inm->settings[i].free, inm->settings[i].copy, gnew);
}
예제 #2
0
//need this for the apop_settings_model_group_alloc macro.
apop_model *apop_settings_group_alloc_wm(apop_model *model, char *type, void *free_fn, void *copy_fn, void *the_group){
    apop_settings_group_alloc(model, type, free_fn, copy_fn, the_group);
    return model;
}