[omniORB] problems with Matrix

Clarke Brunt clarke.brunt at trafficmaster.co.uk
Fri Nov 17 17:11:19 GMT 2006


Tomás Dias Almeida wrote:
> I have defined a structure Image containing a matrix. But the client
> doesn't work. 
> There is an error message: " terminate called after throwing an
> instance of 'CORBA::BAD_PARAM' " and I think the problem is the
> initialization of the matrix: 
> 
>    Image img;
>    img.m[0][0] = (CORBA::Octet) 6;
>    ...
>    img.m[2][2] = (CORBA::Octet) 6;
>    img.nbl = 3;
>    img.nbc = 3;
> 
> ---- file.idl
> typedef sequence<sequence<octet>  > Matrix;
> struct Image{
>   Matrix m;
>   short _nbc;
>   short _nbl;
> };
> 
> Please help me, where can i find a solution ?

You don't appear to have allocated any memory for the sequences. This could easily be wrong, as I haven't tried it, and have never used a 'sequence of sequences' myself, but I imagine you would need something like:

Image img;
img.length(2);	// allocate two elements: you can now access img[0] and img[1]
img[0].length(2);	// allocate length of sub-sequence
img[1].length(2);	// needn't be the same length

Then fill in the elements as you were doing.

I suspect you might need to read up about the C++ binding for CORBA, as you will probably soon find other things that you won't know how to do.

-- 
Clarke Brunt, Principal Software Engineer, Trafficmaster


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.



More information about the omniORB-list mailing list