Exemple #1
0
int restore_stl(std::stack<std::string> & in_stl , std::string object_name , std::string var_name ) {

    unsigned int ii ;
    unsigned int cont_size ;

    REF2 * items_ref ;
    char ** items ;
    std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');

    //message_publish(1, "RESTORE_STL_STACK %s_%s\n", object_name.c_str() , var_name.c_str()) ;

    cont_size = in_stl.size() ;
    for ( ii = 0 ; ii < cont_size ; ii++ ) {
        in_stl.pop() ;
    }

    items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name).c_str()) ;

    if ( items_ref != NULL ) {
        items = (char **)items_ref->address ;
        cont_size = get_size((char *)items) ;

        for ( ii = cont_size - 1 ; ii < cont_size ; ii-- ) {
            in_stl.push( items[ii] ) ;
        }
        delete_stl( in_stl , object_name , var_name ) ;
    }

    return 0 ;
}
Exemple #2
0
int IntegLoopSimObject::call_function ( Trick::JobData * curr_job ) {

    int trick_ret = 0 ;
    if ( curr_job->disabled ) return (trick_ret) ;

    switch ( curr_job->id ) {
        case 0:
            integ_sched.rebuild_jobs() ;
            break ;
        case 1:
            integ_sched.get_first_step_deriv_from_integrator() ;
            break ;
        case 2:
            integ_sched.call_deriv_jobs() ;
            break ;
        case 3:
            integ_sched.integrate() ;
            break ;
        case 4:
            checkpoint_stl(integ_sched.sim_objects, name + std::string("_") + std::string("integ_sched.sim_objects"), std::string("")) ;
            break ;
        case 5:
            delete_stl (integ_sched.sim_objects, name + std::string("_") + std::string("integ_sched.sim_objects"), std::string("")) ;
            break ;
        case 6:
            restore_stl (integ_sched.sim_objects, name + std::string("_") + std::string("integ_sched.sim_objects"), std::string("")) ;
            break ;
        case 7:
            integ_sched.restart_checkpoint() ;
            break ;
        case 8:
            integ_sched.rebuild_jobs() ;
            break ;
        case 9:
            integ_sched.get_first_step_deriv_from_integrator() ;
            break ;
        default:
            trick_ret = -1 ;
            break ;
    }

    return(trick_ret) ;
}