C++ STD and sequences

Bruce Visscher bvisscher@mindspring.com
Sat, 31 Jan 1998 12:40:54 -0500



Ramana K Ramachandran wrote:

> hi
> I am planning to use STL to implement list, multimap etc on the (C++)
> server and copy it to a sequence when the (java/C++)client request for a
> list. Is this memory/time efficient?

I've done this.  It seems like a good approach to me.  In terms of
effeciency,I would suggest scanning the STL container to determine the
number of objects
to be returned before allocating the CORBA sequence.  Alternatively, you
could implement your own "eager" allocation strategy for CORBA sequences
ala std::vector.

> Also Are there any special things
> to take care of? (like incrementing reference count to keep the object)

IIRC, sequences are actually a little easier to deal with than other object
references (I'm still at the point that I have to review the CORBA spec
*carefully* each time I implement or use an IDL implementation to make
sure I get the reference count right.)

The other consideration is that the current implementation of omniORB is
not compatable with a standards comforming STL.  The biggest problem
is that it uses the classic iostream interface.  But if you use an STL that
is
based on the HP or SGI (or other "classic") implementation you should be
okay (what platform do you use?).

Steve Brenneis (my collegue) has enhanced the omniORB code base to
allow platforms that have namespace support to generate and use
namespaces.  It also will allow platforms to use the standard STL
and iostreams if that is available.  We're hoping this can be merged into
the
code base at some point.  He also has more exprience than I do with
using the STL and omniORB together.  I need to badger him into joining
this list:-).

>
>
> Any other efficient way to do this?
> thanks
> ramana
> PS: I wish there was a way to send STL objects!

I agree.  I recall a thread in the CORBA newsgroup that discussed this.An
article by Michi Henning seemed to imply that some future revision
of the C++ mapping would be more STL friendly (my wording).  I don't
know if this was just wishful thinking or if it will really happen.

Bruce

> --
> Ramana Ramachandran          off: 972-498-1029
> ramana.ramachandran@mci.com
> 1832 Bowin court             res: 972-394-8753
> ramana.ramachandran@iname.com
> Carrollton TX 75010