예제 #1
0
파일: main.cpp 프로젝트: italianoan/rtscan
int main(int argc, char *argv[])
{

    Sym_Params sys;
int verbose;
    int type_Alg;
    int taskOrderSelection;
    Allocation allocation;
    cout<<"Verbose option?"<<endl;
    cout<<"1 - Yes"<<endl;
    cout<<"0 - No"<<endl;
    cin >>verbose;
    if(verbose==1)
    cout<<"Verbose option!"<<endl;
    cout<<"Select the type of algorithm! Digit:"<<endl;
    cout<<"0 - First Fit "<<endl;
    cout<<"1 - Best Fit"<<endl;
    cout<<"2 - Worst Fit"<<endl;
    cin >>type_Alg;
    if(verbose==1)
    {
        cout<<"select alg:"<<type_Alg<<endl;
    }
    cout<<"Select the type of order in which tasks are selected! Digit:"<<endl;
    cout<<"0 - Precedence Order "<<endl;
    cout<<"1 - Decrease Computation Time Order"<<endl;
    cout<<"2 - Increase Computation Time Order"<<endl;
    cin>>taskOrderSelection;
    if(verbose==1)
    {
        cout<<"select task:"<<taskOrderSelection<<endl;
    }
    sys.parse_args(argc, argv);
    sys.print_params();
    cout<< "input file name "<<sys.input_filename.c_str()<<endl;
    ifstream is;
    is.open(sys.input_filename.c_str(),ios_base::in);
    if(is.is_open())
        cout <<"file is open"<<endl;
    else
        cout<<"file is close"<<endl;
    cout<< "input file name processor "<<sys.input_processor_filename.c_str()<<endl;
    ifstream isp;
    isp.open(sys.input_processor_filename.c_str(),ios_base::in);
    if(isp.is_open())
        cout <<"file is open"<<endl;
    else
        cout<<"file is close"<<endl;

    read_input_file(is, sys);
    read_proc_file(isp,sys);
    if (sys.pipes_data.size() == 0)
        cout << "No more task sets to process, exiting!" << endl;


    CheckFeasibility* mainClass = new CheckFeasibility( taskOrderSelection , type_Alg, sys.pipes_data,sys.period_deadline, sys.processors,verbose);
    allocation= mainClass->check();
    allocation.printAllocation();
    mainClass->printProcessor();
    return 0;
}