[omniORB] Problem passing an array of structs
W T Meyer
meyer at iastate.edu
Fri May 18 17:23:00 BST 2007
Since no one else responded, I'll answer my own question. I know how
to get around the problem, but I don't understand why it is a problem.
Apparently operator[] is overloaded in omniORB only for unsigned
int. When I changed the index variable i in line 90 from "int i" to
"unsigned int i" everything worked. The error message is somewhat
less than transparent in pointing to the problem.
Is there a reason for requiring unsigned ints? If so, is there a way
to give the hapless user a more helpful error message?
Regards,
Tom
At 03:40 PM 5/7/2007, W T Meyer wrote:
>I'm trying to pass a fixed-length array of structs and I'm getting a
>cryptic error message. I see others have posted similar - but not
>identical - problems and it is not clear to me what the solution or
>workaround is. Can someone provide some insight?
>
>Here is my IDL:
>------------
>module CoRCC {
>
> enum vmeType {SBC, ROD, TIM, EMPTY, OTHER, UNKNOWNTYPE};
> enum vmeModStatus {OK, WARNING, ERROR, UNKNOWNSTATUS};
> struct slotInfo {
> vmeType contents;
> long serNo;
> vmeModStatus status;
> long revision;
> };
>
> typedef slotInfo crateInfo[22];
>
> interface RCC {
> long scanCrate(out crateInfo modList);
> }; /* end of interface RCC */
>}; /* end of module CoRCC */
>-----------
>In my server application, everything compiles and links with no
>warnings or errors.
>
>When I try to build a client, I get the following error message:
>-------------
>CoRCCClient.cc:92: choosing `T& _CORBA_Array_Fix_Var<T_Helper,
> T>::operator[](long unsigned int) [with T_Helper =
> CoRCC::crateInfo_copyHelper, T = CoRCC::crateInfo_slice]' over
> `operator[]'
>CoRCCClient.cc:92: because worst conversion for the former is better than
> worst conversion for the latter
>-------------
>
>The relevant part of the client code is as follows:
>-------------
>int ScanCrate(int rccHandle) {
> int status = 0;
> int serNo;
> CoRCC::crateInfo_var modList = new CoRCC::crateInfo();
> status = rccref[rccHandle]->scanCrate(modList);
> for (int i=2; i<NSLOTS+1; i++) {
> cout << "Slot Number " << i << endl;
> serNo = modList[i].serNo; //<<<< This is line 92,
> where the error is
> }
> return status;
>}
>
>
>_______________________________________________
>omniORB-list mailing list
>omniORB-list at omniorb-support.com
>http://www.omniorb-support.com/mailman/listinfo/omniorb-list
More information about the omniORB-list
mailing list