[omniORB] A question about sequences

b.keeping@ic.ac.uk b.keeping@ic.ac.uk
Wed, 4 Aug 1999 13:32:09 +0100


To Tony:

You should just be passing seq itself here. A _var can be used like a
pointer, except that it cleans up the thing it points to when it goes
out of scope. So think of the call as passing a pointer to a sequence (by
reference, so that it can be changed).

Your client code could look like this:

doSomething( seq );
for (int i=0;i<seq->length();i++)
	cout<<seq[i];

incidentally the server code could look like this (assuming unbounded sequence)

void doSomething( MySequence *&parm )
{
  parm=new MySequence(2);
  parm->length(2);
  (*parm)[0]=val1; // where val1 and val2 are some values of whatever
  (*parm)[1]=val2; // type it's a sequence of!
}

To All:

This question demonstrates a need for an example on sequences in the
distribution. They took me a while to work out and I didn't find a
book that seemed to consider them very important!

Also, any comments on the way I'm doing things here welcome.

Ben Keeping
Imperial College