[omniORB] omniORB Insertion(extraction) of array

caoy guaguo at vip.sina.com
Thu Apr 29 11:22:28 BST 2004


I'm using Type any and Insertion(Extraction) of Arrays process.I defined my array in idl as below:

typedef CORBA::Float my_float_array[100];

After I pack the arary to any type, then unpack it to my_float_array type.The code is showed as below:

CORBA::Any data;  
my_float_array l = .....;         // Initialization of array
my_float_array_forany lh;

data <<= my_float_array_forany( l );  //Insert float array

if( data >>= lh )
  cout << lh[0] << endl;  // print first element of lh


//error: ISO C++ says that `T& 
//   _CORBA_Array_Fix_Forany<T_Helper, T>::operator[](long unsigned int) [with 
//   T_Helper = my_float_array_copyHelper, T = my_float_array_slice]' and `
//   operator[]' are ambiguous even though the worst conversion for the former is 
//   better than the worst conversion for the latter

I must modify codes as:

my_float_array tmpl;
my_float_array_copy(tmpl, lh);  // copy from lh to tmpl
cout << tmpl[0] << endl;        // print first element of tmpl

Is that the problem that my_float_array_forany do not overload operator[] in omniORB idl c++ mapping?


______________________________________

===================================================================



More information about the omniORB-list mailing list