manel1989 0 Light Poster

hi all!

i have to send a whole vector as a parameter from a code java (eclipse) to a c++ code(VS2010)i have some quations about that:

  1. how can i send the whole vector in once? i already know how to send it element by element so i want to try this because i want to minimize the time of sending a vector and the time of receipt of the response since I sent this vector from java and I want the result of c + + code in Java also. this is my code in java which send element by element.

           for(int i=0; i<R1.size();i++)
    
             {   
               pw.println(R1.get(i));
               }
    

    here my c++ code for reception:

    vector<int> ReadInput::lire_RAM_nodes()
    {

    for ( int i=0;i < NbrNodes; i++)
    

    {
    std::cin >> a;
    R.push_back(a);
    }
    /for ( int i=0; i<R.size();i++)
    {
    std::cout<<R[i]<< std::endl;
    }
    /
    return R;
    }

  2. In my c++ code i have to use 2 variables n and m more then once ,so for some raison that i dont know, when i need to use m or n i have to send theme again from java code!!!!! and that's feel no right i think!!!!!
    here is my java code :for sending m and n :

               pw.println(m);
               pw.println(n);
               pw.println(m);
               pw.println(n);
    

and here is my c++ code that recives m and n from java :

 const int ReadInput::lire_size_nodes()
{
    cin>>NbrNodes;
    //cout<<NbrNodes<<endl;
    return NbrNodes;
}
 const int ReadInput::lire_size_testers()
{
    cin>>NbrTersters;
    //cout<<NbrTersters<<endl;
    return NbrTersters;
}

and here when i use m and n in c++ :

MMKP (const Options& opt) : a(*this,readinput.lire_size_nodes()*readinput.lire_size_testers(),0,1){

Matrix <BoolVarArray> X (a,readinput.lire_size_nodes(),readinput.lire_size_testers());

so do you have any idea for that?? do i have to change any thing about that ??

thank you for any help