[omniORB] basic question about sequences
Michael
omniorb at bindone.de
Tue Aug 5 16:47:01 BST 2008
Yes it is (you cant call the method foo, cause it will clash with the
interface name though)
The C++ signature would be
seq_type* Foo_impl::bar(const seq_type& seq_in, seq_type_out seq_out)
{
std::auto_ptr<seq_type> ret(new seq_type);
ret->length(seq_in.length());
seq_out->length(seq_in.length());
for (unsigned int i=0; i<seq_in.length(); ++i)
{
seq_out[i] = seq_in[i]*2;
(*ret)[i] = seq_in[i]*3;
}
return ret.release();
}
(of course this works without auto_ptr, but it's a good habbit to
prevent memory leaks - you could also use _var and then release it, put
personally I prefer auto_ptr)
debutant wrote:
> Hello,
>
> Is it possible to use a sequence as an idl operation parameter or return
> type as follows ?
>
> typedef sequence<short> seq_type;
> interface Foo
> {
> seq_type foo(in seq_type seq_in, out seq_type seq_out);
> };
>
> I could not write an implementation that works.
>
> thanks!
> Michel
>
> ps: for those who read my previous post, the book will be delivered to me
> tomorrow !
More information about the omniORB-list
mailing list