LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

lists from toolbox.fp

Hi,

I often use the lists functions from the toolbox.fp. I wonder if the the list can be reallocated when adding ( deleting ) items because I use pointers to items with the callbackdata attribute. If there is reallocation, I can't do that, so I must use the index of items instead of the pointer. What is the best choice to guarantee the access to items ?

thank you.
0 Kudos
Message 1 of 3
(3,061 Views)
Hello

Im not sure if I understood the question, but by definition, a list can just insert a node anywhere in the middle of the list. So if you had a pointer pointing to some location in the middle of the node, if you inserted a node somwhere in the middle, your count for the location of where the pointer was in the list would automatically become invalid. The best thing to avoid complication would be to iterate thru the list from the head. You can have a look at the code for the list functions, its the toolbox.c file in the same folder as the toolbox fp. It'll gie you a better idea of how the list functions are working.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,061 Views)
I tried to use Preallocate() function to avoid the reallocation that can occurs during insertion. My problem is that I want to associate each item with a different control.I used the callbackdata and a pointer to an item, but in case of reallocation ( when inserting new items), the pointer can change.That's not better with the index, because it can change too.So I use preallocate and pointer because the list as a known maximum of items.

Thank you for your message.
0 Kudos
Message 3 of 3
(3,061 Views)