[omniORB] Pointer from a _var?

John Hedges john@drystone.co.uk
Thu, 21 Jun 2001 10:52:10 +0100


> The pointer inside the sequence would always be valid, unless the length 
of the sequence is 0. So you could indirectly test the pointer through the 
sequence's length() metod.
> For arithmetics inside the sequence buffer you have the [] operator.
>
> -Haarek-

Trouble is that using length() on an unititialised sequence is dangerous. 
It would probably be best to think of a way other than testing for NULL on 
a sequence - like having zero length sequences instead as Haarek suggests. 
However using ss.operator->() returns the value of the underlying T* 
despite being a bit wierd to look at :)

John


>
> Bruce Fountain wrote:
>
> > Stephen Crawley wrote:
> > > You need to get the contents of the _var.  Try this:
> > >
> > >   // Client.cpp
> > >     Foo::ShortSeq_var ss;
> > >     if (*ss == 0)
> > >     {
> > >         std::cout << "ss is null\n";
> > >     }
> >
> > I just tried this. It produces the identical error on compilation
> > (ie. still trying to find an == operator for FooShortSeq_var),
> > which would suggest that dereferencing using * doesn't give me a
> > (FooShortSeq*).
> >
> > Bruce
>
> --
> Haarek Ryeng
> Senior Software Development Engineer
> Data Respons AS, Sandviksvn. 26,N-1323 HOEVIK, Norway.
> Tel: +47 67112071 Mob: +47 90196734
>
>    Embedded Computers & Realtime Professionals
>              www.datarespons.no
>
>
>