[omniORB] I'm beginner. I need help about sequence manipulation.

unixwrld unixwrld at yahoo.com.ar
Wed Nov 3 09:46:26 GMT 2004


I thank for your help!    Yes, there are some syntax errors but you understand to me.  Now, I read the fooSK.cc and foo.h, but the declared classes in these files, they don't contain the length() method. Is those correct?
 
Thank!

Luke Deller <ldeller at xplantechnology.com> wrote:
unixwrld wrote:
> Hi, I have got my IDL file sample.idl:
> 
> interface sample {
> typdef struct struct_SAMPLE {
> long number;
> char text[32];
> } SAMPLE;
> 
> typedef sequence SAMPLES;
> void ShowData(out SAMPLES s);
> };

I suppose you haven't tried compiling this yet...
(1) You can't have two types which differ only in case (ie "sample" and "SAMPLE"). This is so that CORBA can support case-insensitive languages.
(2) "typdef" should be typedef.

Some stylistic points:
(3) There's no need for a typedef for the struct in this example
(4) CORBA has a type for text strings called "string". If you want to limit the length of the string you can use for example "string<32>". If you want to send binary data, use "octet"/"sequence" rather than "char"/"string".

I'll answer your next question assuming the following IDL:

interface foo {
struct SAMPLE {
long number;
string text;
};
typedef sequence SAMPLES;
void ShowData(out SAMPLES s);
};

> Now, I have got the follow prototype:
> 
> void SAMPLE::ShowData(SAMPLES_out s)
> 
> But I don't know how to alloc memory and data to "s".

Try something like this:
s = new foo::SAMPLES();
s->length(1)
s[0].number = 42;
s[0].text = CORBA::string_dup("foo");

Information like this can be found in the C++ language mapping specification found here:
http://www.omg.org/technology/documents/formal/c++.htm
Language-neutral information about CORBA and IDL can be found in the CORBA spec here:
http://www.omg.org/technology/documents/formal/corba_iiop.htm
Also, if you're learning CORBA, there's a book by Henning & Vinoski called "Advanced CORBA Programming with C++" which is pretty much the standard textbook in this area:
http://www.awprofessional.com/title/0201379279

Regards,
Luke.

		
---------------------------------
 Ahora podés usar Yahoo! Messenger en tu Unifón, en cualquier momento y lugar.
 Encontrá más información aquí.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20041103/505850c0/attachment.htm


More information about the omniORB-list mailing list