[omniORB] Sequence examples

edward_lin edward_lin@EGPALM.com.tw
Tue, 15 May 2001 10:20:36 +0800


Howdy, 
Hope the following sample helps you.

IDL:
interface MyInterface
{
   typedef sequence<octet>   randSeq;
   void getRandSeq( out  randSeq  tx );
}

Object Implementation:
void MyInterface_i::getRandSeq( randSeq_out tx )
{
  MyInterface::randSeq*&  ptx = tx.ptr();
  //....
  CORBA::Octet* p = new CORBA::Octet[ len ];
  //....
  ptx = new MyInterface::randSeq(len,len,p);
}

Client:
void hello( MyInterface_ptr e )
{
  MyInterface::randSeq_var	tx;
  e->getRandSeq( tx.out() );
  long len = tx.length();
  for ( i = 0; i < len; i++ )
  {
    cout << tx[i] << endl;	// access
  }
}

Cheers and good luck,

Edward Lin


-----Original Message-----
From: Thomas Amsler [mailto:tpamsler@ucdavis.edu]
Sent: Tuesday, May 15, 2001 5:05 AM
To: omniorb-list@uk.research.att.com
Subject: [omniORB] Sequence examples


Are there any examples on how to use sequences with omniORB?
Thank you.

--
Thomas Amsler
tpamsler@ucdavis.edu
amsler@cs.ucdavis.edu
http://einstein.dyndns.org

"Imagination is more important than knowledge."
        --Albert Einstein