comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: idl_conatiner::get and position
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: idl_conatiner::get and position [message #42766] Thu, 24 February 2005 16:01 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ben Tupper writes:

> When GETting objects in a container the POSITION keyword specifies the location
> of the objects needed. But they aren't returned in that order. They are
> returned in the order they are stored (first in - first out).
>
> Is there a way around this other than writing a method override?

We have run into this problem, too. Our sub-classed container
can either be normal or "indexed", in which case when you
remove something from a container it is replaced by a null
object, so that the position of the other objects in the container
is preserved.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: idl_conatiner::get and position [message #42932 is a reply to message #42766] Mon, 28 February 2005 07:16 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
David Fanning wrote:
> Ben Tupper writes:
>
>
>> When GETting objects in a container the POSITION keyword specifies the location
>> of the objects needed. But they aren't returned in that order. They are
>> returned in the order they are stored (first in - first out).
>>
>> Is there a way around this other than writing a method override?
>
>
> We have run into this problem, too. Our sub-classed container
> can either be normal or "indexed", in which case when you
> remove something from a container it is replaced by a null
> object, so that the position of the other objects in the container
> is preserved.
>


Interesting. I haven't had the need to preserve the space occupied by a removed
object.

Here's how I think I'll handle to first-in first-out ordering (or at least
something like this.)


FUNCTION myContainer::Get, $
COUNT = count, $
NOSORT = nosort, $
POSITION = position, $
_EXTRA = extra


nP = n_elements(position)
If keyword_Set(NoSort) AND (nP GT 1) Then Begin
arr = objarr(nP)
For i = 0, nP-1 Do $
arr[i] = self->Get(position = position[i], _EXTRA = extra)
count = nP
EndIf Else Begin
arr = $
self->IDL_CONTAINER::Get(position = position, $
COUNT = count, _EXTRA = extra)
EndElse

Return, arr
END


Thanks,
Ben
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: coordinates & transforms & plotting
Next Topic: idl_conatiner::get and position

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 16:24:46 PDT 2025

Total time taken to generate the page: 0.80152 seconds