[sldev] LLSD??

Kelly Linden kelly at lindenlab.com
Wed Nov 4 07:18:15 PST 2009


LLSD has two container classes, maps and arrays.  The LLSD map is a
std::vector<std::string,LLSD>, while the LLSD array is a std::vector<LLSD>.
These are both pretty much standard STL, wrapped to be LLSD based.

LLSD my_array = LLSD::emptyArray();
my_array.append(5);
std::cout << my_array[0] << std::endl;

You need to walk an array to see if an element is in it, there are some STL
helpers to do this in a single line but I don't know them off the top of my
head.

Since LLSD arrays are STL vectors and vectors are magic (resizing) arrays
and arrays are contiguous blocks of memory ... deleting is kind of a
complicated question.  I think .erase does what you want but it can be
expensive since all elements after the one being deleted need to be moved.
Here is a result from google that talks about ways to more efficiently
remove lots of items:

http://www.gamedev.net/community/forums/topic.asp?topic_id=430548&whichpage=1&#2863448

I hope this helps!  I didn't go into maps since you asked about lists and
arrays are closer to a list than a map is. :)

 - Kelly


On Tue, Nov 3, 2009 at 10:51 PM, malachi <malachi at tamzap.com> wrote:

> am curious if anyone can point me in the right directions. and hopefully
> shine some light on the functions that are used to work with LLSD elements.
>
> specifically how to maintain LLSD lists. how to add to a list and remove
> items from the list as well as how to test to see if an LLSD element
> contains an item.
>
> many thanks in advance.
>
> _______________________________________________
> Policies and (un)subscribe information available here:
> http://wiki.secondlife.com/wiki/SLDev
> Please read the policies before posting to keep unmoderated posting
> privileges
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/sldev/attachments/20091104/7278ab9d/attachment.htm 


More information about the SLDev mailing list